Remove unneeded dependency #1942
Workflow file for this run
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: CI | |
on: | |
pull_request: | |
push: | |
branches: | |
- master | |
# smoelius: Every Thursday at 3:00 UTC (Wednesday at 22:00 EST), run `cargo test -- --ignored`. | |
schedule: | |
- cron: "0 3 * * 4" | |
workflow_dispatch: | |
concurrency: | |
group: ci-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Dylint versions | |
run: cargo search dylint | sort | tee dylint_versions | |
# smoelius: The `~/.cargo/` entries are from: | |
# * https://github.com/actions/cache/blob/main/examples.md#rust---cargo. | |
# * https://doc.rust-lang.org/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci | |
# The rest were added by me. | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
~/.dylint_drivers/ | |
~/.rustup/toolchains/ | |
target/dylint/ | |
key: ${{ runner.os }}-dylint-${{ hashFiles('dylint_versions') }} | |
- name: Rustup | |
run: rustup update | |
- name: Install llvm | |
run: sudo apt-get install llvm | |
- name: Actionlint | |
run: go install github.com/rhysd/actionlint/cmd/actionlint@latest && "$HOME"/go/bin/actionlint --shellcheck='-e SC2016' | |
- name: Shellcheck | |
run: shellcheck --exclude=SC2002 scripts/* | |
- name: Prettier | |
run: npm install -g prettier && prettier --check '**/*.json' '**/*.md' '**/*.yml' | |
# smoelius: Pin `markdown-link-check` to version 3.11 until the following issue is resolved: | |
# https://github.com/tcort/markdown-link-check/issues/304 | |
- name: Markdown link check | |
run: npm install -g markdown-link-check@3.11 && markdown-link-check ./**/*.md | |
# https://github.com/DevinR528/cargo-sort/issues/57#issuecomment-1457714872 | |
- name: Cargo sort | |
run: | | |
cargo install cargo-sort || true | |
find . -name Cargo.toml -print0 | xargs -0 -n 1 dirname | xargs -n 1 cargo sort --check --grouped --no-format | |
- name: Format | |
run: | | |
rustup +nightly component add rustfmt | |
cargo +nightly fmt && git diff --exit-code | |
- name: License | |
run: | | |
cargo install cargo-license || true | |
./scripts/check_licenses.sh | |
- name: Clippy | |
run: | | |
rustup +nightly component add clippy | |
cargo +nightly clippy --all-targets | |
- name: Dylint | |
run: | | |
cargo install cargo-dylint --git=https://github.com/trailofbits/dylint --no-default-features --features=cargo-cli || true | |
cargo install dylint-link || true | |
./scripts/dylint.sh | |
- name: Udeps | |
run: | | |
cargo install cargo-udeps || true | |
cargo clean && cargo +nightly udeps --all-targets | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
serde_format: [bincode, postcard] | |
toolchain: [stable, nightly] | |
self_ty_in_mod_name: [false, true] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
# smoelius: The Substrate tests require the `rust-src` component and the wasm32 target. | |
- name: Set toolchain | |
run: | | |
rustup default ${{ matrix.toolchain }} | |
rustup component add rust-src | |
rustup target add wasm32-unknown-unknown | |
# smoelius: The Substrate tests require `protoc`. | |
- name: Install protoc | |
run: sudo apt-get install protobuf-compiler | |
- name: Install cargo-afl | |
run: | | |
cargo install cargo-afl | |
# smoelius: If using a nightly toolchain, use LLVM plugins. | |
if [[ ${{ matrix.toolchain }} = nightly ]]; then | |
wget https://apt.llvm.org/llvm.sh | |
chmod +x llvm.sh | |
sudo ./llvm.sh | |
cargo afl config --build --force --plugins | |
fi | |
- name: Run afl-system-config | |
run: cargo afl system-config | |
# smoelius: I expect this list to grow. | |
- name: Install tools | |
run: | | |
cargo install cargo-supply-chain || true | |
cargo install cargo-unmaintained || true | |
cargo install group-runner || true | |
- name: Free up space | |
run: | | |
# https://github.com/actions/runner-images/issues/2606#issuecomment-772683150 | |
sudo rm -rf /usr/local/lib/android | |
sudo rm -rf /usr/share/dotnet | |
sudo rm -rf /usr/share/swift | |
# du -sh /usr/*/* 2>/dev/null | sort -h || true | |
- name: Setup | |
run: | | |
SERDE_FORMAT='--features=test-fuzz/serde_${{ matrix.serde_format }}' | |
SHUFFLE= | |
if [[ ${{ matrix.toolchain }} = nightly ]]; then | |
SHUFFLE='-Z unstable-options --shuffle --test-threads=1' | |
fi | |
SELF_TY_IN_MOD_NAME="$(${{ matrix.self_ty_in_mod_name }} && echo '--features test-fuzz/self_ty_in_mod_name')" || true | |
CONFIG_GROUP_RUNNER="--config target.'cfg(all())'.runner='group-runner'" | |
BUILD_CMD="cargo build $SERDE_FORMAT $SELF_TY_IN_MOD_NAME --all-targets" | |
TEST_CMD="cargo test $SERDE_FORMAT $SELF_TY_IN_MOD_NAME $CONFIG_GROUP_RUNNER -- --nocapture $SHUFFLE" | |
echo "BUILD_CMD=$BUILD_CMD" >> "$GITHUB_ENV" | |
echo "TEST_CMD=$TEST_CMD" >> "$GITHUB_ENV" | |
- name: Build | |
run: $BUILD_CMD | |
- name: Test | |
run: | | |
$TEST_CMD | |
if [[ ${{ github.event_name }} = 'schedule' ]] || | |
git diff --name-only ${{ github.event.pull_request.base.sha }} | grep -w 'patches\|third_party' >/dev/null | |
then | |
$TEST_CMD --ignored | |
fi | |
env: | |
RUST_BACKTRACE: 1 | |
RUST_LOG: warn | |
all-checks: | |
needs: | |
- lint | |
- test | |
runs-on: ubuntu-latest | |
# smoelius: From "Defining prerequisite jobs" | |
# (https://docs.github.com/en/actions/using-jobs/using-jobs-in-a-workflow#defining-prerequisite-jobs): | |
# > If you would like a job to run even if a job it is dependent on did not succeed, use the | |
# > `always()` conditional expression in `jobs.<job_id>.if`. | |
if: ${{ always() }} | |
steps: | |
- name: Check results | |
if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }} | |
run: exit 1 |