From 76c4a503912c56fc97ee36402774299e732f3155 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Sun, 29 Dec 2024 12:46:14 +1100 Subject: [PATCH] Add CI by way of rust-bitcoin-maintainer-tools As we do in other crates implement CI using the `rust-bitcoin-maintainer-tools` `run_task.sh` script. --- .github/workflows/README.md | 23 +++++ .github/workflows/rust.yml | 172 ++++++++++++++++++++++++++++++++++++ Cargo-minimal.lock | 7 ++ Cargo-recent.lock | 7 ++ contrib/crates.sh | 8 ++ nightly-version | 1 + 6 files changed, 218 insertions(+) create mode 100644 .github/workflows/README.md create mode 100644 .github/workflows/rust.yml create mode 100644 Cargo-minimal.lock create mode 100644 Cargo-recent.lock create mode 100644 contrib/crates.sh create mode 100644 nightly-version diff --git a/.github/workflows/README.md b/.github/workflows/README.md new file mode 100644 index 0000000..5104b0b --- /dev/null +++ b/.github/workflows/README.md @@ -0,0 +1,23 @@ +# rust-bitcoin 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. Unfortunately we are now exceeding the 20 job target. +(Prepare is quick and must be run first anyway.) + +0. `Prepare` +1. `Stable - minimal` +2. `Stable - recent` +3. `Nightly - minimal` +4. `Nightly - recent` +5. `MSRV - minimal` +6. `MSRV - recent` +7. `Lint` +8. `Docs` +9. `Docsrs` diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml new file mode 100644 index 0000000..3e850bc --- /dev/null +++ b/.github/workflows/rust.yml @@ -0,0 +1,172 @@ +--- # rust-ordered 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: + Prepare: + runs-on: ubuntu-latest + outputs: + nightly_version: ${{ steps.read_toolchain.outputs.nightly_version }} + steps: + - name: "Checkout repo" + 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 manifest. + name: Test - stable toolchain + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + dep: [minimal, 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 + ref: 4f17a059a2f57c1b99b7c240a1467a5c0acebdc3 + 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 stable + + Nightly: # 2 jobs, one per manifest. + name: Test - nightly toolchain + needs: Prepare + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + dep: [minimal, 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 + ref: 4f17a059a2f57c1b99b7c240a1467a5c0acebdc3 + 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 + + MSRV: # 2 jobs, one per manifest. + name: Test - MSRV toolchain + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + dep: [minimal, 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 + ref: 4f17a059a2f57c1b99b7c240a1467a5c0acebdc3 + 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 + + Lint: + name: Lint - 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 + ref: 4f17a059a2f57c1b99b7c240a1467a5c0acebdc3 + 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 + ref: 4f17a059a2f57c1b99b7c240a1467a5c0acebdc3 + 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 + ref: 4f17a059a2f57c1b99b7c240a1467a5c0acebdc3 + 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 diff --git a/Cargo-minimal.lock b/Cargo-minimal.lock new file mode 100644 index 0000000..1e49a0a --- /dev/null +++ b/Cargo-minimal.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "ordered" +version = "0.2.2" diff --git a/Cargo-recent.lock b/Cargo-recent.lock new file mode 100644 index 0000000..1e49a0a --- /dev/null +++ b/Cargo-recent.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "ordered" +version = "0.2.2" diff --git a/contrib/crates.sh b/contrib/crates.sh new file mode 100644 index 0000000..18b0caa --- /dev/null +++ b/contrib/crates.sh @@ -0,0 +1,8 @@ +# No shebang, this file should not be executed. +# shellcheck disable=SC2148 +# +# disable verify unused vars, despite the fact that they are used when sourced +# shellcheck disable=SC2034 + +# Crates in this workspace to test. +CRATES=(".") diff --git a/nightly-version b/nightly-version new file mode 100644 index 0000000..5de8e30 --- /dev/null +++ b/nightly-version @@ -0,0 +1 @@ +nightly-2024-12-26