Skip to content

Speakr is a personal, self-hosted web application designed for transcribing audio recordings

Python

Gate Docker publish on PostgreSQL migration tests passing

Murtaza Nasirbd5dc5779c4f
diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml
index 4ccd7f35..8cb3d4cc 100644
--- a/.github/workflows/docker-publish.yml
+++ b/.github/workflows/docker-publish.yml
@@ -14,7 +14,46 @@ env:
IMAGE_NAME: learnedmachine/speakr
jobs:
+ test:
+ runs-on: ubuntu-latest
+
+ services:
+ postgres:
+ image: postgres:16
+ env:
+ POSTGRES_USER: speakr
+ POSTGRES_PASSWORD: speakr
+ POSTGRES_DB: speakr_test
+ ports:
+ - 5432:5432
+ options: >-
+ --health-cmd "pg_isready -U speakr"
+ --health-interval 10s
+ --health-timeout 5s
+ --health-retries 5
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v4
+
+ - name: Set up Python
+ uses: actions/setup-python@v5
+ with:
+ python-version: '3.11'
+
+ - name: Install dependencies
+ run: pip install -r requirements.txt
+
+ - name: Run static migration compatibility tests
+ run: python tests/test_migration_compatibility.py
+
+ - name: Run migrations against PostgreSQL
+ env:
+ TEST_DATABASE_URI: postgresql://speakr:speakr@localhost:5432/speakr_test
+ run: python tests/test_postgres_migrations.py
+
build:
+ needs: test
runs-on: ubuntu-latest
permissions:
contents: read
@@ -81,6 +120,7 @@ jobs:
PRODUCTION=1
build-lite:
+ needs: test
runs-on: ubuntu-latest
permissions:
contents: read
diff --git a/.github/workflows/test-postgres.yml b/.github/workflows/test-postgres.yml
deleted file mode 100644
index 567f77de..00000000
--- a/.github/workflows/test-postgres.yml
+++ /dev/null
@@ -1,56 +0,0 @@
-name: PostgreSQL Migration Tests
-
-on:
- push:
- paths:
- - 'src/init_db.py'
- - 'src/utils/database.py'
- - 'src/models/**'
- - 'tests/test_postgres_migrations.py'
- - 'tests/test_migration_compatibility.py'
- pull_request:
- paths:
- - 'src/init_db.py'
- - 'src/utils/database.py'
- - 'src/models/**'
- - 'tests/test_postgres_migrations.py'
- - 'tests/test_migration_compatibility.py'
-
-jobs:
- test:
- runs-on: ubuntu-latest
-
- services:
- postgres:
- image: postgres:16
- env:
- POSTGRES_USER: speakr
- POSTGRES_PASSWORD: speakr
- POSTGRES_DB: speakr_test
- ports:
- - 5432:5432
- options: >-
- --health-cmd "pg_isready -U speakr"
- --health-interval 10s
- --health-timeout 5s
- --health-retries 5
-
- steps:
- - name: Checkout repository
- uses: actions/checkout@v4
-
- - name: Set up Python
- uses: actions/setup-python@v5
- with:
- python-version: '3.11'
-
- - name: Install dependencies
- run: pip install -r requirements.txt
-
- - name: Run static migration compatibility tests
- run: python tests/test_migration_compatibility.py
-
- - name: Run migrations against PostgreSQL
- env:
- TEST_DATABASE_URI: postgresql://speakr:speakr@localhost:5432/speakr_test
- run: python tests/test_postgres_migrations.py