db-migration-test.yml 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. strategy:
  16. matrix:
  17. python-version:
  18. - "3.10"
  19. steps:
  20. - name: Checkout code
  21. uses: actions/checkout@v4
  22. - name: Set up Python ${{ matrix.python-version }}
  23. uses: actions/setup-python@v5
  24. with:
  25. python-version: ${{ matrix.python-version }}
  26. cache-dependency-path: |
  27. api/pyproject.toml
  28. api/poetry.lock
  29. - name: Install Poetry
  30. uses: abatilo/actions-poetry@v3
  31. - name: Install dependencies
  32. run: poetry install -C api
  33. - name: Prepare middleware env
  34. run: |
  35. cd docker
  36. cp middleware.env.example middleware.env
  37. - name: Set up Middlewares
  38. uses: hoverkraft-tech/compose-action@v2.0.2
  39. with:
  40. compose-file: |
  41. docker/docker-compose.middleware.yaml
  42. services: |
  43. db
  44. redis
  45. - name: Prepare configs
  46. run: |
  47. cd api
  48. cp .env.example .env
  49. - name: Run DB Migration
  50. run: |
  51. cd api
  52. poetry run python -m flask upgrade-db