Skip to content

CI: Use the new cargo rbmt tool #2185

CI: Use the new cargo rbmt tool

CI: Use the new cargo rbmt tool #2185

Workflow file for this run

--- # rust-bitcoin CI: If you edit this file please update README.md

Check failure on line 1 in .github/workflows/rust.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/rust.yml

Invalid workflow file

(Line: 16, Col: 12): Job 'Stable' depends on unknown job 'Prepare'., (Line: 36, Col: 12): Job 'Nightly' depends on unknown job 'Prepare'., (Line: 56, Col: 12): Job 'MSRV' depends on unknown job 'Prepare'., (Line: 76, Col: 12): Job 'Lint' depends on unknown job 'Prepare'., (Line: 97, Col: 12): Job 'Docs' depends on unknown job 'Prepare'., (Line: 117, Col: 12): Job 'Docsrs' depends on unknown job 'Prepare'., (Line: 137, Col: 12): Job 'Bench' depends on unknown job 'Prepare'., (Line: 198, Col: 12): Job 'Embedded' depends on unknown job 'Prepare'., (Line: 230, Col: 12): Job 'ASAN' depends on unknown job 'Prepare'., (Line: 288, Col: 12): Job 'API' depends on unknown job 'Prepare'.
on: # yamllint disable-line rule:truthy
push:
branches:
- master
- 'test-ci/**'
pull_request:
name: Continuous integration
permissions: {}
jobs:
Stable: # 2 jobs, one per manifest.
name: Test - stable toolchain
needs: Prepare
runs-on: ubuntu-24.04
permissions:
contents: read
strategy:
fail-fast: false
matrix:
dep: [minimal, recent]
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: ./.github/actions/prepare
with:
toolchain: stable
- name: "Run tests"
run: cargo rbmt test stable --lock-file ${{ matrix.dep }}
Nightly: # 2 jobs, one per manifest.
name: Test - nightly toolchain
needs: Prepare
runs-on: ubuntu-24.04
permissions:
contents: read
strategy:
fail-fast: false
matrix:
dep: [minimal, recent]
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: ./.github/actions/prepare
with:
toolchain: nightly
- name: "Run tests"
run: cargo rbmt test nightly --lock-file ${{ matrix.dep }}
MSRV: # 2 jobs, one per manifest.
name: Test - MSRV toolchain
needs: Prepare
runs-on: ubuntu-24.04
permissions:
contents: read
strategy:
fail-fast: false
matrix:
dep: [minimal, recent]
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: ./.github/actions/prepare
with:
toolchain: "1.74.0"
- name: "Run tests"
run: cargo rbmt test msrv --lock-file ${{ matrix.dep }}
Lint:
name: Lint - nightly toolchain
needs: Prepare
runs-on: ubuntu-24.04
permissions:
contents: read
strategy:
fail-fast: false
matrix:
dep: [recent]
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: ./.github/actions/prepare
with:
toolchain: nightly
components: clippy
- name: "Run lint"
run: cargo rbmt lint
Docs:
name: Docs - stable toolchain
needs: Prepare
runs-on: ubuntu-24.04
permissions:
contents: read
strategy:
fail-fast: false
matrix:
dep: [recent]
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: ./.github/actions/prepare
with:
toolchain: stable
- name: "Build docs"
run: cargo rbmt docs
Docsrs:
name: Docs - nightly toolchain
needs: Prepare
runs-on: ubuntu-24.04
permissions:
contents: read
strategy:
fail-fast: false
matrix:
dep: [recent]
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: ./.github/actions/prepare
with:
toolchain: nightly
- name: "Build docs.rs docs"
run: cargo rbmt docsrs
Bench:
name: Bench - nightly toolchain
needs: Prepare
runs-on: ubuntu-24.04
permissions:
contents: read
strategy:
fail-fast: false
matrix:
dep: [recent]
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: ./.github/actions/prepare
with:
toolchain: nightly
- name: "Run benches"
run: cargo rbmt test nightly --lock-file ${{ matrix.dep }}
Arch32bit:
name: Test 32-bit version
runs-on: ubuntu-24.04
permissions:
contents: read
steps:
- name: "Checkout repo"
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
- name: "Select toolchain"
uses: dtolnay/rust-toolchain@5d458579430fc14a04a08a1e7d3694f545e91ce6 # stable
- name: "Add architecture i386"
run: sudo dpkg --add-architecture i386
- name: "Install i686 gcc"
run: sudo apt-get update -y && sudo apt-get install -y gcc-multilib
- name: "Install target"
run: rustup target add i686-unknown-linux-gnu
- name: "Run test on i686"
run: cargo test --target i686-unknown-linux-gnu
Cross:
name: Cross test - stable toolchain
if: ${{ !github.event.act }}
runs-on: ubuntu-24.04
permissions:
contents: read
steps:
- name: "Checkout repo"
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
- name: "Select toolchain"
uses: dtolnay/rust-toolchain@5d458579430fc14a04a08a1e7d3694f545e91ce6 # stable
- name: "Install target"
run: rustup target add s390x-unknown-linux-gnu
- name: "Install cross"
run: cargo install cross --locked
- name: "Run cross test"
run: cross test --target s390x-unknown-linux-gnu
Embedded:
name: Embedded - nightly toolchain
needs: Prepare
runs-on: ubuntu-24.04
permissions:
contents: read
env:
RUSTFLAGS: "-C link-arg=-Tlink.x"
CARGO_TARGET_THUMBV7M_NONE_EABI_RUNNER: "qemu-system-arm -cpu cortex-m3 -machine mps2-an385 -nographic -semihosting-config enable=on,target=native -kernel"
steps:
- name: "Checkout repo"
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
- name: "Set up QEMU"
run: sudo apt update && sudo apt install -y qemu-system-arm gcc-arm-none-eabi
- name: "Select toolchain"
uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # v1
with:
toolchain: ${{ needs.Prepare.outputs.nightly_version }}
targets: thumbv7m-none-eabi
- name: "Install rust-src"
run: rustup component add rust-src
- name: "Run bitcoin/embedded"
run: cd bitcoin/embedded && cargo run --target thumbv7m-none-eabi
- name: "Run hashes/embedded no alloc"
run: cd hashes/embedded && cargo run --target thumbv7m-none-eabi
- name: "Run hashes/embedded with alloc and no hex"
run: cd hashes/embedded && cargo run --target thumbv7m-none-eabi --features=alloc
- name: "Run hashes/embedded with alloc and hex"
run: cd hashes/embedded && cargo run --target thumbv7m-none-eabi --features=alloc,hex
ASAN: # hashes crate only.
name: ASAN - nightly toolchain
needs: Prepare
runs-on: ubuntu-24.04
permissions:
contents: read
strategy:
fail-fast: false
matrix:
dep: [recent]
steps:
- name: "Checkout repo"
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
- name: "Select toolchain"
uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # v1
with:
toolchain: ${{ needs.Prepare.outputs.nightly_version }}
- name: "Install rust-src"
run: rustup component add rust-src
- name: "Set dependencies"
run: cp Cargo-${{ matrix.dep }}.lock Cargo.lock
- name: "Run sanitizer script"
run: cd ./hashes && ./contrib/sanitizer.sh
WASM: # hashes crate only.
name: WASM - stable toolchain
runs-on: ubuntu-24.04
permissions:
contents: read
strategy:
fail-fast: false
# Note we do not use the recent lock file for wasm testing.
steps:
- name: "Checkout repo"
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
- name: "Select toolchain"
uses: dtolnay/rust-toolchain@5d458579430fc14a04a08a1e7d3694f545e91ce6 # stable
- name: "Run wasm script"
run: cd hashes && ./contrib/wasm.sh
Kani:
name: Kani codegen - stable toolchain
runs-on: ubuntu-24.04
permissions:
contents: read
steps:
- name: "Checkout repo"
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
- name: "Build Kani proofs"
uses: model-checking/kani-github-action@f838096619a707b0f6b2118cf435eaccfa33e51f # v1.1
with:
args: "--only-codegen"
API:
needs: Prepare
name: API - nightly toolchain
runs-on: ubuntu-24.04
permissions:
contents: read
strategy:
fail-fast: false
matrix:
dep: [recent]
steps:
- name: "Checkout repo"
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
- name: "Select toolchain"
uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # v1
with:
toolchain: ${{ needs.Prepare.outputs.nightly_version }}
- name: "Install cargo-public-api"
run: cargo install --locked cargo-public-api --version 0.50.1
- name: "Set dependencies"
run: cp Cargo-${{ matrix.dep }}.lock Cargo.lock
- name: "Run API checker script"
run: ./contrib/check-for-api-changes.sh
Policy:
name: Enforce repo policy - stable toolchain
runs-on: ubuntu-24.04
permissions:
contents: read
strategy:
fail-fast: false
steps:
- name: "Checkout repo"
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
- name: "Select toolchain"
uses: dtolnay/rust-toolchain@5d458579430fc14a04a08a1e7d3694f545e91ce6 # stable
- name: "Run policy script"
run: ./contrib/check-for-policy-violations.sh
Re-exports:
name: Check re-exports - stable toolchain
runs-on: ubuntu-24.04
permissions:
contents: read
strategy:
fail-fast: false
steps:
- name: "Checkout repo"
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
- name: "Select toolchain"
uses: dtolnay/rust-toolchain@5d458579430fc14a04a08a1e7d3694f545e91ce6 # stable
- name: "Run primitives API checker script"
run: |
contrib/generate-primitives-re-export-test.sh && (cd ./primitives && cargo test --all-features)
contrib/generate-bitcoin-re-export-test.sh && (cd ./bitcoin && cargo test --all-features)
DiffMutants:
name: Check cargo mutants in diff - stable toolchain
runs-on: ubuntu-24.04
steps:
- name: "Checkout repo"
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
fetch-depth: 0 # required for full diff context
- name: "Select toolchain"
uses: dtolnay/rust-toolchain@5d458579430fc14a04a08a1e7d3694f545e91ce6 # stable
- name: "Fetch base branch for diff"
run: git fetch origin master
- name: "Retrieve relative diff"
run: git diff origin/master.. | tee git.diff
- uses: taiki-e/install-action@81ee1d48d9194cdcab880cbdc7d36e87d39874cb # v2.62.45
with:
tool: cargo-mutants
- run: cargo mutants --no-shuffle --in-diff git.diff