From 7a2cc9498055ce58a4882fdf9f594c42b229c115 Mon Sep 17 00:00:00 2001 From: Zeeshan Lakhani Date: Tue, 9 Jul 2024 04:43:40 +0000 Subject: [PATCH] Add a gh-action and buildomat jobs to cargo check on no-default-features --- .cargo/config.toml | 1 + .github/buildomat/jobs/check-features.sh | 29 ++++++++++++++++++++++++ .github/buildomat/jobs/clippy.sh | 2 +- .github/workflows/rust.yml | 28 ++++++++++++++++++++++- 4 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 .github/buildomat/jobs/check-features.sh diff --git a/.cargo/config.toml b/.cargo/config.toml index c5b6fcd9d41..209d15c760b 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -8,6 +8,7 @@ # CI scripts: # - .github/buildomat/build-and-test.sh # - .github/buildomat/jobs/clippy.sh +# - .github/buildomat/jobs/check-features.sh # - .github/workflows/rust.yml # [build] diff --git a/.github/buildomat/jobs/check-features.sh b/.github/buildomat/jobs/check-features.sh new file mode 100644 index 00000000000..8cd2fff3895 --- /dev/null +++ b/.github/buildomat/jobs/check-features.sh @@ -0,0 +1,29 @@ +#!/bin/bash +#: +#: name = "check-features (helios)" +#: variety = "basic" +#: target = "helios-2.0" +#: rust_toolchain = true +#: output_rules = [] + +# Run cargo check on illumos with feature-specifics like `no-default-features`. + +set -o errexit +set -o pipefail +set -o xtrace + +cargo --version +rustc --version + +# +# Set up our PATH for use with this workspace. +# +source ./env.sh + +banner prerequisites +ptime -m bash ./tools/install_builder_prerequisites.sh -y + +banner check +export CARGO_INCREMENTAL=0 +ptime -m cargo check --workspace --bins --tests --no-default-features +RUSTDOCFLAGS="--document-private-items -D warnings" ptime -m cargo doc --workspace --no-deps --no-default-features diff --git a/.github/buildomat/jobs/clippy.sh b/.github/buildomat/jobs/clippy.sh index 71aa04c907b..4040691b72a 100755 --- a/.github/buildomat/jobs/clippy.sh +++ b/.github/buildomat/jobs/clippy.sh @@ -10,7 +10,7 @@ # (that we want to check) is conditionally-compiled on illumos only. # # Note that `cargo clippy` includes `cargo check, so this ends up checking all -# of our code. +# of our (default) code. set -o errexit set -o pipefail diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 2ef27831083..edf85bdde55 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -53,7 +53,7 @@ jobs: run: cargo run --bin omicron-package -- -t default check # Note that `cargo clippy` includes `cargo check, so this ends up checking all - # of our code. + # of our (default) code. clippy-lint: runs-on: ubuntu-22.04 env: @@ -82,6 +82,32 @@ jobs: - name: Run Clippy Lints run: cargo xtask clippy + check-features: + runs-on: ubuntu-22.04 + env: + CARGO_INCREMENTAL: 0 + steps: + # This repo is unstable and unnecessary: https://github.com/microsoft/linux-package-repositories/issues/34 + - name: Disable packages.microsoft.com repo + run: sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + ref: ${{ github.event.pull_request.head.sha }} # see omicron#4461 + - uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3 + if: ${{ github.ref != 'refs/heads/main' }} + - name: Report cargo version + run: cargo --version + - name: Update PATH + run: source "./env.sh"; echo "PATH=$PATH" >> "$GITHUB_ENV" + - name: Print PATH + run: echo $PATH + - name: Print GITHUB_ENV + run: cat "$GITHUB_ENV" + - name: Install Pre-Requisites + run: ./tools/install_builder_prerequisites.sh -y + - name: Run Cargo Check (No Default Features) + run: cargo check --workspace --bins --tests --no-default-features + # This is just a test build of docs. Publicly available docs are built via # the separate "rustdocs" repo. build-docs: