From 2576ba6bbcdb766b18a6cce03d7db191baf51f2e Mon Sep 17 00:00:00 2001 From: Georges-Antoine Assi Date: Mon, 26 Jan 2026 21:30:01 -0500 Subject: [PATCH 1/4] Add workflow to run migrations on PR --- .github/workflows/migrations.yml | 95 ++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 .github/workflows/migrations.yml diff --git a/.github/workflows/migrations.yml b/.github/workflows/migrations.yml new file mode 100644 index 000000000..1cc043026 --- /dev/null +++ b/.github/workflows/migrations.yml @@ -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 From 958a337ce2be08a6024c8b72f084b0f30bd137d6 Mon Sep 17 00:00:00 2001 From: Georges-Antoine Assi Date: Mon, 26 Jan 2026 21:31:27 -0500 Subject: [PATCH 2/4] tweak test in migration file --- .github/workflows/migrations.yml | 2 ++ backend/alembic/versions/0067_romfile_category_enum_cheat.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/migrations.yml b/.github/workflows/migrations.yml index 1cc043026..7b171c361 100644 --- a/.github/workflows/migrations.yml +++ b/.github/workflows/migrations.yml @@ -5,6 +5,8 @@ on: paths: - "backend/alembic/versions/**" +permissions: read-all + jobs: migrate-postgres: runs-on: ubuntu-latest diff --git a/backend/alembic/versions/0067_romfile_category_enum_cheat.py b/backend/alembic/versions/0067_romfile_category_enum_cheat.py index 0eedc1737..79251830b 100644 --- a/backend/alembic/versions/0067_romfile_category_enum_cheat.py +++ b/backend/alembic/versions/0067_romfile_category_enum_cheat.py @@ -1,4 +1,4 @@ -"""Update rom_file.category column enum +"""Update rom_file.category column enum to include cheats Revision ID: 0067_romfile_category_enum_cheat Revises: 0066_fix_empty_flashpoint_id From 08839b85c25c1579498d100587ddfa4b9d638637 Mon Sep 17 00:00:00 2001 From: Georges-Antoine Assi Date: Mon, 26 Jan 2026 21:40:07 -0500 Subject: [PATCH 3/4] add missing env var --- .github/workflows/migrations.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/migrations.yml b/.github/workflows/migrations.yml index 7b171c361..9c37098f6 100644 --- a/.github/workflows/migrations.yml +++ b/.github/workflows/migrations.yml @@ -47,6 +47,7 @@ jobs: DB_USER: user DB_PASSWD: password DB_NAME: testdb + ROMM_AUTH_SECRET_KEY: xxxxxxxxxxxxxxxxx run: uv run alembic upgrade head migrate-mariadb: @@ -94,4 +95,5 @@ jobs: DB_USER: user DB_PASSWD: password DB_NAME: testdb + ROMM_AUTH_SECRET_KEY: xxxxxxxxxxxxxxxxx run: uv run alembic upgrade head From 5f58deb3eca754e9f1b38f6bb325a9b9542384ed Mon Sep 17 00:00:00 2001 From: Georges-Antoine Assi Date: Mon, 26 Jan 2026 21:50:41 -0500 Subject: [PATCH 4/4] set more env vars --- .github/workflows/migrations.yml | 18 ++++++++++++------ backend/pytest.ini | 2 +- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/.github/workflows/migrations.yml b/.github/workflows/migrations.yml index 9c37098f6..5adb3bc7a 100644 --- a/.github/workflows/migrations.yml +++ b/.github/workflows/migrations.yml @@ -10,6 +10,9 @@ permissions: read-all jobs: migrate-postgres: runs-on: ubuntu-latest + permissions: + checks: write + pull-requests: write services: postgres: image: postgres:15 @@ -24,7 +27,6 @@ jobs: --health-interval 10s --health-timeout 5s --health-retries 5 - steps: - name: Checkout code uses: actions/checkout@v4 @@ -47,11 +49,15 @@ jobs: DB_USER: user DB_PASSWD: password DB_NAME: testdb - ROMM_AUTH_SECRET_KEY: xxxxxxxxxxxxxxxxx + ROMM_AUTH_SECRET_KEY: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + ROMM_BASE_PATH: romm_test run: uv run alembic upgrade head migrate-mariadb: runs-on: ubuntu-latest + permissions: + checks: write + pull-requests: write services: mariadb: image: mariadb:10.11 @@ -67,10 +73,9 @@ jobs: --health-interval 10s --health-timeout 5s --health-retries 5 - steps: - - name: Checkout code - uses: actions/checkout@v4 + - name: Checkout repository + uses: actions/checkout@v4.3.0 - name: Install mariadb connectors run: | @@ -95,5 +100,6 @@ jobs: DB_USER: user DB_PASSWD: password DB_NAME: testdb - ROMM_AUTH_SECRET_KEY: xxxxxxxxxxxxxxxxx + ROMM_AUTH_SECRET_KEY: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + ROMM_BASE_PATH: romm_test run: uv run alembic upgrade head diff --git a/backend/pytest.ini b/backend/pytest.ini index 73b8bc455..98b3089fb 100644 --- a/backend/pytest.ini +++ b/backend/pytest.ini @@ -16,7 +16,7 @@ env = SCREENSCRAPER_PASSWORD=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx STEAMGRIDDB_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx LAUNCHBOX_API_ENABLED=true - ROMM_AUTH_SECRET_KEY=843f6cefc5ba1430d54061301c2893be00c2aef11dae39ffec13a2af1a86e867 + ROMM_AUTH_SECRET_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ENABLE_RESCAN_ON_FILESYSTEM_CHANGE=true ENABLE_SCHEDULED_RESCAN=true ENABLE_SCHEDULED_UPDATE_SWITCH_TITLEDB=true