name: CI
on:
pull_request:
push:
branches: [main]
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: -Dwarnings
RUSTDOCFLAGS: -Dwarnings
jobs:
quality:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- uses: Swatinem/rust-cache@v2
- run: cargo fmt --all -- --check
- run: cargo test --no-default-features
- run: cargo test --no-default-features --features uuid,json,chrono,decimal
- run: cargo test --no-default-features --features postgres
- run: cargo test --all-features
- run: cargo clippy --all-targets --all-features -- -D warnings
- run: cargo doc --all-features --no-deps
msrv:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.85.0
- uses: Swatinem/rust-cache@v2
- run: cargo check --locked --all-features
security:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: taiki-e/install-action@cargo-audit
- run: cargo audit --deny warnings
postgres:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:17-alpine
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: a3s_orm
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U postgres -d a3s_orm"
--health-interval 5s
--health-timeout 5s
--health-retries 10
env:
A3S_ORM_POSTGRES_URL: postgres://postgres:postgres@127.0.0.1:5432/a3s_orm
A3S_ORM_POSTGRES_TLS_URL: postgres://postgres:postgres@127.0.0.1:5433/a3s_orm?sslmode=require
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Start verified-TLS PostgreSQL
run: bash .github/start-postgres-tls.sh
- run: >-
cargo test --no-default-features --features postgres
--test postgres_integration
--test postgres_ha
env:
A3S_ORM_POSTGRES_TLS_CA: ${{ runner.temp }}/a3s-orm-postgres-tls/ca.crt
- name: Stop verified-TLS PostgreSQL
if: always()
run: docker rm -f a3s-orm-postgres-tls || true
coverage:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:17-alpine
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: a3s_orm
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U postgres -d a3s_orm"
--health-interval 5s
--health-timeout 5s
--health-retries 10
env:
A3S_ORM_POSTGRES_URL: postgres://postgres:postgres@127.0.0.1:5432/a3s_orm
A3S_ORM_POSTGRES_TLS_URL: postgres://postgres:postgres@127.0.0.1:5433/a3s_orm?sslmode=require
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- uses: taiki-e/install-action@cargo-llvm-cov
- uses: Swatinem/rust-cache@v2
- name: Start verified-TLS PostgreSQL
run: bash .github/start-postgres-tls.sh
- run: cargo llvm-cov --all-features --all-targets --fail-under-lines 90
env:
A3S_ORM_POSTGRES_TLS_CA: ${{ runner.temp }}/a3s-orm-postgres-tls/ca.crt
- name: Stop verified-TLS PostgreSQL
if: always()
run: docker rm -f a3s-orm-postgres-tls || true