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