Skip to content

Commit bf0456d

Browse files
committed
Merge #266: Update cargo-rbmt and fix CI
89f15f4 update rust nightly version to 2026-04-17 (Andrew Poelstra) da385d7 clippy: trivial stuff (Andrew Poelstra) 555270f clippy: use &&, not &, on bools (Andrew Poelstra) b246b93 cron-weekly-update: copy toolchain update files from rust-bitcoin (Andrew Poelstra) e57e698 move nightly-version to Cargo.toml (Andrew Poelstra) 526c950 update Cargo.tomls to whitelist duplicate hex-conservative dep (Andrew Poelstra) 4b5b7c5 update cargo-rbmt (Andrew Poelstra) Pull request description: This overhauls the CI system (again) by copying all the files from rust-bech32 and rust-bitcoin and making minor tweaks for rust-elements. This should fix the `doc_auto_cfg` thing which is plaguing #257, and should overall be much more reliable going forward since it's much more agressive about pinning toolchain versions etc. This does not re-enable the fuzz tests (which were not covered by the previous CI and not covered by this one); do this will require I migrate the old honggfuzz-based fuzz targets to cargo-fuzz ones, and require I migrate the ancient travis-fuzz.sh script to our more modern one. Will do this in a separate PR. ACKs for top commit: delta1: ACK 89f15f4; ran tests locally Tree-SHA512: ee55582f3c8f61a7c3ccde3582d1a207e8d584e4dbbabe38a677c4bf4221d920f0ea5e80fe410ad2828f8e8ee513ad307aa0e47f59fd58725ef2daf78d9ae52c
2 parents 8509b72 + 89f15f4 commit bf0456d

13 files changed

Lines changed: 186 additions & 192 deletions

File tree

.github/actions/checkout-maintainer-tools/action.yml

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,35 @@
11
name: Update Nightly rustc
22
on:
33
schedule:
4-
- cron: "5 0 * * 1" # runs every Monday at 00:05 UTC
4+
- cron: "5 0 * * 6" # Saturday at 00:05
55
workflow_dispatch: # allows manual triggering
6+
permissions: {}
67
jobs:
78
format:
89
name: Update nightly rustc
9-
runs-on: ubuntu-latest
10+
runs-on: ubuntu-24.04
11+
permissions:
12+
contents: write
13+
id-token: write
14+
pull-requests: write
1015
steps:
11-
- uses: actions/checkout@v4
12-
- uses: dtolnay/rust-toolchain@nightly
13-
- name: Update rust.yml to use latest nightly
16+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
17+
with:
18+
persist-credentials: false
19+
- name: Install cargo-rbmt
20+
run: cargo install --git https://github.com/rust-bitcoin/rust-bitcoin-maintainer-tools.git --rev $(cat rbmt-version) cargo-rbmt
21+
- name: Update nightly toolchain in Cargo.toml
1422
run: |
15-
set -x
16-
# Not every night has a nightly, so extract the date from whatever
17-
# version of the compiler dtolnay/rust-toolchain gives us.
18-
NIGHTLY_DATE=$(rustc +nightly --verbose --version | sed -ne 's/^commit-date: //p')
19-
# Update the nightly version in the reference file.
20-
echo "nightly-${NIGHTLY_DATE}" > nightly-version
21-
echo "nightly_date=${NIGHTLY_DATE}" >> $GITHUB_ENV
22-
# Some days there is no new nightly. In this case don't make an empty PR.
23-
if ! git diff --exit-code > /dev/null; then
24-
echo "Updated nightly. Opening PR."
25-
echo "changes_made=true" >> $GITHUB_ENV
26-
else
27-
echo "Attempted to update nightly but the latest-nightly date did not change. Not opening any PR."
28-
echo "changes_made=false" >> $GITHUB_ENV
29-
fi
23+
eval "$(cargo rbmt toolchains --update-nightly)"
24+
echo "nightly_version=$RBMT_NIGHTLY" >> $GITHUB_ENV
3025
- name: Create Pull Request
31-
if: env.changes_made == 'true'
32-
uses: peter-evans/create-pull-request@v6
26+
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
3327
with:
3428
token: ${{ secrets.APOELSTRA_CREATE_PR_TOKEN }}
3529
author: Update Nightly Rustc Bot <bot@example.com>
3630
committer: Update Nightly Rustc Bot <bot@example.com>
37-
title: Automated daily update to rustc (to nightly-${{ env.nightly_date }})
31+
title: Automated daily update to rustc (to ${{ env.nightly_version }})
3832
body: |
39-
Automated update to Github CI workflow `rust.yml` by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action
40-
commit-message: Automated update to Github CI to rustc nightly-${{ env.nightly_date }}
33+
Automated update to Cargo.toml workspace metadata by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action
34+
commit-message: Automated update to rustc ${{ env.nightly_version }}
4135
branch: create-pull-request/daily-nightly-update
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Update Stable rustc
2+
on:
3+
schedule:
4+
- cron: "0 0 * * 5" # runs every Friday at 00:00 (generally rust releases on Thursday)
5+
workflow_dispatch: # allows manual triggering
6+
permissions: {}
7+
jobs:
8+
format:
9+
name: Update stable rustc
10+
runs-on: ubuntu-24.04
11+
permissions:
12+
contents: write
13+
pull-requests: write
14+
steps:
15+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
16+
with:
17+
persist-credentials: false
18+
- name: Install cargo-rbmt
19+
run: cargo install --git https://github.com/rust-bitcoin/rust-bitcoin-maintainer-tools.git --rev $(cat rbmt-version) cargo-rbmt
20+
- name: Update stable toolchain in Cargo.toml
21+
run: |
22+
eval "$(cargo rbmt toolchains --update-stable)"
23+
echo "stable_version=$RBMT_STABLE" >> $GITHUB_ENV
24+
- name: Create Pull Request
25+
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
26+
with:
27+
token: ${{ secrets.APOELSTRA_CREATE_PR_TOKEN }}
28+
author: Update Stable Rustc Bot <bot@example.com>
29+
committer: Update Stable Rustc Bot <bot@example.com>
30+
title: Automated weekly update to rustc stable (to ${{ env.stable_version }})
31+
body: |
32+
Automated update to Cargo.toml workspace metadata by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action
33+
commit-message: Automated update to rustc stable-${{ env.stable_version }}
34+
branch: create-pull-request/weekly-stable-update

.github/workflows/rust.yml

Lines changed: 91 additions & 144 deletions
Original file line numberDiff line numberDiff line change
@@ -1,173 +1,120 @@
1-
on: # yamllint disable-line rule:truthy
2-
pull_request:
3-
push:
4-
branches:
5-
- master
6-
- 'test-ci/**'
1+
on: [push, pull_request]
72

8-
name: Continuous integration
3+
name: Continuous Integration
94

10-
jobs:
11-
Prepare:
12-
runs-on: ubuntu-latest
13-
outputs:
14-
nightly_version: ${{ steps.read_toolchain.outputs.nightly_version }}
15-
msrv_version: ${{ steps.read_msrv.outputs.msrv_version }}
16-
steps:
17-
- name: "Checkout repo"
18-
uses: actions/checkout@v4
19-
- name: "Read nightly version"
20-
id: read_toolchain
21-
run: |
22-
set -euo pipefail
23-
version=$(cat nightly-version)
24-
echo "nightly_version=$version" >> $GITHUB_OUTPUT
25-
- name: Read MSRV from clippy.toml
26-
id: read_msrv
27-
run: |
28-
set -euo pipefail
29-
msrv=$(grep '^msrv *= *"' clippy.toml | sed -E 's/.*"([^"]+)".*/\1/')
30-
echo "msrv_version=$msrv" >> "$GITHUB_OUTPUT"
31-
32-
Stable:
33-
name: Test - stable toolchain
34-
runs-on: ubuntu-latest
35-
strategy:
36-
fail-fast: false
37-
steps:
38-
- name: "Checkout repo"
39-
uses: actions/checkout@v4
40-
- name: "Checkout maintainer tools"
41-
uses: ./.github/actions/checkout-maintainer-tools
42-
- name: "Select toolchain"
43-
uses: dtolnay/rust-toolchain@stable
44-
- name: "Set dependencies"
45-
run: cp Cargo-latest.lock Cargo.lock
46-
- name: "Run test script"
47-
run: ./maintainer-tools/ci/run_task.sh stable
48-
49-
Nightly:
50-
name: Test - nightly toolchain
51-
needs: Prepare
52-
runs-on: ubuntu-latest
53-
strategy:
54-
fail-fast: false
55-
steps:
56-
- name: "Checkout repo"
57-
uses: actions/checkout@v4
58-
- name: "Checkout maintainer tools"
59-
uses: ./.github/actions/checkout-maintainer-tools
60-
- name: "Select toolchain"
61-
uses: dtolnay/rust-toolchain@v1
62-
with:
63-
toolchain: ${{ needs.Prepare.outputs.nightly_version }}
64-
- name: "Set dependencies"
65-
run: cp Cargo-latest.lock Cargo.lock
66-
- name: "Run test script"
67-
run: ./maintainer-tools/ci/run_task.sh nightly
5+
permissions:
6+
contents: read
687

69-
MSRV:
70-
name: Test - MSRV
71-
needs: Prepare
72-
runs-on: ubuntu-latest
8+
jobs:
9+
Test: # 6 jobs: 3 toolchains × 2 lock files.
10+
name: Test - ${{ matrix.toolchain }} toolchain (${{ matrix.dep }})
11+
runs-on: ubuntu-24.04
7312
strategy:
7413
fail-fast: false
14+
matrix:
15+
dep: [recent]
16+
toolchain: [stable, nightly, msrv]
7517
steps:
76-
- name: "Checkout repo"
18+
- name: Checkout repo
7719
uses: actions/checkout@v4
78-
- name: "Checkout maintainer tools"
79-
uses: ./.github/actions/checkout-maintainer-tools
80-
- name: "Select toolchain"
81-
uses: dtolnay/rust-toolchain@stable
82-
with:
83-
toolchain: ${{ needs.Prepare.outputs.msrv_version }}
84-
- name: "Set dependencies"
85-
run: cp Cargo-latest.lock Cargo.lock
86-
- name: "Run test script"
87-
run: ./maintainer-tools/ci/run_task.sh msrv
20+
- uses: rust-bitcoin/rust-bitcoin-maintainer-tools/.github/actions/setup-rbmt@af3c2868415b17eedc808da6d0589e10b7482660 # v0.1.0
21+
- uses: Swatinem/rust-cache@v2
22+
- name: Run ${{ matrix.toolchain }} tests
23+
run: |
24+
export ELEMENTSD_EXE="$PWD/elementsd-tests/bin/elementsd"
25+
if [ "${{ matrix.toolchain }}" = "msrv" ]; then
26+
MSRV="$(cargo rbmt toolchains --msrv)"
27+
cp "Cargo-${{ matrix.dep }}.lock" Cargo.lock
28+
cargo +"$MSRV" test --locked
29+
else
30+
cargo rbmt --lock-file ${{ matrix.dep }} test --toolchain ${{ matrix.toolchain }}
31+
fi
8832
8933
Lint:
9034
name: Lint - nightly toolchain
91-
needs: Prepare
92-
runs-on: ubuntu-latest
93-
strategy:
94-
fail-fast: false
95-
matrix:
96-
dep: [recent]
35+
runs-on: ubuntu-24.04
9736
steps:
98-
- name: "Checkout repo"
37+
- name: Checkout Crate
9938
uses: actions/checkout@v4
100-
- name: "Checkout maintainer tools"
101-
uses: ./.github/actions/checkout-maintainer-tools
102-
- name: "Select toolchain"
103-
uses: dtolnay/rust-toolchain@v1
104-
with:
105-
toolchain: ${{ needs.Prepare.outputs.nightly_version }}
106-
- name: Install clippy
107-
run: rustup component add clippy
108-
- name: "Set dependencies"
109-
run: cp Cargo-latest.lock Cargo.lock
110-
- name: "Run test script"
111-
run: ./maintainer-tools/ci/run_task.sh lint
39+
- uses: rust-bitcoin/rust-bitcoin-maintainer-tools/.github/actions/setup-rbmt@af3c2868415b17eedc808da6d0589e10b7482660 # v0.1.0
40+
- uses: Swatinem/rust-cache@v2
41+
- name: Run lints
42+
run: cargo rbmt --lock-file recent lint
11243

11344
Docs:
11445
name: Docs - stable toolchain
115-
runs-on: ubuntu-latest
116-
strategy:
117-
fail-fast: false
118-
matrix:
119-
dep: [recent]
46+
runs-on: ubuntu-24.04
12047
steps:
121-
- name: "Checkout repo"
48+
- name: Checkout Crate
12249
uses: actions/checkout@v4
123-
- name: "Checkout maintainer tools"
124-
uses: ./.github/actions/checkout-maintainer-tools
125-
- name: "Select toolchain"
126-
uses: dtolnay/rust-toolchain@stable
127-
- name: "Set dependencies"
128-
run: cp Cargo-latest.lock Cargo.lock
129-
- name: "Run test script"
130-
run: ./maintainer-tools/ci/run_task.sh docs
50+
- uses: rust-bitcoin/rust-bitcoin-maintainer-tools/.github/actions/setup-rbmt@af3c2868415b17eedc808da6d0589e10b7482660 # v0.1.0
51+
- uses: Swatinem/rust-cache@v2
52+
- name: Run doc tests
53+
run: cargo rbmt --lock-file recent docs
13154

13255
Docsrs:
13356
name: Docs - nightly toolchain
134-
needs: Prepare
135-
runs-on: ubuntu-latest
136-
strategy:
137-
fail-fast: false
138-
matrix:
139-
dep: [recent]
57+
runs-on: ubuntu-24.04
14058
steps:
141-
- name: "Checkout repo"
59+
- name: Checkout Crate
14260
uses: actions/checkout@v4
143-
- name: "Checkout maintainer tools"
144-
uses: ./.github/actions/checkout-maintainer-tools
145-
- name: "Select toolchain"
146-
uses: dtolnay/rust-toolchain@v1
147-
with:
148-
toolchain: ${{ needs.Prepare.outputs.nightly_version }}
149-
- name: "Set dependencies"
150-
run: cp Cargo-latest.lock Cargo.lock
151-
- name: "Run test script"
152-
run: ./maintainer-tools/ci/run_task.sh docsrs
61+
- uses: rust-bitcoin/rust-bitcoin-maintainer-tools/.github/actions/setup-rbmt@af3c2868415b17eedc808da6d0589e10b7482660 # v0.1.0
62+
- uses: Swatinem/rust-cache@v2
63+
- name: Run docsrs tests
64+
run: cargo rbmt --lock-file recent docsrs
15365

154-
# Format:
66+
# Format: # 1 job, run cargo fmt directly.
15567
# name: Format - nightly toolchain
156-
# needs: Prepare
157-
# runs-on: ubuntu-latest
158-
# strategy:
159-
# fail-fast: false
68+
# runs-on: ubuntu-24.04
16069
# steps:
161-
# - name: "Checkout repo"
70+
# - name: Checkout Crate
16271
# uses: actions/checkout@v4
163-
# - name: "Select toolchain"
164-
# uses: dtolnay/rust-toolchain@v1
165-
# with:
166-
# toolchain: ${{ needs.Prepare.outputs.nightly_version }}
167-
# - name: "Install rustfmt"
168-
# run: rustup component add rustfmt
169-
# - name: "Check formatting"
170-
# run: cargo fmt --all -- --check
72+
# - uses: rust-bitcoin/rust-bitcoin-maintainer-tools/.github/actions/setup-rbmt@af3c2868415b17eedc808da6d0589e10b7482660 # v0.1.0
73+
# - name: Check formatting
74+
# run: cargo rbmt --lock-file recent fmt --check
75+
76+
Bench:
77+
name: Bench - nightly toolchain
78+
runs-on: ubuntu-24.04
79+
steps:
80+
- name: Checkout Crate
81+
uses: actions/checkout@v4
82+
- uses: rust-bitcoin/rust-bitcoin-maintainer-tools/.github/actions/setup-rbmt@af3c2868415b17eedc808da6d0589e10b7482660 # v0.1.0
83+
- uses: Swatinem/rust-cache@v2
84+
- name: Run benches
85+
run: cargo rbmt --lock-file recent bench
86+
87+
Arch32bit:
88+
name: Test 32-bit version
89+
runs-on: ubuntu-24.04
90+
steps:
91+
- name: Checkout Crate
92+
uses: actions/checkout@v4
93+
- name: Checkout Toolchain
94+
uses: dtolnay/rust-toolchain@stable
95+
- name: Add architecture i386
96+
run: sudo dpkg --add-architecture i386
97+
- name: Install i686 gcc
98+
run: sudo apt-get update -y && sudo apt-get install -y gcc-multilib
99+
- name: Install target
100+
run: rustup target add i686-unknown-linux-gnu
101+
- name: Run tests on i686
102+
run: cargo test --target i686-unknown-linux-gnu
103+
104+
Cross:
105+
name: Cross test
106+
runs-on: ubuntu-24.04
107+
steps:
108+
- name: Checkout Crate
109+
uses: actions/checkout@v4
110+
- name: Checkout Toolchain
111+
uses: dtolnay/rust-toolchain@stable
112+
- name: Install target
113+
run: rustup target add s390x-unknown-linux-gnu
114+
- name: install cross
115+
run: cargo install cross --locked
116+
- name: run cross test
117+
run: cross test --target s390x-unknown-linux-gnu
171118

172119
Wasm:
173120
name: Check WASM
File renamed without changes.

0 commit comments

Comments
 (0)