Skip to content

chore: release v6.3.0 #2482

chore: release v6.3.0

chore: release v6.3.0 #2482

Workflow file for this run

name: Test Crate Build
on:
pull_request:
branches: [main]
push:
branches: [main]
merge_group:
workflow_dispatch:
# 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:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
RUST_LIB_BACKTRACE: 1
RUST_LOG: info
COLORBT_SHOW_HIDDEN: 1
jobs:
changes:
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
test_crates: ${{ steps.filter.outputs.test_crates || 'true' }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
if: github.event_name == 'pull_request'
with:
persist-credentials: false
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
id: filter
if: github.event_name == 'pull_request'
with:
filters: .github/path-filters.yml
crates-matrix:
name: Generate crates matrix
needs: changes
if: needs.changes.outputs.test_crates == 'true'
permissions:
contents: read
statuses: write
runs-on: ubuntu-latest
timeout-minutes: 30
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
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.97.0
components: clippy
# This job only runs `cargo tree` to build the matrix, so a cache here
# only consumes quota.
cache: false
- uses: ./.github/actions/setup-zebra-build
# This step dynamically creates a JSON containing the values of each crate
# available in this repo in the root directory. We use `cargo tree` to accomplish this task.
#
# The result from `cargo tree` is then sorted so the longest job (zebrad) runs first,
# transformed to JSON values between double quotes, and separated by commas,
# then added to a `crates.txt`.
#
# A JSON object is created and assigned to a $MATRIX variable, which is used to create an
# output named `matrix`, which is then used as the input in following steps,
# using ` ${{ fromJson(needs.crates-matrix.outputs.matrix) }}`
- id: set-matrix
name: Dynamically build crates JSON
run: |
TEMP_DIR=$(mktemp -d)
cargo tree --depth 0 --edges no-normal,no-dev,no-build,no-proc-macro --prefix none | cut -d ' ' -f1 | sed '/^$/d' | LC_ALL=C sort --reverse | awk '{ printf "\"%s\",\n", $0 }' | sed '$ s/.$//' > $TEMP_DIR/crates.txt
MATRIX=$( (
echo '{ "crate" : ['
echo "$(cat $TEMP_DIR/crates.txt)"
echo " ]}"
) | jq -c .)
echo $MATRIX
echo $MATRIX | jq .
echo "matrix=$MATRIX" >> "$GITHUB_OUTPUT"
build:
name: Build ${{ matrix.crate }} crate
needs: [changes, crates-matrix]
if: needs.changes.outputs.test_crates == 'true'
permissions:
contents: read
id-token: write
statuses: write
timeout-minutes: 90
# Some of these builds take more than 14GB disk space
runs-on: ubuntu-latest
strategy:
# avoid rate-limit errors by only launching a few of these jobs at a time,
# but still finish in a similar time to the longest tests
max-parallel: 4
fail-fast: true
matrix: ${{ fromJson(needs.crates-matrix.outputs.matrix) }}
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.97.0
components: clippy
# One cache for the whole matrix instead of one per crate. These jobs
# compile overlapping subsets of the same dependency graph, so 12
# per-crate caches stored ~12 GB of near-duplicate artifacts and blew
# through the repo's default 10 GB quota on their own.
cache-shared-key: crate-build
cache-on-failure: true
# Only main writes the shared cache, and only from the crate with the
# widest dependency closure, so the other legs restore a superset
# rather than whichever leg happened to finish first.
cache-save-if: ${{ github.ref == 'refs/heads/main' && matrix.crate == 'zebrad' }}
- uses: ./.github/actions/setup-zebra-build
# We could use `features: ['', '--all-features', '--no-default-features']` as a matrix argument,
# but it's faster to run these commands sequentially, so they can re-use the local cargo cache.
#
# Some Zebra crates do not have any features, and most don't have any default features.
# Some targets activate features, but we still need to be able to build without them.
- name: Build ${{ matrix.crate }} crate with default features
run: |
cargo clippy --package ${{ matrix.crate }} -- -D warnings
cargo build --package ${{ matrix.crate }}
- name: Build ${{ matrix.crate }} crate with no default features and all targets
run: |
cargo clippy --package ${{ matrix.crate }} --no-default-features --all-targets -- -D warnings
cargo build --package ${{ matrix.crate }} --no-default-features --all-targets
- name: Build ${{ matrix.crate }} crate with default features and all targets
run: |
cargo clippy --package ${{ matrix.crate }} --all-targets -- -D warnings
cargo build --package ${{ matrix.crate }} --all-targets
- name: Build ${{ matrix.crate }} crate with all features and all targets
run: |
cargo clippy --package ${{ matrix.crate }} --all-features --all-targets -- -D warnings
cargo build --package ${{ matrix.crate }} --all-features --all-targets
build-msrv:
name: Build ${{ matrix.crate }} crate with MSRV
needs: [changes, crates-matrix]
if: needs.changes.outputs.test_crates == 'true'
permissions:
contents: read
id-token: write
statuses: write
timeout-minutes: 90
runs-on: ubuntu-latest
strategy:
# avoid rate-limit errors by only launching a few of these jobs at a time,
# but still finish in a similar time to the longest tests
max-parallel: 4
fail-fast: true
matrix: ${{ fromJson(needs.crates-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
with:
persist-credentials: false
- name: Extract MSRV from Cargo.toml
id: msrv
run: |
MSRV=$(grep 'rust-version' Cargo.toml | head -n1 | cut -d'"' -f2)
echo "version=$MSRV" >> "$GITHUB_OUTPUT"
echo "Extracted MSRV: $MSRV"
- uses: actions-rust-lang/setup-rust-toolchain@46268bd060767258de96ed93c1251119784f2ab6 #v1.16.1
with:
toolchain: ${{ steps.msrv.outputs.version }}
# One cache for the whole matrix, see the `build` job above.
cache-shared-key: crate-build-msrv
cache-on-failure: true
# `zebrad` can't seed this matrix: the build step below skips it, so
# that leg compiles nothing. `zebra-rpc` has the widest closure of
# the crates that do build here.
cache-save-if: ${{ github.ref == 'refs/heads/main' && matrix.crate == 'zebra-rpc' }}
- uses: ./.github/actions/setup-zebra-build
- name: Build ${{ matrix.crate }} crate with MSRV, all features and all targets
# zebrad can have a higher MSRV than the other crates since it is a binary, so we skip the MSRV build for it.
if: matrix.crate != 'zebrad'
env:
CRATE: ${{ matrix.crate }}
run: cargo build --package "$CRATE" --all-features --all-targets
test-crates:
runs-on: ubuntu-latest
if: always()
needs:
- changes
- crates-matrix
- build
- build-msrv
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) }}
allowed-skips: crates-matrix, build, build-msrv