Skip to content
This repository has been archived by the owner on Sep 4, 2024. It is now read-only.

Commit

Permalink
Use rust-bitcoin-maintainer-tools and re-write CI
Browse files Browse the repository at this point in the history
As we have been doing in other crates, use the new maintainer tools test
script we created from `rust-bitcoin/rust-bitcoin-maintainer-tools/ci`.

- This should not change test coverage in any meaningful way.
- The integration tests are not currently run in CI, this patch
  preserves that behaviour.
- Introduces recent/minimal lock files.
  • Loading branch information
tcharding committed Aug 9, 2024
1 parent 9a84a10 commit 8f17794
Show file tree
Hide file tree
Showing 12 changed files with 852 additions and 129 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# rust-miniscript workflow notes

We are attempting to run max 20 parallel jobs using GitHub actions (usage limit for free tier).

ref: https://docs.github.com/en/actions/learn-github-actions/usage-limits-billing-and-administration

The minimal/recent lock files are handled by CI (`rust.yml`).

## Jobs

Run from `rust.yml` unless stated otherwise. Total 11 jobs.

1. `Stable - minimal`
2. `Stable - recent`
3. `Nightly - minimal`
4. `Nightly - recent`
5. `MSRV - minimal`
6. `MSRV - recent`
7. `Lint`
8. `Docs`
9. `Docsrs`
10. `Format`
11. `Arch32bit`
12. `Cross`
231 changes: 176 additions & 55 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -1,99 +1,220 @@
on: [push, pull_request]
--- # rust-miniscript CI: If you edit this file please update README.md
on: # yamllint disable-line rule:truthy
push:
branches:
- master
- 'test-ci/**'
pull_request:

name: Continuous integration

jobs:
Stable:
Prepare:
runs-on: ubuntu-latest
outputs:
nightly_version: ${{ steps.read_toolchain.outputs.nightly_version }}
steps:
- name: Checkout Crate
uses: actions/checkout@v4
- name: Read nightly version
id: read_toolchain
run: echo "nightly_version=$(cat nightly-version)" >> $GITHUB_OUTPUT

Stable: # 2 jobs, one per lock file.
name: Test - stable toolchain
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
dep: [minimal, recent]
steps:
- name: Checkout Crate
uses: actions/checkout@v3
- name: Checkout Toolchain
# https://github.com/dtolnay/rust-toolchain
- name: "Checkout repo"
uses: actions/checkout@v4
- name: "Checkout maintainer tools"
uses: actions/checkout@v4
with:
repository: rust-bitcoin/rust-bitcoin-maintainer-tools
rev: b2ac115
path: maintainer-tools
- name: "Select toolchain"
uses: dtolnay/rust-toolchain@stable
- name: Running test script
env:
DO_LINT: true
DO_DOCS: true
DO_FEATURE_MATRIX: true
run: ./contrib/test.sh
- name: "Set dependencies"
run: cp Cargo-${{ matrix.dep }}.lock Cargo.lock
- name: "Run test script"
run: ./maintainer-tools/ci/run_task.sh stable

Beta:
name: Test - beta toolchain
Nightly: # 2 jobs, one per lock file.
name: Test - nightly toolchain
needs: Prepare
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
dep: [minimal, recent]
steps:
- name: Checkout Crate
uses: actions/checkout@v3
- name: Checkout Toolchain
uses: dtolnay/rust-toolchain@beta
- name: Running test script
run: ./contrib/test.sh
- name: "Checkout repo"
uses: actions/checkout@v4
- name: "Checkout maintainer tools"
uses: actions/checkout@v4
with:
repository: rust-bitcoin/rust-bitcoin-maintainer-tools
rev: b2ac115
path: maintainer-tools
- name: "Select toolchain"
uses: dtolnay/rust-toolchain@v1
with:
toolchain: ${{ needs.Prepare.outputs.nightly_version }}
- name: "Set dependencies"
run: cp Cargo-${{ matrix.dep }}.lock Cargo.lock
- name: "Run test script"
run: ./maintainer-tools/ci/run_task.sh nightly

Nightly:
name: Test - nightly toolchain
MSRV: # 2 jobs, one per lock file.
name: Test - 1.63.0 toolchain
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
dep: [minimal, recent]
steps:
- name: Checkout Crate
uses: actions/checkout@v3
- name: Checkout Toolchain
uses: dtolnay/rust-toolchain@nightly
- name: Running test script
env:
DO_FMT: true
DO_DOCSRS: true
run: ./contrib/test.sh
- name: "Checkout repo"
uses: actions/checkout@v4
- name: "Checkout maintainer tools"
uses: actions/checkout@v4
with:
repository: rust-bitcoin/rust-bitcoin-maintainer-tools
rev: b2ac115
path: maintainer-tools
- name: "Select toolchain"
uses: dtolnay/rust-toolchain@stable
with:
toolchain: "1.63.0"
- name: "Set dependencies"
run: cp Cargo-${{ matrix.dep }}.lock Cargo.lock
- name: "Run test script"
run: ./maintainer-tools/ci/run_task.sh msrv

MSRV:
name: Test - 1.48.0 toolchain
Lint:
name: Lint - nightly toolchain
needs: Prepare
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
dep: [recent]
steps:
- name: Checkout Crate
uses: actions/checkout@v3
- name: Checkout Toolchain
uses: dtolnay/rust-toolchain@1.48.0
- name: Running test script
env:
DO_FEATURE_MATRIX: true
run: ./contrib/test.sh
- name: "Checkout repo"
uses: actions/checkout@v4
- name: "Checkout maintainer tools"
uses: actions/checkout@v4
with:
repository: rust-bitcoin/rust-bitcoin-maintainer-tools
rev: b2ac115
path: maintainer-tools
- name: "Select toolchain"
uses: dtolnay/rust-toolchain@v1
with:
toolchain: ${{ needs.Prepare.outputs.nightly_version }}
- name: "Install clippy"
run: rustup component add clippy
- name: "Set dependencies"
run: cp Cargo-${{ matrix.dep }}.lock Cargo.lock
- name: "Run test script"
run: ./maintainer-tools/ci/run_task.sh lint

Docs:
name: Docs - stable toolchain
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
dep: [recent]
steps:
- name: "Checkout repo"
uses: actions/checkout@v4
- name: "Checkout maintainer tools"
uses: actions/checkout@v4
with:
repository: rust-bitcoin/rust-bitcoin-maintainer-tools
rev: b2ac115
path: maintainer-tools
- name: "Select toolchain"
uses: dtolnay/rust-toolchain@stable
- name: "Set dependencies"
run: cp Cargo-${{ matrix.dep }}.lock Cargo.lock
- name: "Run test script"
run: ./maintainer-tools/ci/run_task.sh docs

Docsrs:
name: Docs - nightly toolchain
needs: Prepare
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
dep: [recent]
steps:
- name: "Checkout repo"
uses: actions/checkout@v4
- name: "Checkout maintainer tools"
uses: actions/checkout@v4
with:
repository: rust-bitcoin/rust-bitcoin-maintainer-tools
rev: b2ac115
path: maintainer-tools
- name: "Select toolchain"
uses: dtolnay/rust-toolchain@v1
with:
toolchain: ${{ needs.Prepare.outputs.nightly_version }}
- name: "Set dependencies"
run: cp Cargo-${{ matrix.dep }}.lock Cargo.lock
- name: "Run test script"
run: ./maintainer-tools/ci/run_task.sh docsrs

Format: # 1 jobs, run cargo fmt directly.
name: Format - nightly toolchain
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: "Checkout repo"
uses: actions/checkout@v4
- name: "Select toolchain"
uses: dtolnay/rust-toolchain@nightly
- name: "Install rustfmt"
run: rustup component add rustfmt
- name: "Check formatting"
run: cargo +nightly fmt --all -- --check

Arch32bit:
name: Test 32-bit version
runs-on: ubuntu-latest
steps:
- name: Checkout Crate
uses: actions/checkout@v3
- name: Checkout Toolchain
- name: "Checkout repo"
uses: actions/checkout@v4
- name: "Select toolchain"
uses: dtolnay/rust-toolchain@stable
- name: Add architecture i386
- name: "Add architecture i386"
run: sudo dpkg --add-architecture i386
- name: Install i686 gcc
- name: "Install i686 gcc"
run: sudo apt-get update -y && sudo apt-get install -y gcc-multilib
- name: Install target
- name: "Install target"
run: rustup target add i686-unknown-linux-gnu
- name: Run test on i686
- name: "Run test on i686"
run: cargo test --target i686-unknown-linux-gnu

Cross:
name: Cross test
name: Cross test - stable toolchain
if: ${{ !github.event.act }}
runs-on: ubuntu-latest
steps:
- name: Checkout Crate
uses: actions/checkout@v3
- name: Checkout Toolchain
- name: "Checkout repo"
uses: actions/checkout@v4
- name: "Select toolchain"
uses: dtolnay/rust-toolchain@stable
- name: Install target
- name: "Install target"
run: rustup target add s390x-unknown-linux-gnu
- name: install cross
- name: "Install cross"
run: cargo install cross --locked
- name: run cross test
- name: "Run cross test"
run: cross test --target s390x-unknown-linux-gnu
Loading

0 comments on commit 8f17794

Please sign in to comment.