You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

db-migration-test.yml 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. name: DB Migration Test
  2. on:
  3. workflow_call:
  4. concurrency:
  5. group: db-migration-test-${{ github.ref }}
  6. cancel-in-progress: true
  7. jobs:
  8. db-migration-test:
  9. runs-on: ubuntu-latest
  10. steps:
  11. - name: Checkout code
  12. uses: actions/checkout@v4
  13. with:
  14. fetch-depth: 0
  15. persist-credentials: false
  16. - name: Setup UV and Python
  17. uses: astral-sh/setup-uv@v6
  18. with:
  19. enable-cache: true
  20. python-version: "3.12"
  21. cache-dependency-glob: api/uv.lock
  22. - name: Install dependencies
  23. run: uv sync --project api
  24. - name: Ensure Offline migration are supported
  25. run: |
  26. # upgrade
  27. uv run --directory api flask db upgrade 'base:head' --sql
  28. # downgrade
  29. uv run --directory api flask db downgrade 'head:base' --sql
  30. - name: Prepare middleware env
  31. run: |
  32. cd docker
  33. cp middleware.env.example middleware.env
  34. - name: Set up Middlewares
  35. uses: hoverkraft-tech/compose-action@v2.0.2
  36. with:
  37. compose-file: |
  38. docker/docker-compose.middleware.yaml
  39. services: |
  40. db
  41. redis
  42. - name: Prepare configs
  43. run: |
  44. cd api
  45. cp .env.example .env
  46. - name: Run DB Migration
  47. env:
  48. DEBUG: true
  49. run: uv run --directory api flask upgrade-db