Skip to content

Bench tuning

Bench tuning #188

Workflow file for this run

name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
merge_group:
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: "1"
GHC_VERSIONS: "9.6"
LANG: en_US.UTF-8
LC_ALL: en_US.UTF-8
jobs:
fmt:
name: Format
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- run: cargo fmt --all -- --check
clippy:
name: Clippy
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, macos-latest]
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
- run: cargo clippy --all-targets --all-features -- -D warnings
check:
name: Check
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, macos-latest]
rust: [stable, beta]
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- uses: Swatinem/rust-cache@v2
- run: cargo check --all-features
- run: cargo check --no-default-features
test:
name: Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, macos-latest]
fail-fast: false
env:
TERM: xterm-256color
XDG_CONFIG_HOME: ${{ github.workspace }}/.config
XDG_CACHE_HOME: ${{ github.workspace }}/.cache
XDG_STATE_HOME: ${{ github.workspace }}/.state
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Install nextest
uses: taiki-e/install-action@nextest
- name: Setup Haskell
uses: haskell-actions/setup@v2
with:
ghc-version: ${{ env.GHC_VERSIONS }}
enable-stack: false
cabal-version: latest
- name: Ensure hpack is installed (for ghciwatch tests)
shell: bash
run: |
set -euxo pipefail
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
echo "$HOME/.cabal/bin" >> "$GITHUB_PATH"
cabal update
cabal install hpack --installdir="$HOME/.local/bin" --overwrite-policy=always
hpack --version
- name: Prepare test environment
shell: bash
run: |
set -euxo pipefail
mkdir -p "$XDG_CONFIG_HOME/ghc" "$XDG_CACHE_HOME" "$XDG_STATE_HOME"
: > "$XDG_CONFIG_HOME/ghc/ghci.conf"
ghci --version
ghc --version
- name: Run unit tests (libs + bins)
run: |
cargo nextest run --lib --bins \
--no-fail-fast \
--failure-output=immediate-final
- name: Run integration tests
run: |
cargo nextest run --tests \
--no-fail-fast \
--failure-output=immediate-final
- name: Archive nextest results
if: always()
run: |
cargo nextest archive --archive-file target/nextest/nextest-archive.tar.zst || true
- name: Upload nextest archive
if: always()
uses: actions/upload-artifact@v4
with:
name: nextest-archive-${{ matrix.os }}
path: target/nextest/nextest-archive.tar.zst
if-no-files-found: ignore
doc:
name: Documentation
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo doc --all-features --no-deps --document-private-items
env:
RUSTDOCFLAGS: -D warnings
audit:
name: Security Audit
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: rustsec/audit-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
msrv:
name: MSRV Check
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Read MSRV from Cargo.toml
id: msrv
shell: bash
run: |
set -euo pipefail
if grep -qE '^\s*rust-version\s*=\s*".*"' Cargo.toml; then
msrv=$(sed -nE 's/^\s*rust-version\s*=\s*"(.*)".*/\1/p' Cargo.toml | head -n1)
elif grep -qE '^\s*rust-version\s*=\s*[0-9]+\.[0-9]+(\.[0-9]+)?' Cargo.toml; then
msrv=$(sed -nE 's/^\s*rust-version\s*=\s*([0-9]+\.[0-9]+(\.[0-9]+)?).*/\1/p' Cargo.toml | head -n1)
else
echo "No MSRV found, using 1.82.0 (required by dependencies)"
msrv="1.82.0"
fi
echo "msrv=$msrv" >> "$GITHUB_OUTPUT"
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ steps.msrv.outputs.msrv }}
- uses: Swatinem/rust-cache@v2
- run: cargo check --all-features
coverage:
name: Code Coverage
runs-on: ubuntu-22.04
if: github.ref == 'refs/heads/main'
env:
TERM: xterm-256color
XDG_CONFIG_HOME: ${{ github.workspace }}/.config
XDG_CACHE_HOME: ${{ github.workspace }}/.cache
XDG_STATE_HOME: ${{ github.workspace }}/.state
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Setup Haskell for integration tests
uses: haskell-actions/setup@v2
with:
ghc-version: ${{ env.GHC_VERSIONS }}
enable-stack: false
cabal-version: latest
- name: Ensure hpack is installed for coverage
shell: bash
run: |
set -euxo pipefail
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
echo "$HOME/.cabal/bin" >> "$GITHUB_PATH"
cabal update
cabal install hpack --installdir="$HOME/.local/bin" --overwrite-policy=always
hpack --version
- name: Prepare environment for coverage
run: |
mkdir -p "$XDG_CONFIG_HOME/ghc" "$XDG_CACHE_HOME" "$XDG_STATE_HOME"
: > "$XDG_CONFIG_HOME/ghc/ghci.conf"
- name: Generate coverage
run: cargo llvm-cov nextest --all-features --lcov --output-path lcov.info --no-fail-fast
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: lcov.info
fail_ci_if_error: false