Build and Check #1909
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
# spell-checker:ignore taiki rustfmt binstall clippy taplo rustup nocapture | |
# spell-checker:ignore nofile gnuabi armv gnueabi mipsel vmactions usesh proto | |
# spell-checker:ignore tlsv connrefused copyback | |
name: Build and Check | |
on: | |
push: | |
branches: ["main", "cicd", "release", "develop", "[0-9]+-*"] | |
pull_request: | |
branches: ["main"] | |
schedule: | |
- cron: "00 01 * * *" | |
env: | |
CARGO_TERM_COLOR: always | |
RUST_BACKTRACE: "1" | |
concurrency: | |
group: ${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
deny: | |
name: Check dependencies/ubuntu-latest | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@1.67.1 | |
- uses: taiki-e/install-action@cargo-deny | |
- uses: taiki-e/install-action@just | |
- name: Check advisories | |
run: just args='--deny warnings' deny advisories | |
- name: Check bans licenses sources | |
run: just deny bans licenses sources | |
minimal_versions: | |
name: Check minimal version requirements of dependencies | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
toolchain: | |
- stable | |
- nightly | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@master | |
if: ${{ startsWith(matrix.toolchain, 'nightly') }} | |
with: | |
toolchain: ${{ matrix.toolchain }} | |
- uses: dtolnay/rust-toolchain@master | |
if: ${{ ! startsWith(matrix.toolchain, 'nightly') }} | |
with: | |
toolchain: nightly | |
- uses: dtolnay/rust-toolchain@master | |
if: ${{ ! startsWith(matrix.toolchain, 'nightly') }} | |
with: | |
toolchain: ${{ matrix.toolchain }} | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
key: ubuntu-latest_${{ matrix.toolchain }} | |
- uses: taiki-e/install-action@cargo-hack | |
- uses: taiki-e/install-action@cargo-minimal-versions | |
- uses: taiki-e/install-action@just | |
- name: Check build with minimal versions | |
run: just minimal-versions | |
format: | |
name: Check format and spelling | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@nightly | |
with: | |
components: rustfmt | |
- uses: taiki-e/install-action@cargo-binstall | |
- uses: taiki-e/install-action@just | |
- run: cargo binstall --no-confirm --no-symlinks taplo-cli | |
- run: just check-fmt-all | |
base: | |
needs: [format] | |
name: Build, check and test | |
strategy: | |
fail-fast: false | |
matrix: | |
toolchain: | |
- "1.67.1" # MSRV | |
- stable | |
- nightly | |
include: | |
- toolchain: "1.67.1" # MSRV | |
ui_tests: --features ui_tests | |
components: rust-src | |
- toolchain: stable | |
components: clippy | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.toolchain }} | |
components: ${{ matrix.components }} | |
- name: "Prepare: Install stable toolchain with clippy" | |
if: matrix.toolchain != 'stable' | |
run: | | |
rustup toolchain install stable --no-self-update --component clippy | |
- name: "Prepare: Run cargo update" | |
if: matrix.toolchain == 'stable' || matrix.toolchain == 'nightly' | |
run: | | |
cargo update | |
- uses: taiki-e/install-action@cargo-hack | |
- uses: taiki-e/install-action@just | |
- name: Install valgrind | |
run: sudo apt-get -y update && sudo apt-get -y install valgrind | |
- name: Info | |
run: | | |
set -x | |
uname -a | |
pwd | |
rustup --version | |
rustup show | |
rustup component list --installed | |
valgrind --version | |
- name: Build with the feature powerset | |
run: just build-hack | |
# Fix github ci error: /usr/bin/ld: final link failed: No space left on device | |
- name: Cleanup build artifacts | |
run: cargo clean | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
key: ${{ matrix.toolchain }} | |
- name: Build the tests with the feature powerset | |
run: just build-tests-hack | |
- name: Lint | |
run: just lint | |
- name: Test | |
run: | | |
set -o pipefail | |
cargo test --workspace --exclude client-request-tests ${{ matrix.ui_tests }} |& tee test.output | |
- name: Check test output for ui errors | |
if: ${{ matrix.ui_tests && failure() }} | |
run: | | |
if grep -q '^test ui \.\.\. FAILED$' test.output; then | |
TRYBUILD=overwrite cargo test ${{ matrix.ui_tests }} ui | |
git diff iai-callgrind/tests/ui | |
fi | |
exit 1 | |
- name: Check summary.json schema is up-to-date | |
run: just schema-gen-diff | |
- name: Bench | |
run: just full-bench-test-all | |
env: | |
# IAI_CALLGRIND_LOG: trace | |
RUST_BACKTRACE: "0" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: iai-callgrind-benchmarks-${{ matrix.toolchain }} | |
path: "target/iai" | |
client_requests: | |
needs: [format] | |
name: Test client requests | |
strategy: | |
fail-fast: false | |
matrix: | |
job: | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
- os: ubuntu-latest | |
target: i686-unknown-linux-gnu | |
- os: ubuntu-latest | |
target: s390x-unknown-linux-gnu | |
- os: ubuntu-latest | |
target: aarch64-unknown-linux-gnu | |
- os: ubuntu-latest | |
target: armv7-unknown-linux-gnueabihf | |
# FIX: Temporarily switch off these targets | |
# - os: ubuntu-latest | |
# target: powerpc-unknown-linux-gnu | |
# - os: ubuntu-latest | |
# target: powerpc64-unknown-linux-gnu | |
- os: ubuntu-latest | |
target: powerpc64le-unknown-linux-gnu | |
runs-on: ${{ matrix.job.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: taiki-e/install-action@cross | |
- uses: taiki-e/install-action@just | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
key: cross_${{ matrix.job.os }}_${{ matrix.job.target }} | |
- name: Info | |
run: | | |
set -x | |
uname -a | |
pwd | |
rustup --version | |
rustup show | |
rustup component list --installed | |
- name: Test client requests | |
run: just reqs-test ${{ matrix.job.target }} | |
env: | |
RUSTUP_TOOLCHAIN: "stable" | |
# CROSS_DEBUG: "1" | |
freebsd: | |
name: Build, check and test/FreeBSD | |
needs: [format] | |
runs-on: ubuntu-latest | |
env: | |
IAI_CALLGRIND_VALGRIND_INCLUDE: "/usr/local/include" | |
IAI_CALLGRIND_VALGRIND_PATH: "/usr/local/bin" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup and run tests | |
id: test | |
uses: vmactions/freebsd-vm@v1 | |
with: | |
envs: "IAI_CALLGRIND_VALGRIND_INCLUDE IAI_CALLGRIND_VALGRIND_PATH" | |
usesh: true | |
sync: rsync | |
copyback: false | |
prepare: | | |
pkg install -y valgrind curl llvm18 just npm-node22 | |
curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL "https://sh.rustup.rs" | sh -s -- --default-toolchain stable --profile minimal -y | |
run: | | |
./scripts/freebsd_print_info.sh | |
./scripts/freebsd_build_and_test.sh | |
docs: | |
needs: [base, client_requests] | |
name: Docs/ubuntu-latest | |
runs-on: ubuntu-latest | |
env: | |
DOCS_RS: "1" | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@nightly | |
- uses: Swatinem/rust-cache@v2 | |
- name: Build iai-callgrind without valgrind headers | |
run: cargo build --package iai-callgrind --features client_requests_defs --release | |
- name: Run doc tests | |
run: cargo test --all-features --doc | |
- name: Check Documentation | |
run: cargo doc --all-features --no-deps --document-private-items |