Skip to content

Commit

Permalink
Update test workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
rustworthy committed Aug 24, 2024
1 parent 6f5fc43 commit 9e97972
Showing 1 changed file with 86 additions and 22 deletions.
108 changes: 86 additions & 22 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,27 @@ jobs:
required:
runs-on: ubuntu-latest
name: ubuntu / ${{ matrix.toolchain }}
services:
postgres:
build:
context: docker
dockerfile: postgres.Dockerfile
env:
POSTGRES_USER: username
POSTGRES_PASSWORD: password
POSTGRES_HOST: "127.0.0.1"
POSTGRES_DB: "pgboss"
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 127.0.0.1:5444:5432
command:
- "postgres"
- "-c"
- "config_file=/var/lib/postgresql/postgresql.conf"
strategy:
matrix:
# run on stable and beta to ensure that tests won't break on the next version of the rust
Expand All @@ -37,15 +58,9 @@ jobs:
# enable this ci template to run regardless of whether the lockfile is checked in or not
if: hashFiles('Cargo.lock') == ''
run: cargo generate-lockfile
- name: ensure PostgreSQL service
run: |
docker compose -f docker/compose.yaml up -d --build
docker ps
sleep 10
docker compose -f docker/compose.yaml logs postgres --tail 10
- name: run e2e tests
env:
POSTGRES_URL: postgres://username:[email protected]:5444/pgboss
POSTGRES_URL: postgres://username:[email protected]:5444/pgboss
run: cargo test --locked --all-features --all-targets --test e2e -- --nocapture
# https://github.com/rust-lang/cargo/issues/6669
- name: cargo test --doc
Expand Down Expand Up @@ -75,6 +90,27 @@ jobs:
# This action is run on ubuntu with the stable toolchain, as it is not expected to fail
runs-on: ubuntu-latest
name: ubuntu / stable / minimal-versions
services:
postgres:
build:
context: docker
dockerfile: postgres.Dockerfile
env:
POSTGRES_USER: username
POSTGRES_PASSWORD: password
POSTGRES_HOST: "127.0.0.1"
POSTGRES_DB: "pgboss"
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 127.0.0.1:5444:5432
command:
- "postgres"
- "-c"
- "config_file=/var/lib/postgresql/postgresql.conf"
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -87,20 +123,34 @@ jobs:
run: rustup default stable
- name: cargo update -Zminimal-versions
run: cargo +nightly update -Zminimal-versions
- name: ensure PostgreSQL service
run: |
docker compose -f docker/compose.yaml up -d --build
docker ps
sleep 10
docker compose -f docker/compose.yaml logs postgres --tail 10
- name: run e2e tests
env:
POSTGRES_URL: postgres://username:[email protected]:5444/pgboss
POSTGRES_URL: postgres://username:[email protected]:5444/pgboss
run: cargo test --locked --all-features --all-targets --test e2e -- --nocapture
os-check:
# run cargo test on mac and windows
runs-on: ${{ matrix.os }}
name: ${{ matrix.os }} / stable
postgres:
build:
context: docker
dockerfile: postgres.Dockerfile
env:
POSTGRES_USER: username
POSTGRES_PASSWORD: password
POSTGRES_HOST: "127.0.0.1"
POSTGRES_DB: "pgboss"
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 127.0.0.1:5444:5432
command:
- "postgres"
- "-c"
- "config_file=/var/lib/postgresql/postgresql.conf"
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -128,7 +178,7 @@ jobs:
docker compose -f docker/compose.yaml logs postgres --tail 10
- name: run e2e tests
env:
POSTGRES_URL: postgres://username:[email protected]:5444/pgboss
POSTGRES_URL: postgres://username:[email protected]:5444/pgboss
run: cargo test --locked --all-features --all-targets --test e2e -- --nocapture
coverage:
# use llvm-cov to build and collect coverage and outputs in a format that
Expand All @@ -154,6 +204,26 @@ jobs:
# for lots of more discussion
runs-on: ubuntu-latest
name: ubuntu / stable / coverage
postgres:
build:
context: docker
dockerfile: postgres.Dockerfile
env:
POSTGRES_USER: username
POSTGRES_PASSWORD: password
POSTGRES_HOST: "127.0.0.1"
POSTGRES_DB: "pgboss"
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 127.0.0.1:5444:5432
command:
- "postgres"
- "-c"
- "config_file=/var/lib/postgresql/postgresql.conf"
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -167,15 +237,9 @@ jobs:
- name: cargo generate-lockfile
if: hashFiles('Cargo.lock') == ''
run: cargo generate-lockfile
- name: ensure PostgreSQL service
run: |
docker compose -f docker/compose.yaml up -d --build
docker ps
sleep 10
docker compose -f docker/compose.yaml logs postgres --tail 10
- name: cargo llvm-cov
env:
POSTGRES_URL: postgres://username:[email protected]:5444/pgboss
POSTGRES_URL: postgres://username:[email protected]:5444/pgboss
run: cargo llvm-cov --locked --all-features --lcov --output-path lcov.info
- name: Record Rust version
run: echo "RUST=$(rustc --version)" >> "$GITHUB_ENV"
Expand Down

0 comments on commit 9e97972

Please sign in to comment.