Skip to content

Commit

Permalink
Pin CI fuzzing job nightly versions and add CI job to update them bi-…
Browse files Browse the repository at this point in the history
…weekly (#1202)

* use pinned nightly release in fuzzing CI jobs

* add CI job to update nightly fuzz version every 2 weeks

* add some docs and comments

* try to use nightly from 3 days ago

* try out less recent pinned nightly

* properly use toolchain field

* update script to reflect changes

* use normal tagged nightly release in updater CI workflow

* add comments about nightly pinning
  • Loading branch information
Robbepop authored Sep 27, 2024
1 parent b918b25 commit 2c95e64
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 3 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,10 @@ jobs:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
with:
submodules: true
- uses: dtolnay/rust-toolchain@nightly
- uses: dtolnay/rust-toolchain@master
with:
# Pin nightly so that it does not invalidate GitHub Actions cache too frequently.
toolchain: nightly-2024-09-24
- name: Set up Rust cache
uses: Swatinem/rust-cache@v2
with:
Expand All @@ -231,7 +234,10 @@ jobs:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
with:
submodules: true
- uses: dtolnay/rust-toolchain@nightly
- uses: dtolnay/rust-toolchain@master
with:
# Pin nightly so that it does not invalidate GitHub Actions cache too frequently.
toolchain: nightly-2024-09-24
- name: Set up Rust cache
uses: Swatinem/rust-cache@v2
with:
Expand All @@ -254,7 +260,10 @@ jobs:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
with:
submodules: true
- uses: dtolnay/rust-toolchain@nightly
- uses: dtolnay/rust-toolchain@master
with:
# Pin nightly so that it does not invalidate GitHub Actions cache too frequently.
toolchain: nightly-2024-09-24
- name: Set up Rust cache
uses: Swatinem/rust-cache@v2
with:
Expand Down
44 changes: 44 additions & 0 deletions .github/workflows/update-nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# GitHub Actions CI job to update the Rust toolchain nightly versions used in `rust.yml` every 2 weeks.
#
# Note: This particularly affects the fuzzing CI jobs that have to pin a nightly
# release in order to not invalidate their caches on a daily basis.

name: Update Rust Nightly Version

on:
schedule:
- cron: '0 0 */14 * *' # Every 2 weeks
workflow_dispatch: # Allows to trigger this CI job via GitHub UI

jobs:
update-nightly:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install the latest Rust nightly
uses: dtolnay/rust-toolchain@nightly

- name: Get the latest Rust nightly version
run: |
# Fetch the Rust version, e.g., rustc 1.81.0-nightly (eeb90cda1 2024-09-04)
RUSTC_VERSION=$(rustc --version)
echo "Rustc Version: $RUSTC_VERSION"
# Extract the nightly version date (2024-09-04)
LATEST_NIGHTLY=$(echo $RUSTC_VERSION | grep -Po '\d{4}-\d{2}-\d{2}')
echo "LATEST_NIGHTLY=$LATEST_NIGHTLY" >> $GITHUB_ENV
- name: Update nightly version in CI workflow
run: |
FILE=".github/workflows/rust.yml"
sed -i "s/toolchain: nightly-[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}/toolchain: nightly-$LATEST_NIGHTLY/" $FILE
- name: Commit and push changes
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add .github/workflows/rust.yml
git commit -m "Update Rust nightly version to $LATEST_NIGHTLY"
git push

0 comments on commit 2c95e64

Please sign in to comment.