db-migration-test.yml 1.3 KB

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