Skip to content

fix(network): guard most_recent_by_ip unwrap in address-book ban path… #60

fix(network): guard most_recent_by_ip unwrap in address-book ban path…

fix(network): guard most_recent_by_ip unwrap in address-book ban path… #60

Workflow file for this run

name: Lint
on:
pull_request:
branches: [main]
paths:
- "**/*.rs"
- "**/Cargo.toml"
- "**/Cargo.lock"
- clippy.toml
- .cargo/config.toml
- .github/workflows/lint.yml
- supply-chain/**
push:
branches: [main]
paths:
- "**/*.rs"
- "**/Cargo.toml"
- "**/Cargo.lock"
- clippy.toml
- .cargo/config.toml
- .github/workflows/lint.yml
- supply-chain/**
# 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
permissions:
contents: read
pull-requests: read
env:
CLICOLOR: 1
jobs:
clippy:
name: clippy ${{ matrix.rust-version }} / ${{ matrix.type }}
permissions:
id-token: write
statuses: write
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
rust-version: [stable, beta]
type: [release, tests]
include:
- type: release
args: --workspace --all-targets
features: default-release-binaries
- type: tests
args: --workspace --all-targets
features: default-release-binaries proptest-impl lightwalletd-grpc-tests zebra-checkpoints
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
with:
persist-credentials: false
- uses: actions-rust-lang/setup-rust-toolchain@46268bd060767258de96ed93c1251119784f2ab6 #v1.16.1
with:
components: clippy
toolchain: ${{ matrix.rust-version }}
cache-on-failure: true
- uses: ./.github/actions/setup-zebra-build
- name: Run clippy
run: cargo clippy ${{ matrix.args }} --features "${{ matrix.features }}"
crate-checks:
permissions:
statuses: write
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
with:
persist-credentials: false
- uses: actions-rust-lang/setup-rust-toolchain@46268bd060767258de96ed93c1251119784f2ab6 #v1.16.1
with:
cache-on-failure: true
- uses: taiki-e/install-action@65851e10cd6c377f11a60e600abc07cb08643468 #v2.79.3
with:
tool: cargo-hack
- uses: ./.github/actions/setup-zebra-build
- run: cargo hack check --workspace
msrv:
name: MSRV
permissions:
id-token: write
statuses: write
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
matrix:
include:
- binary: zebrad
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
with:
persist-credentials: false
- uses: actions-rust-lang/setup-rust-toolchain@46268bd060767258de96ed93c1251119784f2ab6 #v1.16.1
with:
toolchain: 1.91 # MSRV
cache-on-failure: true
- uses: ./.github/actions/setup-zebra-build
- run: cargo build --bin "${{ matrix.binary }}" --workspace
docs:
name: docs
permissions:
statuses: write
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
with:
persist-credentials: false
- uses: actions-rust-lang/setup-rust-toolchain@46268bd060767258de96ed93c1251119784f2ab6 #v1.16.1
with:
toolchain: nightly
cache-on-failure: true
- uses: ./.github/actions/setup-zebra-build
- run: cargo doc --no-deps --workspace --all-features --document-private-items --target-dir "$(pwd)"/target/internal
env:
# Keep in sync with ./book.yml:jobs.build
# The -A and -W settings must be the same as the `rustdocflags` in:
# https://github.com/ZcashFoundation/zebra/blob/main/.cargo/config.toml#L87
RUSTDOCFLAGS: --html-in-header katex-header.html -A rustdoc::private_intra_doc_links -D warnings
fmt:
name: fmt
permissions:
statuses: write
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
with:
persist-credentials: false
- uses: actions-rust-lang/setup-rust-toolchain@46268bd060767258de96ed93c1251119784f2ab6 #v1.16.1
with:
toolchain: nightly
components: rustfmt
- name: Run fmt
run: cargo fmt --all -- --check
unused-deps:
name: unused-deps
permissions:
id-token: write
statuses: write
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
with:
persist-credentials: false
- uses: actions-rust-lang/setup-rust-toolchain@46268bd060767258de96ed93c1251119784f2ab6 #v1.16.1
with:
toolchain: nightly
cache-on-failure: true
- uses: taiki-e/install-action@65851e10cd6c377f11a60e600abc07cb08643468 #v2.79.3
with:
tool: cargo-udeps
- uses: ./.github/actions/setup-zebra-build
- run: cargo udeps --workspace --all-targets --all-features --locked
no-test-deps:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
with:
persist-credentials: false
- uses: actions-rust-lang/setup-rust-toolchain@46268bd060767258de96ed93c1251119784f2ab6 #v1.16.1
with:
toolchain: stable
cache-on-failure: true
- name: Ensure no arbitrary or proptest dependency on default build
run: cargo tree --package zebrad -e=features,no-dev | grep -Eq "arbitrary|proptest" && exit 1 || exit 0
# Checks that selected rates can compile with power set of features
features:
name: features
permissions:
id-token: write
statuses: write
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
with:
persist-credentials: false
- uses: actions-rust-lang/setup-rust-toolchain@46268bd060767258de96ed93c1251119784f2ab6 #v1.16.1
with:
toolchain: nightly
cache-on-failure: true
- name: cargo install cargo-hack
uses: taiki-e/install-action@65851e10cd6c377f11a60e600abc07cb08643468 #v2.79.3
with:
tool: cargo-hack
- uses: ./.github/actions/setup-zebra-build
- run: cargo hack check --all
env:
RUSTFLAGS: -D warnings
check-cargo-lock:
name: check-cargo-lock
permissions:
id-token: write
statuses: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
with:
persist-credentials: false
- uses: actions-rust-lang/setup-rust-toolchain@46268bd060767258de96ed93c1251119784f2ab6 #v1.16.1
with:
toolchain: stable
cache-on-failure: true
- uses: ./.github/actions/setup-zebra-build
- run: cargo check --locked --all-features --all-targets
deny:
name: Check deny ${{ matrix.checks }} ${{ matrix.features }}
permissions:
statuses: write
runs-on: ubuntu-latest
strategy:
matrix:
checks:
- bans
- sources
- advisories
- licenses
# 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
# For advisories and licenses, feature flags don't change the dependency tree materially,
# so we only need the default and --all-features variants.
features: ["", --features default-release-binaries, --all-features]
# Always run the --all-features job, to get accurate "skip tree root was not found" warnings
fail-fast: false
# Prevent sudden announcement of a new advisory from failing ci:
continue-on-error: ${{ matrix.checks == 'advisories' }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
with:
persist-credentials: false
- uses: actions-rust-lang/setup-rust-toolchain@46268bd060767258de96ed93c1251119784f2ab6 #v1.16.1
with:
cache-on-failure: true
- name: Check ${{ matrix.checks }} with features ${{ matrix.features }}
uses: EmbarkStudios/cargo-deny-action@6c8f9facfa5047ec02d8485b6bf52b587b7777d1 #v2.0.18
with:
# --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' }}
arguments: --workspace ${{ matrix.features }}
vet:
name: cargo-vet check
permissions:
statuses: write
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
with:
persist-credentials: false
- uses: actions-rust-lang/setup-rust-toolchain@46268bd060767258de96ed93c1251119784f2ab6 #v1.16.1
with:
cache-on-failure: true
- name: Install cargo-vet
uses: taiki-e/install-action@65851e10cd6c377f11a60e600abc07cb08643468 #v2.79.3
with:
tool: cargo-vet
- name: Run cargo-vet check
run: cargo vet check
lint-success:
name: lint success
runs-on: ubuntu-latest
if: always()
needs:
- clippy
- crate-checks
- docs
- fmt
- unused-deps
- check-cargo-lock
- no-test-deps
- features
- deny
- vet
timeout-minutes: 30
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe #v1.2.2
with:
jobs: ${{ toJSON(needs) }}