Skip to content

Commit 437c0c6

Browse files
committed
Merge #259: ci: unify nightly versions in Cargo.toml
b8a32c9 ci: unify nightly embedded version on Cargo.toml (satsfy (Renato Britto)) a924cdc ci: migrate nightly update to rbmt on Cargo.toml (satsfy (Renato Britto)) Pull request description: Follow up from #254 (comment) After the rbmt CI migration, most jobs were already consuming nightly from `[package.metadata.rbmt.toolchains]` in `Cargo.toml`, but the weekly updater still wrote `nightly-version`. This change makes `Cargo.toml` the single nightly source of truth across the updater and CI jobs. Changes: - update weekly nightly cron to use `cargo rbmt toolchains --update-nightly.` Replicates rust-bitcoin CI closely. - `nightly-version` removed. - migrate Embedded CI job to read nightly from `Cargo.toml` instead of `nightly-version.` Validated in personal fork CI: - The CI run (didn't create the PR because it wasn't allowed): https://github.com/satsfy/rust-bech32/actions/runs/24799694669/job/72578713007 - PR produced: https://github.com/satsfy/rust-bech32/compare/master...satsfy:rust-bech32:create-pull-request/weekly-nightly-update?expand=1 ACKs for top commit: apoelstra: ACK b8a32c9; successfully ran local tests Tree-SHA512: f2381f1c13eaebcb6e256bf82ee110dab9bf1fe2615a0075b9953e0fd808d4b8f94f1f49568522dc99193f6e1a5ae9619a60cf3b77c084027d9236a8fa206bf1
2 parents cc44a3c + b8a32c9 commit 437c0c6

3 files changed

Lines changed: 21 additions & 28 deletions

File tree

.github/workflows/cron-weekly-update-nightly.yml

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,39 +3,33 @@ on:
33
schedule:
44
- 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+
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@v7
26+
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
3327
with:
3428
token: ${{ secrets.APOELSTRA_RUST_BITCOIN_ORG_CREATE_PR }}
3529
author: Update Nightly Rustc Bot <bot@example.com>
3630
committer: Update Nightly Rustc Bot <bot@example.com>
37-
title: Automated update to nightly-version (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 }}
41-
branch: create-pull-request/weekly-nightly-update
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 }}
35+
branch: create-pull-request/daily-nightly-update

.github/workflows/rust.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ jobs:
9999
uses: actions/checkout@v4
100100
- name: Set up QEMU
101101
run: sudo apt-get update -y && sudo apt-get install -y qemu-system-arm gcc-arm-none-eabi
102-
- name: Read nightly version
102+
- name: Read nightly version from Cargo.toml
103103
id: nightly
104-
run: echo "version=$(cat nightly-version)" >> $GITHUB_OUTPUT
104+
run: echo "version=$(cargo metadata --format-version 1 --no-deps | jq -r '.packages[0].metadata.rbmt.toolchains.nightly')" >> "$GITHUB_OUTPUT"
105105
- name: Checkout Toolchain
106106
uses: dtolnay/rust-toolchain@v1
107107
with:

nightly-version

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)