2024-05-31 16:45:34 +08:00
|
|
|
name: DB Migration Test
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
paths:
|
|
|
|
- api/migrations/**
|
2024-11-08 09:33:12 +08:00
|
|
|
- .github/workflows/db-migration-test.yml
|
2024-05-31 16:45:34 +08:00
|
|
|
|
|
|
|
concurrency:
|
|
|
|
group: db-migration-test-${{ github.ref }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
db-migration-test:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
|
2024-11-08 17:30:26 +08:00
|
|
|
- name: Setup Poetry and Python
|
|
|
|
uses: ./.github/actions/setup-poetry
|
2024-05-31 16:45:34 +08:00
|
|
|
with:
|
2024-11-08 17:30:26 +08:00
|
|
|
poetry-lockfile: api/poetry.lock
|
2024-10-15 17:56:11 +08:00
|
|
|
|
2024-05-31 16:45:34 +08:00
|
|
|
- name: Install dependencies
|
2024-06-12 14:43:03 +08:00
|
|
|
run: poetry install -C api
|
2024-05-31 16:45:34 +08:00
|
|
|
|
2024-06-29 20:28:30 +08:00
|
|
|
- name: Prepare middleware env
|
|
|
|
run: |
|
|
|
|
cd docker
|
|
|
|
cp middleware.env.example middleware.env
|
|
|
|
|
2024-06-18 13:26:01 +08:00
|
|
|
- name: Set up Middlewares
|
2024-11-06 13:55:29 +08:00
|
|
|
uses: hoverkraft-tech/compose-action@v2.0.2
|
2024-05-31 16:45:34 +08:00
|
|
|
with:
|
|
|
|
compose-file: |
|
|
|
|
docker/docker-compose.middleware.yaml
|
|
|
|
services: |
|
|
|
|
db
|
2024-06-18 13:26:01 +08:00
|
|
|
redis
|
2024-05-31 16:45:34 +08:00
|
|
|
|
|
|
|
- name: Prepare configs
|
|
|
|
run: |
|
|
|
|
cd api
|
|
|
|
cp .env.example .env
|
|
|
|
|
|
|
|
- name: Run DB Migration
|
|
|
|
run: |
|
|
|
|
cd api
|
2024-06-18 13:26:01 +08:00
|
|
|
poetry run python -m flask upgrade-db
|