Skip to content

Commit

Permalink
Update workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
rustworthy committed Aug 24, 2024
1 parent 3ccd429 commit 46cadab
Show file tree
Hide file tree
Showing 8 changed files with 113 additions and 131 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
name: check
env:
PUBLISHED_TO_CRATESIO: false
jobs:
fmt:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -57,20 +59,23 @@ jobs:
- name: cargo clippy
uses: giraffate/clippy-action@v1
with:
reporter: 'github-pr-check'
reporter: "github-pr-check"
github_token: ${{ secrets.GITHUB_TOKEN }}
semver:
runs-on: ubuntu-latest
name: semver
steps:
- uses: actions/checkout@v4
if: ${{ env.PUBLISHED_TO_CRATESIO == 'true' }}
with:
submodules: true
- name: Install stable
if: ${{ env.PUBLISHED_TO_CRATESIO == 'true' }}
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: cargo-semver-checks
if: ${{ env.PUBLISHED_TO_CRATESIO == 'true' }}
uses: obi1kenobi/cargo-semver-checks-action@v2
doc:
# run docs generation on nightly rather than stable. This enables features like
Expand Down Expand Up @@ -112,7 +117,10 @@ jobs:
# https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability
strategy:
matrix:
msrv: ["1.56.1"] # 2021 edition requires 1.56
# SQLx is being tested against the latest rustc ("1.80.1" as of August 24, 2024),
# so when updating this dependency there is always a chance we will need to bump MSRV.
# As of August 24, 2024, our crate will build with rustc 1.74
msrv: ["1.74.0"]
name: ubuntu / ${{ matrix.msrv }}
steps:
- uses: actions/checkout@v4
Expand Down
30 changes: 0 additions & 30 deletions .github/workflows/nostd.yml

This file was deleted.

84 changes: 0 additions & 84 deletions .github/workflows/safety.yml

This file was deleted.

26 changes: 21 additions & 5 deletions .github/workflows/scheduled.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
branches: [main]
pull_request:
schedule:
- cron: '7 7 * * *'
- cron: "7 7 * * *"
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
Expand All @@ -27,8 +27,16 @@ jobs:
- name: cargo generate-lockfile
if: hashFiles('Cargo.lock') == ''
run: cargo generate-lockfile
- name: cargo test --locked
run: cargo test --locked --all-features --all-targets
- 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
run: cargo test --locked --all-features --all-targets --test e2e -- --nocapture
# https://twitter.com/alcuadrado/status/1571291687837732873
update:
# This action checks that updating the dependencies of this crate to the latest available that
Expand All @@ -51,8 +59,16 @@ jobs:
- name: cargo update
if: hashFiles('Cargo.lock') != ''
run: cargo update
- name: cargo test
- name: ensure PostgreSQL service
if: hashFiles('Cargo.lock') != ''
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
if: hashFiles('Cargo.lock') != ''
run: cargo test --locked --all-features --all-targets
env:
POSTGRES_URL: postgres://username:[email protected]:5444/pgboss
RUSTFLAGS: -D deprecated
run: cargo test --locked --all-features --all-targets --test e2e -- --nocapture
79 changes: 71 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,21 @@ jobs:
required:
runs-on: ubuntu-latest
name: ubuntu / ${{ matrix.toolchain }}
services:
postgres:
image: postgres:16.4
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
strategy:
matrix:
# run on stable and beta to ensure that tests won't break on the next version of the rust
Expand All @@ -37,9 +52,10 @@ 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
# https://twitter.com/jonhoo/status/1571290371124260865
- name: cargo test --locked
run: cargo test --locked --all-features --all-targets
- name: run e2e tests
env:
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
run: cargo test --locked --all-features --doc
Expand Down Expand Up @@ -68,6 +84,21 @@ 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:
image: postgres:16.4
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
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -80,12 +111,32 @@ jobs:
run: rustup default stable
- name: cargo update -Zminimal-versions
run: cargo +nightly update -Zminimal-versions
- name: cargo test
run: cargo test --locked --all-features --all-targets
- name: run e2e tests
env:
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
# Container actions are only supported on Linux runners as of August 24, 2024
# So we are only building the library, not running e2e tests.
#
#services:
# postgres:
# image: postgres:16.4
# 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
strategy:
fail-fast: false
matrix:
Expand All @@ -105,8 +156,12 @@ jobs:
- name: cargo generate-lockfile
if: hashFiles('Cargo.lock') == ''
run: cargo generate-lockfile
- name: cargo test
run: cargo test --locked --all-features --all-targets
- name: cargo build --release
run: cargo build --all-features --all-targets
#- name: run e2e tests
# env:
# 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
# is compatible with codecov.io
Expand Down Expand Up @@ -144,8 +199,16 @@ jobs:
- name: cargo generate-lockfile
if: hashFiles('Cargo.lock') == ''
run: cargo generate-lockfile
- name: ensure PostgeSQL 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
run: cargo llvm-cov --locked --all-features --lcov --output-path lcov.info
env:
POSTGRES_URL: postgres://username:[email protected]:5444/pgboss
run: cargo llvm-cov --locked --all-features --test e2e --lcov --output-path lcov.info -- include-ignored
- name: Record Rust version
run: echo "RUST=$(rustc --version)" >> "$GITHUB_ENV"
- name: Upload to codecov.io
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/target
/misc
/misc
lcov.info
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,12 @@ test/doc:
.PHONY: test/e2e
test/e2e:
POSTGRES_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DATABASE} \
cargo test --locked --all-features --all-targets --test e2e -- --nocapture
cargo test --locked --all-features --all-targets --test e2e -- --nocapture --include-ignored

.PHONY: test/cov
test/cov:
POSTGRES_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DATABASE} \
cargo llvm-cov --locked --all-features --lcov --test e2e --output-path lcov.info -- --include-ignored

.PHONY: test
test: test/e2e
3 changes: 3 additions & 0 deletions tests/e2e/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ async fn simple_connect() {
let _c = Client::connect().await.unwrap();
}

// On CI - when running on Ubuntu with our postgres service with TLS enabled - use '--include-ignored'
// to run this test, just like we do with `make test` and `make test/cov`
#[ignore = "this test requires a dedicated test run aganst PostgreSQL server with TLS enabled"]
#[tokio::test]
async fn bring_your_own_pool() {
let local = "bring_your_own_pool";
Expand Down

0 comments on commit 46cadab

Please sign in to comment.