-
Notifications
You must be signed in to change notification settings - Fork 58
61 lines (49 loc) · 1.64 KB
/
Copy pathdb-migrations.yaml
File metadata and controls
61 lines (49 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: DB Migrations
on:
push:
branches:
- develop
pull_request:
workflow_dispatch:
jobs:
alembic-migrations:
strategy:
matrix:
python-version: ["3.10"]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
python-version: ${{ matrix.python-version }}
enable-cache: true
- name: Install dependencies
run: uv sync --locked --extra cpu --no-install-package llama-cpp-python
- name: Set DB env vars
run: |
echo "DB_FILE=$RUNNER_TEMP/dashai-ci.sqlite3" >> "$GITHUB_ENV"
echo "DATABASE_URL=sqlite:///$RUNNER_TEMP/dashai-ci.sqlite3" >> "$GITHUB_ENV"
echo "Temp dir: $RUNNER_TEMP"
- name: Show Alembic info
run: |
uv run --no-sync alembic --version
echo "DB will be at: $DATABASE_URL"
- name: Prepare temp dir
run: |
mkdir -p "$(dirname "$DB_FILE")"
rm -f "$DB_FILE"
# upgrade to head
- name: Upgrade to head
run: |
uv run --no-sync alembic -x url="$DATABASE_URL" upgrade head
# Checks downgrade and upgrade again (reversibility)
- name: Downgrade to base and upgrade again (reversibility check)
run: |
uv run --no-sync alembic -x url="$DATABASE_URL" downgrade base
uv run --no-sync alembic -x url="$DATABASE_URL" upgrade head
- name: Check for pending autogenerate (python-based)
env:
PYTHONPATH: "${PYTHONPATH}:."
run: uv run --no-sync python -m scripts.ci_alembic_check