name: CI
on:
push:
pull_request:
jobs:
test:
runs-on: ubuntu-latest
services:
mssql:
image: mcr.microsoft.com/mssql/server:2022-latest
env:
SA_PASSWORD: "YourStrong!Passw0rd"
ACCEPT_EULA: "Y"
ports:
- 1433:1433
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 with:
fetch-depth: 0 - uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 with:
toolchain: stable
components: llvm-tools-preview, clippy, rustfmt
- name: Check formatting
run: cargo fmt --all --check
- name: Clippy
run: cargo clippy --all-targets -- -D warnings
- name: Wait for MSSQL
run: |
for i in {1..30}; do
nc -z localhost 1433 && echo "MSSQL is up" && break
echo "Waiting for MSSQL..."
sleep 10
done
- name: Run tests
run: |
cargo test
cargo test -- --ignored
- name: Install cargo-llvm-cov
run: cargo install cargo-llvm-cov --locked
- name: Prepare coverage directory
run: mkdir -p coverage
- name: Generate coverage report (Cobertura)
run: cargo llvm-cov --all-features --workspace --cobertura --output-path coverage/cobertura.xml
- name: SonarQube Scan
uses: SonarSource/sonarqube-scan-action@fd88b7d7ccbaefd23d8f36f73b59db7a3d246602 env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}