Skip to content

ci: pin nightly rust compiler version #799

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/cron-weekly-update-nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Update Nightly rustc
on:
schedule:
- cron: "5 0 * * 6" # Saturday at 00:05
workflow_dispatch: # allows manual triggering
jobs:
format:
name: Update nightly rustc
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- name: Update rust.yml to use latest nightly
run: |
set -x
# Not every night has a nightly, so extract the date from whatever
# version of the compiler dtolnay/rust-toolchain gives us.
NIGHTLY_DATE=$(rustc +nightly --verbose --version | sed -ne 's/^commit-date: //p')
# Update the nightly version in the reference file.
echo "nightly-${NIGHTLY_DATE}" > nightly-version
echo "nightly_date=${NIGHTLY_DATE}" >> $GITHUB_ENV
# Some days there is no new nightly. In this case don't make an empty PR.
if ! git diff --exit-code > /dev/null; then
echo "Updated nightly. Opening PR."
echo "changes_made=true" >> $GITHUB_ENV
else
echo "Attempted to update nightly but the latest-nightly date did not change. Not opening any PR."
echo "changes_made=false" >> $GITHUB_ENV
fi
- name: Create Pull Request
if: env.changes_made == 'true'
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.APOELSTRA_CREATE_PR_TOKEN }}
author: Update Nightly Rustc Bot <[email protected]>
committer: Update Nightly Rustc Bot <[email protected]>
title: Automated daily update to rustc (to nightly-${{ env.nightly_date }})
body: |
Automated update to Github CI workflow `rust.yml` by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action
commit-message: Automated update to Github CI to rustc nightly-${{ env.nightly_date }}
branch: create-pull-request/daily-nightly-update
52 changes: 39 additions & 13 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,17 @@ on: # yamllint disable-line rule:truthy
name: Continuous integration

jobs:
Prepare:
runs-on: ubuntu-24.04
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 lock file.
name: Test - stable toolchain
runs-on: ubuntu-latest
Expand All @@ -23,7 +34,7 @@ jobs:
uses: actions/checkout@v4
with:
repository: rust-bitcoin/rust-bitcoin-maintainer-tools
rev: b2ac115
ref: c3324024ced9bb1eb854397686919c3ff7d97e1e
path: maintainer-tools
- name: "Select toolchain"
uses: dtolnay/rust-toolchain@stable
Expand All @@ -34,6 +45,7 @@ jobs:

Nightly: # 2 jobs, one per lock file.
name: Test - nightly toolchain
needs: Prepare
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand All @@ -46,10 +58,12 @@ jobs:
uses: actions/checkout@v4
with:
repository: rust-bitcoin/rust-bitcoin-maintainer-tools
rev: b2ac115
ref: c3324024ced9bb1eb854397686919c3ff7d97e1e
path: maintainer-tools
- name: "Select toolchain"
uses: dtolnay/rust-toolchain@nightly
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"
Expand All @@ -69,7 +83,7 @@ jobs:
uses: actions/checkout@v4
with:
repository: rust-bitcoin/rust-bitcoin-maintainer-tools
rev: b2ac115
ref: c3324024ced9bb1eb854397686919c3ff7d97e1e
path: maintainer-tools
- name: "Select toolchain"
uses: dtolnay/rust-toolchain@stable
Expand All @@ -82,6 +96,7 @@ jobs:

Lint:
name: Lint - nightly toolchain
needs: Prepare
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand All @@ -94,10 +109,12 @@ jobs:
uses: actions/checkout@v4
with:
repository: rust-bitcoin/rust-bitcoin-maintainer-tools
rev: b2ac115
ref: c3324024ced9bb1eb854397686919c3ff7d97e1e
path: maintainer-tools
- name: "Select toolchain"
uses: dtolnay/rust-toolchain@nightly
uses: dtolnay/rust-toolchain@v1
with:
toolchain: ${{ needs.Prepare.outputs.nightly_version }}
- name: "Install clippy"
run: rustup component add clippy
- name: "Set dependencies"
Expand All @@ -119,7 +136,7 @@ jobs:
uses: actions/checkout@v4
with:
repository: rust-bitcoin/rust-bitcoin-maintainer-tools
rev: b2ac115
ref: c3324024ced9bb1eb854397686919c3ff7d97e1e
path: maintainer-tools
- name: "Select toolchain"
uses: dtolnay/rust-toolchain@stable
Expand All @@ -130,6 +147,7 @@ jobs:

Docsrs:
name: Docs - nightly toolchain
needs: Prepare
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand All @@ -142,17 +160,20 @@ jobs:
uses: actions/checkout@v4
with:
repository: rust-bitcoin/rust-bitcoin-maintainer-tools
rev: b2ac115
ref: c3324024ced9bb1eb854397686919c3ff7d97e1e
path: maintainer-tools
- name: "Select toolchain"
uses: dtolnay/rust-toolchain@nightly
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

Bench:
name: Bench - nightly toolchain
needs: Prepare
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand All @@ -165,29 +186,34 @@ jobs:
uses: actions/checkout@v4
with:
repository: rust-bitcoin/rust-bitcoin-maintainer-tools
rev: b2ac115
ref: c3324024ced9bb1eb854397686919c3ff7d97e1e
path: maintainer-tools
- name: "Select toolchain"
uses: dtolnay/rust-toolchain@nightly
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 bench

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

Integration: # 1 job for each bitcoind version we support.
name: Integration tests - stable toolchain
Expand Down
1 change: 1 addition & 0 deletions nightly-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nightly-2025-03-21
Loading