mirror of
https://github.com/Rust-GPU/rust-gpu.git
synced 2026-06-05 00:59:50 +09:00
78 lines
3.2 KiB
YAML
78 lines
3.2 KiB
YAML
name: Rust Toolchain Upgrade
|
|
|
|
on:
|
|
schedule:
|
|
# Run every day at 2 AM UTC
|
|
- cron: '0 2 * * *'
|
|
workflow_dispatch: # Allow manual triggering
|
|
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
|
|
jobs:
|
|
check-and-upgrade:
|
|
runs-on: ubuntu-latest
|
|
if: github.repository == 'Rust-GPU/rust-gpu'
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Check for new nightly
|
|
id: check-nightly
|
|
run: .github/check-rust-toolchain-upgrade.sh
|
|
|
|
- name: Update toolchain files
|
|
if: steps.check-nightly.outputs.SHOULD_UPGRADE == 'true'
|
|
run: |
|
|
NEW_DATE="${{ steps.check-nightly.outputs.NEW_DATE }}"
|
|
NEW_COMMIT_HASH="${{ steps.check-nightly.outputs.NEW_COMMIT_HASH }}"
|
|
|
|
# Update rust-toolchain.toml
|
|
sed -i "s/^channel = \"nightly-[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}\"/channel = \"nightly-${NEW_DATE}\"/" rust-toolchain.toml
|
|
sed -i "s/^# commit_hash = [a-f0-9]\+/# commit_hash = ${NEW_COMMIT_HASH}/" rust-toolchain.toml
|
|
|
|
# Update REQUIRED_RUST_TOOLCHAIN in build.rs
|
|
sed -i "s/^channel = \"nightly-[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}\"/channel = \"nightly-${NEW_DATE}\"/" crates/rustc_codegen_spirv/build.rs
|
|
sed -i "s/^# commit_hash = [a-f0-9]\+/# commit_hash = ${NEW_COMMIT_HASH}/" crates/rustc_codegen_spirv/build.rs
|
|
|
|
- name: Build project
|
|
if: steps.check-nightly.outputs.SHOULD_UPGRADE == 'true'
|
|
run: |
|
|
# The updated rust-toolchain.toml will cause cargo to download the required toolchain
|
|
cargo build
|
|
|
|
- name: Run tests
|
|
if: steps.check-nightly.outputs.SHOULD_UPGRADE == 'true'
|
|
run: |
|
|
cargo compiletest
|
|
|
|
- name: Create Pull Request
|
|
if: steps.check-nightly.outputs.SHOULD_UPGRADE == 'true'
|
|
uses: peter-evans/create-pull-request@v6
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
commit-message: |
|
|
Upgrade Rust toolchain to nightly-${{ steps.check-nightly.outputs.NEW_DATE }}
|
|
|
|
Updates:
|
|
- rust-toolchain.toml: nightly-${{ steps.check-nightly.outputs.NEW_DATE }}
|
|
- commit hash: ${{ steps.check-nightly.outputs.NEW_COMMIT_HASH }}
|
|
- REQUIRED_RUST_TOOLCHAIN in build.rs
|
|
branch: rust-toolchain-upgrade
|
|
delete-branch: true
|
|
title: "Upgrade Rust toolchain to nightly-${{ steps.check-nightly.outputs.NEW_DATE }}"
|
|
body: |
|
|
This PR upgrades the Rust toolchain to the latest available nightly version.
|
|
|
|
## Changes
|
|
- Updated `rust-toolchain.toml` to use `nightly-${{ steps.check-nightly.outputs.NEW_DATE }}`
|
|
- Updated commit hash to `${{ steps.check-nightly.outputs.NEW_COMMIT_HASH }}`
|
|
- Updated `REQUIRED_RUST_TOOLCHAIN` in `crates/rustc_codegen_spirv/build.rs`
|
|
|
|
## Verification
|
|
- All required components are available
|
|
- Project builds successfully
|
|
- Tests pass
|
|
|
|
This PR was automatically generated by the [Rust toolchain upgrade workflow](https://github.com/Rust-GPU/rust-gpu/blob/main/.github/workflows/rust-toolchain-upgrade.yml). |