-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5c77d7a
commit 48d94bd
Showing
1 changed file
with
52 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,52 @@ | ||
# Opens a PR to update the nightly Rust version every two weeks | ||
name: Rust Version Check | ||
|
||
on: | ||
push: | ||
branches: | ||
- "ci-rust-version" | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '0 0 1,15 * *' | ||
|
||
jobs: | ||
rust-version-check: | ||
runs-on: ubuntu-latest | ||
matrix: | ||
strategy: | ||
package: ["aptos", "ethereum"] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: dtolnay/rust-toolchain@nightly | ||
- name: Parse rust-toolchain.toml | ||
run: echo "TOOLCHAIN_VERSION=$(rustup show | grep rustc | awk -F'[()]| ' '{ print $(NF-1) }')" | tee -a $GITHUB_ENV | ||
working-directory: ${{ github.workspace }}/${{ matrix.package }} | ||
- name: Get latest nightly Rust version | ||
run: | | ||
echo "RUST_VERSION=$(rustup check | grep nightly | awk -F'[()]| ' '{print $(NF-1)}')" | tee -a $GITHUB_ENV | ||
- name: Compare Rust versions | ||
id: compare-versions | ||
run: | | ||
if [[ $(printf '%s\n' "$TOOLCHAIN_VERSION" "$RUST_VERSION" | sort -V | head -n 1) != "$RUST_VERSION" ]]; then | ||
echo "outdated=true" | tee -a $GITHUB_OUTPUT | ||
fi | ||
working-directory: ${{ github.workspace }}/${{ matrix.package }} | ||
- name: Update Cargo.toml | ||
if: steps.compare-versions.outputs.outdated == 'true' | ||
run: | | ||
sed -i 's/channel = .*/channel = "nightly-${{ env.RUST_VERSION }}"/' rust-toolchain.toml | ||
working-directory: ${{ github.workspace }}/${{ matrix.package }} | ||
# Open PR if Rust version is out of date with latest nightly | ||
- name: Create Pull Request | ||
if: steps.compare-versions.outputs.outdated == 'true' | ||
uses: peter-evans/create-pull-request@v6 | ||
with: | ||
branch: "ci-update-rust-version-${{ matrix.package }}" | ||
title: "chore: Update `${{ matrix.package }}` Rust version to nightly-${{ env.RUST_VERSION }}" | ||
commit-message: "chore: Update `${{ matrix.package }}` Rust version to nightly-${{ env.RUST_VERSION }}" | ||
labels: "automated-issue" | ||
#reviewers: "tchataigner, wwared, storojs72, huitseeker, samuelburnham" | ||
body: | | ||
This is an automated PR updating the `${{ matrix.package }}` Rust version from `nightly-${{ env.TOOLCHAIN_VERSION }}` to `nightly-${{ env.RUST_VERSION }}` | ||
Workflow run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} |