ci: isolate postgres services
This commit is contained in:
+32
-19
@@ -11,8 +11,20 @@ jobs:
|
|||||||
rust:
|
rust:
|
||||||
name: Rust Checks
|
name: Rust Checks
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
services:
|
||||||
|
crank-rust-postgres:
|
||||||
|
image: postgres:16-alpine
|
||||||
|
env:
|
||||||
|
POSTGRES_DB: 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:
|
env:
|
||||||
TEST_DATABASE_URL: postgres://postgres:postgres@127.0.0.1:55432/crank_test
|
TEST_DATABASE_URL: postgres://postgres:postgres@crank-rust-postgres:5432/crank_test
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@@ -26,20 +38,6 @@ 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
|
||||||
|
|
||||||
@@ -52,10 +50,6 @@ 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
|
||||||
@@ -84,6 +78,25 @@ jobs:
|
|||||||
frontend-e2e:
|
frontend-e2e:
|
||||||
name: Frontend E2E
|
name: Frontend E2E
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
services:
|
||||||
|
crank-e2e-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: crank-e2e-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