2022-05-09 12:54:16 -07:00
|
|
|
name: CI OSes
|
2020-10-12 14:19:00 -07:00
|
|
|
|
2022-08-29 17:11:05 -07:00
|
|
|
# Ensures that only one workflow task will run at a time. Previous builds, if
|
|
|
|
# already in process, will get cancelled. Only the latest commit will be allowed
|
|
|
|
# to run, cancelling any workflows in between
|
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
2021-02-15 17:50:32 -08:00
|
|
|
on:
|
2021-02-16 14:04:00 -08:00
|
|
|
workflow_dispatch:
|
2022-04-20 17:33:08 -07:00
|
|
|
# we build Rust and Zcash parameter caches on main,
|
|
|
|
# so they can be shared by all branches:
|
|
|
|
# https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#restrictions-for-accessing-a-cache
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
paths:
|
|
|
|
# production code and test code
|
|
|
|
- '**/*.rs'
|
|
|
|
# hard-coded checkpoints
|
2023-01-24 08:27:56 -08:00
|
|
|
# TODO: skip proptest regressions?
|
2022-04-20 17:33:08 -07:00
|
|
|
- '**/*.txt'
|
2023-01-24 08:27:56 -08:00
|
|
|
# test data snapshots
|
|
|
|
- '**/*.snap'
|
2022-04-20 17:33:08 -07:00
|
|
|
# dependencies
|
|
|
|
- '**/Cargo.toml'
|
|
|
|
- '**/Cargo.lock'
|
2023-01-24 08:27:56 -08:00
|
|
|
- '**/deny.toml'
|
2022-08-26 11:06:32 -07:00
|
|
|
# configuration files
|
|
|
|
- '.cargo/config.toml'
|
|
|
|
- '**/clippy.toml'
|
2022-04-20 17:33:08 -07:00
|
|
|
# workflow definitions
|
2022-11-06 17:59:32 -08:00
|
|
|
- '.github/workflows/continous-integration-os.yml'
|
2021-02-15 17:50:32 -08:00
|
|
|
pull_request:
|
2022-02-11 06:05:19 -08:00
|
|
|
paths:
|
2022-03-02 06:23:05 -08:00
|
|
|
# code and tests
|
2022-01-25 03:58:11 -08:00
|
|
|
- '**/*.rs'
|
2022-03-04 11:55:49 -08:00
|
|
|
# hard-coded checkpoints and proptest regressions
|
2022-01-25 03:58:11 -08:00
|
|
|
- '**/*.txt'
|
2022-03-02 06:23:05 -08:00
|
|
|
# test data snapshots
|
|
|
|
- '**/*.snap'
|
|
|
|
# dependencies
|
2022-01-25 03:58:11 -08:00
|
|
|
- '**/Cargo.toml'
|
|
|
|
- '**/Cargo.lock'
|
|
|
|
- '**/deny.toml'
|
2023-01-24 08:27:56 -08:00
|
|
|
# configuration files
|
|
|
|
- '.cargo/config.toml'
|
|
|
|
- '**/clippy.toml'
|
2022-03-02 06:23:05 -08:00
|
|
|
# workflow definitions
|
2022-05-09 12:54:16 -07:00
|
|
|
- '.github/workflows/continous-integration-os.yml'
|
2020-09-23 18:52:52 -07:00
|
|
|
|
refactor (actions): make better use of variables, secrets and versions (#3393)
* style: use global variables and don't double print
Remove repeated instances of global environment variables. Do not print ENV variables on the terminal as GitHub Actions already shows it.
* fix (actions): Use fixed major versions for actions
As actions get recurrent fixes, using a specific version causes more maintance on the pipelines.
On the other hand, using @master versions could make some action unreliable, as breaking changes might be included without further notice, and even change behavior on a daily basis.
* refactor: make better use of ENV variables
A whole step with refex was being used to extract different variables from GitHub's environment. This gets depecrated in favor of using `rlespinasse/github-slug-action@v4` which has slug URL variables.
A SLUG on a variable will:
- put the variable content in lower case
- replace any character by - except 0-9, a-z, ., and _
- remove leading and trailing - character
- limit the string size to 63 characters
This changes also takes care of using the Head or Base branch for deployments. This will allow us tomerge of workflows, as most steps on this deployment actions are very similar, with little variations between workflows.
* fix (actions): use secrets for sensitive information
* revert: use specific versions for dependabot
Reverting commit 8c934099028e0651e464678c096d8d3815efe95c
2022-01-26 17:46:18 -08:00
|
|
|
env:
|
2023-04-12 23:56:21 -07:00
|
|
|
CARGO_INCREMENTAL: ${{ vars.CARGO_INCREMENTAL }}
|
|
|
|
RUST_LOG: ${{ vars.RUST_LOG }}
|
|
|
|
RUST_BACKTRACE: ${{ vars.RUST_BACKTRACE }}
|
|
|
|
RUST_LIB_BACKTRACE: ${{ vars.RUST_LIB_BACKTRACE }}
|
|
|
|
COLORBT_SHOW_HIDDEN: ${{ vars.COLORBT_SHOW_HIDDEN }}
|
refactor (actions): make better use of variables, secrets and versions (#3393)
* style: use global variables and don't double print
Remove repeated instances of global environment variables. Do not print ENV variables on the terminal as GitHub Actions already shows it.
* fix (actions): Use fixed major versions for actions
As actions get recurrent fixes, using a specific version causes more maintance on the pipelines.
On the other hand, using @master versions could make some action unreliable, as breaking changes might be included without further notice, and even change behavior on a daily basis.
* refactor: make better use of ENV variables
A whole step with refex was being used to extract different variables from GitHub's environment. This gets depecrated in favor of using `rlespinasse/github-slug-action@v4` which has slug URL variables.
A SLUG on a variable will:
- put the variable content in lower case
- replace any character by - except 0-9, a-z, ., and _
- remove leading and trailing - character
- limit the string size to 63 characters
This changes also takes care of using the Head or Base branch for deployments. This will allow us tomerge of workflows, as most steps on this deployment actions are very similar, with little variations between workflows.
* fix (actions): use secrets for sensitive information
* revert: use specific versions for dependabot
Reverting commit 8c934099028e0651e464678c096d8d3815efe95c
2022-01-26 17:46:18 -08:00
|
|
|
|
2019-09-05 10:08:48 -07:00
|
|
|
jobs:
|
2020-05-14 13:31:01 -07:00
|
|
|
test:
|
2022-11-03 19:00:56 -07:00
|
|
|
name: Test ${{ matrix.rust }} on ${{ matrix.os }}${{ matrix.features }}
|
2021-11-25 08:26:32 -08:00
|
|
|
# The large timeout is to accommodate:
|
2023-02-16 22:08:59 -08:00
|
|
|
# - macOS and Windows builds (90 minutes, typically 30-70 minutes), and
|
|
|
|
# - parameter downloads (an extra 100 minutes, but only when the cache expires)
|
|
|
|
timeout-minutes: 190
|
2020-05-14 13:31:01 -07:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
2021-02-18 15:54:35 -08:00
|
|
|
fail-fast: false
|
2020-05-14 13:31:01 -07:00
|
|
|
matrix:
|
2022-03-09 16:50:12 -08:00
|
|
|
# TODO: Windows was removed for now, see https://github.com/ZcashFoundation/zebra/issues/3801
|
2023-06-05 20:35:39 -07:00
|
|
|
# TODO: macOS tests were removed for now, see https://github.com/ZcashFoundation/zebra/issues/6824
|
|
|
|
os: [ubuntu-latest]
|
2022-10-31 17:51:29 -07:00
|
|
|
rust: [stable, beta]
|
2022-11-03 19:00:56 -07:00
|
|
|
features: ["", " --features getblocktemplate-rpcs"]
|
2022-08-22 20:43:18 -07:00
|
|
|
exclude:
|
2022-06-21 21:35:18 -07:00
|
|
|
# We're excluding macOS for the following reasons:
|
|
|
|
# - the concurrent macOS runner limit is much lower than the Linux limit
|
|
|
|
# - macOS is slower than Linux, and shouldn't have a build or test difference with Linux
|
|
|
|
# - macOS is a second-tier Zebra support platform
|
|
|
|
- os: macos-latest
|
|
|
|
rust: beta
|
2022-11-03 19:00:56 -07:00
|
|
|
- os: macos-latest
|
|
|
|
features: " --features getblocktemplate-rpcs"
|
2023-05-30 05:56:44 -07:00
|
|
|
# getblocktemplate-rpcs is an experimental feature, so we just need to test it on stable Rust
|
|
|
|
# beta is unlikely to fail just for this feature, and if it does, we can fix it when it reaches stable.
|
|
|
|
- os: ubuntu-latest
|
|
|
|
rust: beta
|
|
|
|
features: " --features getblocktemplate-rpcs"
|
2020-05-14 13:31:01 -07:00
|
|
|
|
2019-09-05 10:08:48 -07:00
|
|
|
steps:
|
2023-06-09 17:59:58 -07:00
|
|
|
- uses: actions/checkout@v3.5.3
|
2021-05-16 16:32:38 -07:00
|
|
|
with:
|
|
|
|
persist-credentials: false
|
2023-05-18 09:44:39 -07:00
|
|
|
- uses: r7kamura/rust-problem-matchers@v1.3.0
|
2021-06-14 18:36:33 -07:00
|
|
|
|
2022-09-06 07:49:18 -07:00
|
|
|
- name: Install last version of Protoc
|
2023-06-05 19:05:31 -07:00
|
|
|
uses: arduino/setup-protoc@v2.0.0
|
2022-09-06 07:49:18 -07:00
|
|
|
with:
|
2023-01-10 13:22:03 -08:00
|
|
|
# TODO: increase to latest version after https://github.com/arduino/setup-protoc/issues/33 is fixed
|
2023-06-05 19:05:31 -07:00
|
|
|
version: '23.x'
|
2022-09-06 07:49:18 -07:00
|
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
2023-05-10 07:25:41 -07:00
|
|
|
# Setup Rust with ${{ matrix.rust }} toolchain and minimal profile
|
|
|
|
- name: Setup Rust
|
|
|
|
run: |
|
|
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain=${{ matrix.rust }} --profile=minimal
|
|
|
|
|
2021-06-14 18:36:33 -07:00
|
|
|
|
2023-07-04 19:09:45 -07:00
|
|
|
- uses: Swatinem/rust-cache@v2.5.1
|
2022-09-07 07:32:41 -07:00
|
|
|
# TODO: change Rust cache target directory on Windows,
|
|
|
|
# or remove this workaround once the build is more efficient (#3005).
|
|
|
|
#with:
|
|
|
|
# workspaces: ". -> C:\\zebra-target"
|
2022-11-08 12:53:08 -08:00
|
|
|
with:
|
|
|
|
# Split the getblocktemplate-rpcs cache from the regular cache, to avoid linker errors.
|
|
|
|
# (These might be "disk full" errors, or they might be dependency resolution issues.)
|
|
|
|
key: ${{ matrix.features }}
|
2022-09-07 07:32:41 -07:00
|
|
|
|
|
|
|
- name: Change target output directory on Windows
|
|
|
|
# Windows doesn't have enough space on the D: drive, so we redirect the build output to the
|
|
|
|
# larger C: drive.
|
|
|
|
# TODO: Remove this workaround once the build is more efficient (#3005).
|
|
|
|
if: matrix.os == 'windows-latest'
|
|
|
|
run: |
|
|
|
|
mkdir "C:\\zebra-target"
|
|
|
|
echo "CARGO_TARGET_DIR=C:\\zebra-target" | Out-File -FilePath "$env:GITHUB_ENV" -Encoding utf8 -Append
|
2021-06-14 18:36:33 -07:00
|
|
|
|
2020-05-14 13:31:01 -07:00
|
|
|
- name: cargo fetch
|
2023-05-10 07:25:41 -07:00
|
|
|
run: |
|
|
|
|
cargo fetch
|
2021-06-14 18:36:33 -07:00
|
|
|
|
2020-10-18 21:03:24 -07:00
|
|
|
- name: Install LLVM on Windows
|
2020-08-18 11:08:53 -07:00
|
|
|
if: matrix.os == 'windows-latest'
|
2021-04-19 03:39:24 -07:00
|
|
|
run: |
|
|
|
|
choco install llvm -y
|
|
|
|
echo "C:\Program Files\LLVM\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
|
|
|
echo "LIBCLANG_PATH=C:\Program Files\LLVM\bin" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
2021-06-14 18:36:33 -07:00
|
|
|
|
2021-11-19 15:02:56 -08:00
|
|
|
- name: Skip network tests on Ubuntu and Windows
|
2021-11-22 09:26:07 -08:00
|
|
|
# Ubuntu runners don't have reliable network or DNS during test steps.
|
2021-11-19 15:02:56 -08:00
|
|
|
# Windows runners have an unreliable network.
|
|
|
|
shell: bash
|
2022-04-11 22:06:37 -07:00
|
|
|
if: matrix.os != 'macos-latest'
|
2020-10-18 21:03:24 -07:00
|
|
|
run: echo "ZEBRA_SKIP_NETWORK_TESTS=1" >> $GITHUB_ENV
|
2021-06-14 18:36:33 -07:00
|
|
|
|
2021-11-22 09:26:07 -08:00
|
|
|
- name: Minimise proptest cases on macOS and Windows
|
|
|
|
# We set cases to 1, because some tests already run 1 case by default.
|
|
|
|
# We keep maximum shrink iterations at the default value, because it only happens on failure.
|
|
|
|
#
|
|
|
|
# Windows compilation and tests are slower than other platforms.
|
|
|
|
# macOS runners do extra network tests, so they take longer.
|
|
|
|
shell: bash
|
|
|
|
if: matrix.os != 'ubuntu-latest'
|
|
|
|
run: |
|
2022-04-11 22:06:37 -07:00
|
|
|
echo "PROPTEST_CASES=1" >> $GITHUB_ENV
|
|
|
|
echo "PROPTEST_MAX_SHRINK_ITERS=1024" >> $GITHUB_ENV
|
2021-11-22 09:26:07 -08:00
|
|
|
|
2021-11-19 15:02:56 -08:00
|
|
|
# Modified from:
|
|
|
|
# https://github.com/zcash/librustzcash/blob/c48bb4def2e122289843ddb3cb2984c325c03ca0/.github/workflows/ci.yml#L20-L33
|
2022-05-11 07:06:58 -07:00
|
|
|
#
|
2022-11-03 19:00:56 -07:00
|
|
|
# TODO:
|
|
|
|
# - split Fetch/Cache Zcash parameters into their own job,
|
|
|
|
# and use `concurrency:` to limit it to one job per OS
|
|
|
|
# - split get-params-path and download-params examples into their own crate,
|
|
|
|
# to speed up compilation
|
2021-11-19 15:02:56 -08:00
|
|
|
- name: Fetch path to Zcash parameters
|
|
|
|
working-directory: ./zebra-consensus
|
|
|
|
shell: bash
|
2022-11-08 23:36:10 -08:00
|
|
|
run: echo "ZCASH_PARAMS=$(cargo run --release --example get-params-path)" >> $GITHUB_ENV
|
2021-11-19 15:02:56 -08:00
|
|
|
- name: Cache Zcash parameters
|
|
|
|
id: cache-params
|
2022-03-21 16:08:25 -07:00
|
|
|
uses: actions/cache@v3
|
2021-11-19 15:02:56 -08:00
|
|
|
with:
|
|
|
|
path: ${{ env.ZCASH_PARAMS }}
|
2021-11-25 08:26:32 -08:00
|
|
|
key: ${{ runner.os }}-sprout-and-sapling-params
|
2021-11-19 15:02:56 -08:00
|
|
|
- name: Fetch Zcash parameters
|
|
|
|
if: steps.cache-params.outputs.cache-hit != 'true'
|
|
|
|
working-directory: ./zebra-consensus
|
2022-11-08 23:36:10 -08:00
|
|
|
run: cargo run --release --example download-params
|
2021-11-19 15:02:56 -08:00
|
|
|
|
2022-11-03 23:57:36 -07:00
|
|
|
# Run unit and basic acceptance tests, only showing command output if the test fails.
|
|
|
|
#
|
|
|
|
# If some tests hang, add "-- --nocapture" for just that test, or for all the tests.
|
2022-11-03 19:00:56 -07:00
|
|
|
- name: Run tests${{ matrix.features }}
|
2023-05-10 07:25:41 -07:00
|
|
|
run: |
|
|
|
|
cargo test ${{ matrix.features }} --release --verbose --workspace
|
2022-10-24 16:38:48 -07:00
|
|
|
|
2021-02-19 01:36:32 -08:00
|
|
|
# Explicitly run any tests that are usually #[ignored]
|
2021-06-14 18:36:33 -07:00
|
|
|
|
2022-11-03 19:00:56 -07:00
|
|
|
- name: Run zebrad large sync tests${{ matrix.features }}
|
2021-02-19 01:36:32 -08:00
|
|
|
# Skip the entire step on Ubuntu and Windows, because the test would be skipped anyway due to ZEBRA_SKIP_NETWORK_TESTS
|
2022-11-03 19:00:56 -07:00
|
|
|
# Currently, this also skips large sync with `getblocktemplate-rpcs`,
|
|
|
|
# but that is already covered by the Docker tests.
|
2022-04-11 22:06:37 -07:00
|
|
|
if: matrix.os == 'macos-latest'
|
2023-05-10 07:25:41 -07:00
|
|
|
run: |
|
|
|
|
cargo test ${{ matrix.features }} --release --verbose --package zebrad --test acceptance -- --nocapture --include-ignored sync_large_checkpoints_
|
2020-08-14 16:51:03 -07:00
|
|
|
|
2022-05-11 16:41:33 -07:00
|
|
|
# Install Zebra with lockfile dependencies, with no caching and default features
|
2022-03-30 14:53:57 -07:00
|
|
|
install-from-lockfile-no-cache:
|
|
|
|
name: Install zebrad from lockfile without cache on ubuntu-latest
|
|
|
|
timeout-minutes: 60
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
2023-06-09 17:59:58 -07:00
|
|
|
- uses: actions/checkout@v3.5.3
|
2022-03-30 14:53:57 -07:00
|
|
|
with:
|
|
|
|
persist-credentials: false
|
2023-05-18 09:44:39 -07:00
|
|
|
- uses: r7kamura/rust-problem-matchers@v1.3.0
|
2022-03-30 14:53:57 -07:00
|
|
|
|
2023-05-10 07:25:41 -07:00
|
|
|
# Setup Rust with stable toolchain and minimal profile
|
|
|
|
- name: Setup Rust
|
|
|
|
run: |
|
|
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain=stable --profile=minimal
|
2022-03-30 14:53:57 -07:00
|
|
|
|
2023-05-10 07:25:41 -07:00
|
|
|
- name: Install zebrad
|
|
|
|
run: |
|
|
|
|
cargo install --locked --path ./zebrad/ zebrad
|
2022-03-30 14:53:57 -07:00
|
|
|
|
2022-05-11 16:41:33 -07:00
|
|
|
# Check that Cargo.lock includes any Cargo.toml changes.
|
|
|
|
# This check makes sure the `cargo-deny` crate dependency checks are accurate.
|
|
|
|
check-cargo-lock:
|
|
|
|
name: Check Cargo.lock is up to date
|
2021-02-16 07:53:04 -08:00
|
|
|
timeout-minutes: 60
|
2021-04-29 13:54:47 -07:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
2020-08-14 16:51:03 -07:00
|
|
|
steps:
|
2023-06-09 17:59:58 -07:00
|
|
|
- uses: actions/checkout@v3.5.3
|
2021-05-16 16:32:38 -07:00
|
|
|
with:
|
|
|
|
persist-credentials: false
|
2023-05-18 09:44:39 -07:00
|
|
|
- uses: r7kamura/rust-problem-matchers@v1.3.0
|
2021-06-14 18:36:33 -07:00
|
|
|
|
2022-09-06 07:49:18 -07:00
|
|
|
- name: Install last version of Protoc
|
2023-06-05 19:05:31 -07:00
|
|
|
uses: arduino/setup-protoc@v2.0.0
|
2022-09-06 07:49:18 -07:00
|
|
|
with:
|
2023-01-10 13:22:03 -08:00
|
|
|
# TODO: increase to latest version after https://github.com/arduino/setup-protoc/issues/33 is fixed
|
2023-06-05 19:05:31 -07:00
|
|
|
version: '23.x'
|
2022-09-06 07:49:18 -07:00
|
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
2023-05-10 07:25:41 -07:00
|
|
|
# Setup Rust with stable toolchain and minimal profile
|
|
|
|
- name: Setup Rust
|
|
|
|
run: |
|
|
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain=stable --profile=minimal
|
2021-06-14 18:36:33 -07:00
|
|
|
|
2023-07-04 19:09:45 -07:00
|
|
|
- uses: Swatinem/rust-cache@v2.5.1
|
2022-09-07 07:32:41 -07:00
|
|
|
with:
|
2023-05-10 07:25:41 -07:00
|
|
|
shared-key: "clippy-cargo-lock"
|
2022-05-18 19:43:08 -07:00
|
|
|
|
2022-01-25 03:58:11 -08:00
|
|
|
- name: Check Cargo.lock is up to date
|
2023-05-10 07:25:41 -07:00
|
|
|
run: |
|
|
|
|
cargo check --locked --all-features --all-targets
|
2022-01-25 03:58:11 -08:00
|
|
|
|
|
|
|
cargo-deny:
|
2022-06-20 19:30:45 -07:00
|
|
|
name: Check deny.toml ${{ matrix.checks }} ${{ matrix.features }}
|
2020-04-21 01:51:05 -07:00
|
|
|
runs-on: ubuntu-latest
|
2022-01-25 03:58:11 -08:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
checks:
|
2022-02-21 09:41:31 -08:00
|
|
|
- bans
|
2022-01-25 03:58:11 -08:00
|
|
|
- sources
|
2023-05-30 05:56:44 -07:00
|
|
|
# We don't need to check `--no-default-features` here, because (except in very rare cases):
|
|
|
|
# - disabling features isn't going to add duplicate dependencies
|
|
|
|
# - disabling features isn't going to add more crate sources
|
2023-06-25 22:44:19 -07:00
|
|
|
features: ['', '--features default-release-binaries', '--all-features']
|
|
|
|
# Always run the --all-features job, to get accurate "skip tree root was not found" warnings
|
2023-05-10 17:59:19 -07:00
|
|
|
fail-fast: false
|
2021-11-22 09:26:07 -08:00
|
|
|
|
2022-01-25 03:58:11 -08:00
|
|
|
# Prevent sudden announcement of a new advisory from failing ci:
|
|
|
|
continue-on-error: ${{ matrix.checks == 'advisories' }}
|
2021-02-16 14:04:00 -08:00
|
|
|
|
2020-05-27 19:12:25 -07:00
|
|
|
steps:
|
2023-06-09 17:59:58 -07:00
|
|
|
- uses: actions/checkout@v3.5.3
|
2022-04-11 22:06:37 -07:00
|
|
|
with:
|
|
|
|
persist-credentials: false
|
2023-05-18 09:44:39 -07:00
|
|
|
- uses: r7kamura/rust-problem-matchers@v1.3.0
|
2022-04-11 22:06:37 -07:00
|
|
|
|
2022-06-20 19:30:45 -07:00
|
|
|
- name: Check ${{ matrix.checks }} with features ${{ matrix.features }}
|
|
|
|
uses: EmbarkStudios/cargo-deny-action@v1
|
2022-04-11 22:06:37 -07:00
|
|
|
with:
|
2023-06-25 22:44:19 -07:00
|
|
|
# --all-features spuriously activates openssl, but we want to ban that dependency in
|
|
|
|
# all of zebrad's production features for security reasons. But the --all-features job is
|
|
|
|
# the only job that gives accurate "skip tree root was not found" warnings.
|
|
|
|
# In other jobs, we expect some of these warnings, due to disabled features.
|
|
|
|
command: check ${{ matrix.checks }} ${{ matrix.features == '--all-features' && '--allow banned' || '--allow unmatched-skip-root' }}
|
2022-12-07 14:38:17 -08:00
|
|
|
arguments: --workspace ${{ matrix.features }}
|
2023-02-26 15:42:36 -08:00
|
|
|
|
|
|
|
unused-deps:
|
|
|
|
name: Check for unused dependencies
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout git repository
|
2023-06-09 17:59:58 -07:00
|
|
|
uses: actions/checkout@v3.5.3
|
2023-02-26 15:42:36 -08:00
|
|
|
with:
|
|
|
|
persist-credentials: false
|
2023-05-18 09:44:39 -07:00
|
|
|
- uses: r7kamura/rust-problem-matchers@v1.3.0
|
2023-02-26 15:42:36 -08:00
|
|
|
|
2023-05-10 07:25:41 -07:00
|
|
|
# Setup Rust with stable toolchain and minimal profile
|
|
|
|
- name: Setup Rust
|
|
|
|
run: |
|
|
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain=stable --profile=minimal
|
2023-02-26 15:42:36 -08:00
|
|
|
|
|
|
|
- name: Install cargo-machete
|
2023-06-14 20:09:03 -07:00
|
|
|
uses: baptiste0928/cargo-install@v2.1.0
|
2023-02-26 15:42:36 -08:00
|
|
|
with:
|
|
|
|
crate: cargo-machete
|
|
|
|
|
|
|
|
- name: Check unused dependencies
|
|
|
|
# Exclude macro and transitive dependencies by filtering them out of the output,
|
|
|
|
# then if there are any more unused dependencies, fail the job.
|
|
|
|
run: |
|
|
|
|
echo "-- full cargo machete output, including ignored dependencies --"
|
|
|
|
cargo machete --skip-target-dir || true
|
|
|
|
echo "-- unused dependencies are below this line, full output is above --"
|
|
|
|
if (cargo machete --skip-target-dir 2>/dev/null || true) | \
|
2023-06-13 01:46:01 -07:00
|
|
|
grep -v -e gumdrop -e humantime-serde -e tinyvec -e zebra-utils -e "found the following" -e Cargo.toml -e Done; then
|
2023-02-26 15:42:36 -08:00
|
|
|
echo "New unused dependencies were found, please remove them!"
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo "No unused dependencies found."
|
|
|
|
fi
|