Skip to content

Commit 8656094

Browse files
authored
Roll stable and nightly toolchains separately (#446)
This should allow the stable toolchain to roll successfully sooner after it's released. Previously, both toolchains were rolled together, which meant that when the nightly roll failed (frequent thanks to most nightlies missing at least one target architecture we use in CI), the stable roll would fail too.
1 parent 808ad38 commit 8656094

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

.github/workflows/roll-pinned-toolchain-versions.yml

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,11 @@ permissions: read-all
1717

1818
jobs:
1919
roll:
20-
name: Roll pinned toolchain versions
2120
runs-on: ubuntu-latest
21+
strategy:
22+
matrix:
23+
toolchain: ["stable", "nightly"]
24+
name: Roll pinned toolchain ${{ matrix.toolchain }} version
2225
steps:
2326
- name: Checkout code
2427
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
@@ -30,17 +33,20 @@ jobs:
3033
# date has actually been published yet. This allows us to not worry
3134
# about what time of day this job runs.
3235
run: echo "ZC_TARGET_NIGHTLY=nightly-$(date -d '-1 day' +%Y-%m-%d)" >> $GITHUB_ENV
36+
if: matrix.toolchain == 'nightly'
3337
- name: Install Rust with ${{ env.ZC_TARGET_NIGHTLY }} toolchain
3438
uses: dtolnay/rust-toolchain@00b49be78f40fba4e87296b2ead62868750bdd83 # stable
3539
with:
3640
toolchain: ${{ env.ZC_TARGET_NIGHTLY }}
41+
if: matrix.toolchain == 'nightly'
3742
# Install whatever the latest stable release is. This has the side
3843
# effect of determining the latest stable release so that we can update
3944
# `Cargo.toml`.
4045
- name: Install Rust with stable toolchain
4146
uses: dtolnay/rust-toolchain@00b49be78f40fba4e87296b2ead62868750bdd83 # stable
4247
with:
4348
toolchain: stable
49+
if: matrix.toolchain == 'stable'
4450
- name: Update files
4551
run: |
4652
set -eo pipefail
@@ -74,20 +80,24 @@ jobs:
7480
TRYBUILD=overwrite cargo "+$VERSION_FOR_CARGO" test --package zerocopy-derive
7581
}
7682
77-
STABLE_VERSION="$(cargo +stable version | sed -e 's/^cargo \([0-9\.]*\) .*/\1/')"
78-
update-pinned-version stable "$STABLE_VERSION" stable '--features __internal_use_only_features_that_work_on_stable'
79-
update-pinned-version nightly "$ZC_TARGET_NIGHTLY" "$ZC_TARGET_NIGHTLY" --all-features
83+
if [ "${{ matrix.toolchain }}" == stable ]; then
84+
STABLE_VERSION="$(cargo +stable version | sed -e 's/^cargo \([0-9\.]*\) .*/\1/')"
85+
update-pinned-version stable "$STABLE_VERSION" stable '--features __internal_use_only_features_that_work_on_stable'
8086
81-
# Used as part of the branch name created by the "Submit PR" step.
82-
echo "ZC_TARGET_STABLE=$STABLE_VERSION" >> $GITHUB_ENV
87+
# Used as part of the branch name created by the "Submit PR" step.
88+
echo "ZC_VERSION_FOR_BRANCH_NAME=$STABLE_VERSION" >> $GITHUB_ENV
89+
else
90+
update-pinned-version nightly "$ZC_TARGET_NIGHTLY" "$ZC_TARGET_NIGHTLY" --all-features
91+
echo "ZC_VERSION_FOR_BRANCH_NAME=$ZC_TARGET_NIGHTLY" >> $GITHUB_ENV
92+
fi
8393
8494
- name: Submit PR
8595
uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 # v5.0.2
8696
with:
87-
commit-message: "[ci] Roll pinned toolchains"
97+
commit-message: "[ci] Roll pinned ${{ matrix.toolchain }} toolchain"
8898
author: Google PR Creation Bot <github-pull-request-creation-bot@google.com>
8999
committer: Google PR Creation Bot <github-pull-request-creation-bot@google.com>
90-
title: "[ci] Roll pinned toolchains"
91-
branch: roll-pinned-toolchain-to-${{ env.ZC_TARGET_STABLE }}-and-${{ env.ZC_TARGET_NIGHTLY }}
100+
title: "[ci] Roll pinned ${{ matrix.toolchain }} toolchain"
101+
branch: roll-pinned-${{ matrix.toolchain }}-toolchain-to-${{ env.ZC_VERSION_FOR_BRANCH_NAME }}
92102
push-to-fork: google-pr-creation-bot/zerocopy
93103
token: ${{ secrets.GOOGLE_PR_CREATION_BOT_TOKEN }}

0 commit comments

Comments
 (0)