name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
CARGO_TERM_COLOR: always
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
RUST_BACKTRACE: 1
jobs:
check:
name: Check & Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Cache cargo registry & build
uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build (without PDF)
run: cargo build --no-default-features
- name: Run clippy
run: cargo clippy --no-default-features -- -D warnings
- name: Run tests
run: cargo test --no-default-features -- --nocapture --test-threads=1
check-all-features:
name: Check & Test (all features)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Cache cargo registry & build
uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-all-features-${{ hashFiles('**/Cargo.lock') }}
- name: Build (all features)
run: cargo build --all-features
- name: Run clippy (all features)
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Run tests (all features)
run: cargo test --all-features -- --nocapture --test-threads=1
format:
name: Formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Check formatting
run: cargo fmt -- --check
browser-smoke:
name: Browser Smoke
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install Chrome
id: setup-chrome
uses: browser-actions/setup-chrome@v2
- name: Run browser smoke test
env:
AUDITMYSITE_BROWSER: ${{ steps.setup-chrome.outputs.chrome-path }}
run: cargo test --test integration_test test_perfect_page_scores_high -- --ignored --exact --nocapture
release-build:
name: Release Build
needs: [check, check-all-features, format, browser-smoke]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
target: aarch64-apple-darwin
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: windows-latest
target: x86_64-pc-windows-msvc
steps:
- uses: actions/checkout@v5
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Build release binary
run: cargo build --release --no-default-features --target ${{ matrix.target }}