CI: Run benchmarks separately to tests (#664) #745
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
merge_group: | |
types: [checks_requested] | |
jobs: | |
build-and-test: | |
name: CI | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
version: [stable, beta] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set toolchain | |
run: | | |
rustup set profile minimal | |
rustup override set ${{ matrix.version }} | |
- name: Init submodules | |
run: git submodule update --init | |
- name: Cargo build | |
run: cargo build --all | |
- name: Cargo test | |
run: cargo test --all | |
- name: Test tendril w/encoding feature | |
run: cargo test -p tendril --features 'encoding encoding_rs' | |
doc: | |
name: Cargo doc | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set toolchain | |
run: | | |
rustup set profile minimal | |
rustup override set nightly | |
- run: cargo doc | |
env: | |
RUSTFLAGS: --cfg bench | |
bench-html5ever: | |
name: Bench html5ever | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- run: cargo bench -p html5ever | |
env: | |
RUSTFLAGS: --cfg bench | |
bench-tendril: | |
name: Bench tendril | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- run: cargo bench -p tendril --bench tendril -- --quick --significance-level 0.01 | |
env: | |
RUSTFLAGS: --cfg bench | |
- run: cargo bench -p tendril --bench futf -- --quick --significance-level 0.01 | |
env: | |
RUSTFLAGS: --cfg bench | |
msrv: | |
name: MSRV | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install stable toolchain | |
run: | | |
rustup set profile minimal | |
rustup override set 1.70.0 | |
- run: cargo check --lib --all-features | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install stable toolchain | |
run: | | |
rustup set profile minimal | |
rustup override set stable | |
- name: Install clippy | |
run: | | |
rustup component add clippy | |
rustup component add rustfmt | |
- name: Format | |
run: cargo fmt --all -- --check | |
- name: Run clippy | |
uses: servo/actions/cargo-annotation@main | |
with: | |
cargo-command: clippy --all-features --all-targets | |
build_result: | |
name: Result | |
runs-on: ubuntu-latest | |
needs: | |
- build-and-test | |
- doc | |
- lint | |
- msrv | |
- bench-html5ever | |
- bench-tendril | |
steps: | |
- name: Success | |
if: ${{ !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') }} | |
run: exit 0 | |
- name: Failure | |
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') | |
run: exit 1 | |