Start trying to improve runtime #81
This file contains 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: Continuous Integration | |
on: | |
push: | |
branches: | |
- main | |
env: | |
CARGO_TERM_COLOR: always | |
NEXTEST_PROFILE: ci | |
jobs: | |
lint: | |
name: Lint | |
strategy: | |
matrix: | |
channel: [stable, beta, nightly] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install ${{ matrix.channel }} toolchain | |
run: rustup install ${{ matrix.channel }} | |
- name: Set ${{ matrix.channel }} toolchain as default | |
run: rustup default ${{ matrix.channel }} | |
- name: Install `clippy`, `rustfmt` | |
run: rustup component add clippy rustfmt | |
- name: Populate Rust cache | |
uses: Swatinem/rust-cache@v2 | |
with: | |
cache-all-crates: "true" | |
- name: Run `clippy` | |
run: cargo clippy | |
- name: Check formatting | |
run: cargo fmt --check | |
test-integration: | |
needs: lint | |
name: Test (Integration) | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
channel: [stable, beta, nightly] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install ${{ matrix.channel }} toolchain | |
run: rustup install ${{ matrix.channel }} | |
- name: Set ${{ matrix.channel }} toolchain as default | |
run: rustup default ${{ matrix.channel }} | |
- name: Populate Rust cache | |
uses: Swatinem/rust-cache@v2 | |
with: | |
cache-all-crates: "true" | |
- name: Install `cargo-binstall` | |
uses: cargo-bins/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install `cargo-nextest`, `rage`, `just` | |
run: cargo binstall cargo-nextest rage just --secure --no-confirm --force | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Run integration tests | |
run: just test --test=integration | |
env: | |
AOC_INPUTS_SECRET: ${{ secrets.AOC_INPUTS_SECRET }} | |
test-bench: | |
name: Test (Benchmarks) | |
needs: lint | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install stable toolchain | |
run: rustup install stable | |
- name: Set stable toolchain as default | |
run: rustup default stable | |
- name: Populate Rust cache | |
uses: Swatinem/rust-cache@v2 | |
with: | |
cache-all-crates: "true" | |
- name: Install `cargo-binstall` | |
uses: cargo-bins/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install `cargo-nextest`, `rage`, `just` | |
run: cargo binstall cargo-nextest rage just --secure --no-confirm --force | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Run tests | |
run: just test --bench=bench | |
env: | |
AOC_INPUTS_SECRET: ${{ secrets.AOC_INPUTS_SECRET }} | |
bench: | |
name: Bench | |
needs: | |
- test-bench | |
- test-integration | |
env: | |
CRITERION_OUTPUT_FILE: benchmarks.json | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install stable toolchain | |
run: rustup install stable | |
- name: Set stable toolchain as default | |
run: rustup default stable | |
- name: Populate Rust cache | |
uses: Swatinem/rust-cache@v2 | |
with: | |
cache-all-crates: "true" | |
- name: Install `cargo-binstall` | |
uses: cargo-bins/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install `cargo-nextest`, `rage`, `just`, `cargo-criterion` | |
run: cargo binstall cargo-nextest rage just cargo-criterion --secure --no-confirm --force | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Run benchmarks | |
run: just bench --message-format=json --color=always > ${{ env.CRITERION_OUTPUT_FILE }} | |
env: | |
AOC_INPUTS_SECRET: ${{ secrets.AOC_INPUTS_SECRET }} | |
- name: Upload benchmarks | |
uses: actions/[email protected] | |
with: | |
name: benchmark-results-${{ github.sha }} | |
path: ${{ env.CRITERION_OUTPUT_FILE }} | |
if-no-files-found: error |