ci: start postgres explicitly for tests
This commit is contained in:
+19
-32
@@ -11,20 +11,8 @@ jobs:
|
|||||||
rust:
|
rust:
|
||||||
name: Rust Checks
|
name: Rust Checks
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
services:
|
|
||||||
postgres:
|
|
||||||
image: postgres:16-alpine
|
|
||||||
env:
|
env:
|
||||||
POSTGRES_DB: crank_test
|
TEST_DATABASE_URL: postgres://postgres:postgres@127.0.0.1:55432/crank_test
|
||||||
POSTGRES_USER: postgres
|
|
||||||
POSTGRES_PASSWORD: postgres
|
|
||||||
options: >-
|
|
||||||
--health-cmd "pg_isready -U postgres -d crank_test"
|
|
||||||
--health-interval 10s
|
|
||||||
--health-timeout 5s
|
|
||||||
--health-retries 5
|
|
||||||
env:
|
|
||||||
TEST_DATABASE_URL: postgres://postgres:postgres@postgres:5432/crank_test
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@@ -38,6 +26,20 @@ jobs:
|
|||||||
cargo clippy --version
|
cargo clippy --version
|
||||||
docker --version
|
docker --version
|
||||||
|
|
||||||
|
- name: Start test PostgreSQL
|
||||||
|
run: |
|
||||||
|
docker rm -f crank-ci-postgres-rust >/dev/null 2>&1 || true
|
||||||
|
docker run -d --rm \
|
||||||
|
--name crank-ci-postgres-rust \
|
||||||
|
-e POSTGRES_DB=crank_test \
|
||||||
|
-e POSTGRES_USER=postgres \
|
||||||
|
-e POSTGRES_PASSWORD=postgres \
|
||||||
|
-p 55432:5432 \
|
||||||
|
postgres:16-alpine
|
||||||
|
until docker exec crank-ci-postgres-rust pg_isready -U postgres -d crank_test; do
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
- name: Check formatting
|
- name: Check formatting
|
||||||
run: cargo fmt --all --check
|
run: cargo fmt --all --check
|
||||||
|
|
||||||
@@ -50,6 +52,10 @@ jobs:
|
|||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: cargo test --workspace --all-targets
|
run: cargo test --workspace --all-targets
|
||||||
|
|
||||||
|
- name: Stop test PostgreSQL
|
||||||
|
if: always()
|
||||||
|
run: docker rm -f crank-ci-postgres-rust >/dev/null 2>&1 || true
|
||||||
|
|
||||||
ui:
|
ui:
|
||||||
name: UI Checks
|
name: UI Checks
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -78,25 +84,6 @@ jobs:
|
|||||||
frontend-e2e:
|
frontend-e2e:
|
||||||
name: Frontend E2E
|
name: Frontend E2E
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
services:
|
|
||||||
postgres:
|
|
||||||
image: postgres:16-alpine
|
|
||||||
env:
|
|
||||||
POSTGRES_DB: crank
|
|
||||||
POSTGRES_USER: crank
|
|
||||||
POSTGRES_PASSWORD: crank
|
|
||||||
options: >-
|
|
||||||
--health-cmd "pg_isready -U crank -d crank"
|
|
||||||
--health-interval 10s
|
|
||||||
--health-timeout 5s
|
|
||||||
--health-retries 5
|
|
||||||
env:
|
|
||||||
CRANK_E2E_USE_EXTERNAL_POSTGRES: "1"
|
|
||||||
CRANK_E2E_POSTGRES_HOST: postgres
|
|
||||||
CRANK_E2E_POSTGRES_PORT: "5432"
|
|
||||||
CRANK_E2E_POSTGRES_DB: crank
|
|
||||||
CRANK_E2E_POSTGRES_USER: crank
|
|
||||||
CRANK_E2E_POSTGRES_PASSWORD: crank
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
|||||||
Reference in New Issue
Block a user