db-migration-test.yml 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. name: DB Migration Test
  2. on:
  3. pull_request:
  4. branches:
  5. - main
  6. paths:
  7. - api/migrations/**
  8. - .github/workflows/db-migration-test.yml
  9. concurrency:
  10. group: db-migration-test-${{ github.ref }}
  11. cancel-in-progress: true
  12. jobs:
  13. db-migration-test:
  14. runs-on: ubuntu-latest
  15. steps:
  16. - name: Checkout code
  17. uses: actions/checkout@v4
  18. with:
  19. fetch-depth: 0
  20. persist-credentials: false
  21. - name: Setup Poetry and Python
  22. uses: ./.github/actions/setup-poetry
  23. with:
  24. poetry-lockfile: api/poetry.lock
  25. - name: Install dependencies
  26. run: poetry install -C api
  27. - name: Prepare middleware env
  28. run: |
  29. cd docker
  30. cp middleware.env.example middleware.env
  31. - name: Set up Middlewares
  32. uses: hoverkraft-tech/compose-action@v2.0.2
  33. with:
  34. compose-file: |
  35. docker/docker-compose.middleware.yaml
  36. services: |
  37. db
  38. redis
  39. - name: Prepare configs
  40. run: |
  41. cd api
  42. cp .env.example .env
  43. - name: Run DB Migration
  44. env:
  45. DEBUG: true
  46. run: |
  47. cd api
  48. poetry run python -m flask upgrade-db