-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ci] Roll pinned nightly toolchain automatically
Closes #348
- Loading branch information
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: Roll pinned toolchain versions | ||
on: | ||
schedule: | ||
- cron: '29 15 * * *' | ||
# TODO: Remove this before merging!!! | ||
pull_request: | ||
|
||
# TODO: Once we confirm this works, try changing this to `read-all` to see if | ||
# the job still works. | ||
permissions: write-all | ||
|
||
jobs: | ||
roll: | ||
name: Roll pinned toolchain versions | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: "Checkout code" | ||
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 | ||
# TODO: Once we confirm this works, try uncommenting this to see if the | ||
# job still works. | ||
# with: | ||
# persist-credentials: false | ||
- name: "Calculate target version" | ||
# Use yesterday's date (`-d '-1 day'`) so we're sure the nightly for that | ||
# date has actually been published yet. This allows us to not worry | ||
# about what time of day this job runs. | ||
run: echo "ZC_TARGET_NIGHTLY='nightly-$(date -d '-1 day' +%Y-%m-%d)'" >> $GITHUB_ENV | ||
- name: Install Rust with ${{ env.ZC_TARGET_NIGHTLY }} toolchain | ||
uses: dtolnay/rust-toolchain@00b49be78f40fba4e87296b2ead62868750bdd83 # stable | ||
with: | ||
toolchain: ${{ env.ZC_TARGET_NIGHTLY }} | ||
- name: "Update files" | ||
run: | | ||
set -eo pipefail | ||
# Confirm that `Cargo.toml` lists the pinned nightly version in the | ||
# expected format. This is a prerequisite for the subsequent `sed` | ||
# command. If this fails, the preceding `set -eo pipefail` will cause | ||
# the script to exit with an error. | ||
REGEX='^pinned-nightly = "[a-z0-9-]*"$' | ||
grep "$REGEX" Cargo.toml >/dev/null | ||
sed -i '' -e "s/$REGEX/pinned-nightly = \"$ZC_TARGET_NIGHTLY\"/" Cargo.toml | ||
# Confirm that the update didn't bork `Cargo.toml`. | ||
grep "$REGEX" Cargo.toml >/dev/null | ||
# Update `.stderr` files as needed for the new nightly version. | ||
TRYBUILD=overwrite ./cargo.sh +nightly test --all-features --package zerocopy | ||
TRYBUILD=overwrite ./cargo.sh +nightly test --all-features --package zerocopy-derive | ||
- name: "Submit PR" | ||
uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 # v5.0.2 | ||
with: | ||
commit-message: "[ci] Roll pinned nightly toolchain" |