name: CI
on:
push:
pull_request:
env:
CARGO_TERM_COLOR: always
jobs:
check:
name: Lint and build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 - uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 with:
toolchain: stable
components: clippy, rustfmt
- uses: Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 - name: Check formatting
run: cargo fmt --all --check
- name: Clippy
run: cargo clippy --all-targets -- -D warnings
- name: Build
run: cargo build --all-targets
- name: Build documentation
run: cargo doc --no-deps
msrv:
name: Minimum supported Rust version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 - uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 with:
toolchain: "1.88"
- uses: Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 - name: Build on MSRV
run: cargo build
test:
name: Test
runs-on: ubuntu-latest
services:
mssql:
image: mcr.microsoft.com/mssql/server:2022-latest
env:
MSSQL_SA_PASSWORD: "YourStrong!Passw0rd"
SA_PASSWORD: "YourStrong!Passw0rd"
ACCEPT_EULA: "Y"
ports:
- 1433:1433
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 - uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 with:
toolchain: stable
- uses: Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 - name: Wait for SQL Server
run: |
for i in $(seq 1 30); do
if nc -z localhost 1433; then
echo "SQL Server is accepting connections"
exit 0
fi
echo "Waiting for SQL Server... ($i/30)"
sleep 5
done
echo "SQL Server did not come up in time"
exit 1
- name: Run tests
run: cargo test --all-targets -- --include-ignored
- name: Run doc tests
run: cargo test --doc
package:
name: Verify package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 - uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 with:
toolchain: stable
- uses: Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 - name: Package
run: cargo publish --dry-run