mirror of
https://github.com/rommapp/romm.git
synced 2026-02-18 00:27:41 +01:00
Add workflow to run migrations on PR
This commit is contained in:
95
.github/workflows/migrations.yml
vendored
Normal file
95
.github/workflows/migrations.yml
vendored
Normal file
@@ -0,0 +1,95 @@
|
||||
name: Run Migrations
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- "backend/alembic/versions/**"
|
||||
|
||||
jobs:
|
||||
migrate-postgres:
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:15
|
||||
env:
|
||||
POSTGRES_USER: user
|
||||
POSTGRES_PASSWORD: password
|
||||
POSTGRES_DB: testdb
|
||||
ports:
|
||||
- 5432:5432
|
||||
options: >-
|
||||
--health-cmd pg_isready
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v6.7.0
|
||||
|
||||
- name: Install python
|
||||
run: uv python install 3.13
|
||||
|
||||
- name: Install dependencies
|
||||
run: uv sync
|
||||
|
||||
- name: Run PostgreSQL Migrations
|
||||
working-directory: backend
|
||||
env:
|
||||
ROMM_DB_DRIVER: postgresql
|
||||
DB_HOST: localhost
|
||||
DB_PORT: 5432
|
||||
DB_USER: user
|
||||
DB_PASSWD: password
|
||||
DB_NAME: testdb
|
||||
run: uv run alembic upgrade head
|
||||
|
||||
migrate-mariadb:
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
mariadb:
|
||||
image: mariadb:10.11
|
||||
env:
|
||||
MARIADB_USER: user
|
||||
MARIADB_PASSWORD: password
|
||||
MARIADB_DATABASE: testdb
|
||||
MARIADB_ROOT_PASSWORD: root
|
||||
ports:
|
||||
- 3306:3306
|
||||
options: >-
|
||||
--health-cmd "mysqladmin ping -h 127.0.0.1 -u root --password=root"
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install mariadb connectors
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libmariadb3 libmariadb-dev
|
||||
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v6.7.0
|
||||
|
||||
- name: Install python
|
||||
run: uv python install 3.13
|
||||
|
||||
- name: Install dependencies
|
||||
run: uv sync
|
||||
|
||||
- name: Run MariaDB Migrations
|
||||
working-directory: backend
|
||||
env:
|
||||
ROMM_DB_DRIVER: mariadb
|
||||
DB_HOST: 127.0.0.1
|
||||
DB_PORT: 3306
|
||||
DB_USER: user
|
||||
DB_PASSWD: password
|
||||
DB_NAME: testdb
|
||||
run: uv run alembic upgrade head
|
||||
Reference in New Issue
Block a user