name: Test
permissions:
contents: read
on:
push:
branches:
- main
pull_request:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
test:
name: test (PostgreSQL ${{ matrix.postgres }})
strategy:
fail-fast: false
max-parallel: 2
matrix:
postgres: [14, 15, 16, 17, 18]
timeout-minutes: 20
runs-on: ubuntu-24.04-arm
env:
CARGO_INCREMENTAL: 0
DATABASE_URL: postgres://testuser:testpassword@localhost:5432/testdb
services:
postgres:
image: postgres:${{ matrix.postgres }}
env:
POSTGRES_USER: testuser
POSTGRES_PASSWORD: testpassword
POSTGRES_DB: testdb
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- uses: taiki-e/install-action@nextest
- uses: Swatinem/rust-cache@v2
- name: Test
run: cargo nextest run --all
- name: Doc tests
run: cargo test --all --doc
tokio-postgres-tls:
name: tokio-postgres TLS (${{ matrix.protocol }})
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
protocol: [TLSv1.2, TLSv1.3]
env:
TLS_MAX_PROTOCOL_VERSION: ${{ matrix.protocol }}
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
persist-credentials: false
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@6bed0761d98439e5a578e2877258200ad565ba87 - uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 - name: Check TLS dependency isolation
run: node .github/scripts/check_tls_features.mjs
- name: Test TLS-only PostgreSQL
run: bash .github/scripts/test_tokio_postgres_tls.sh