2024-05-31 16:45:34 +08:00
|
|
|
name: DB Migration Test
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
paths:
|
|
|
|
- api/migrations/**
|
|
|
|
|
|
|
|
concurrency:
|
|
|
|
group: db-migration-test-${{ github.ref }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
db-migration-test:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
python-version:
|
|
|
|
- "3.10"
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
|
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
|
|
uses: actions/setup-python@v5
|
|
|
|
with:
|
|
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
cache-dependency-path: |
|
2024-06-12 14:43:03 +08:00
|
|
|
api/pyproject.toml
|
|
|
|
api/poetry.lock
|
2024-05-31 16:45:34 +08:00
|
|
|
|
2024-10-15 17:56:11 +08:00
|
|
|
- name: Install Poetry
|
|
|
|
uses: abatilo/actions-poetry@v3
|
|
|
|
|
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-05-31 16:45:34 +08:00
|
|
|
uses: hoverkraft-tech/compose-action@v2.0.0
|
|
|
|
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
|