Attempt toolchain update #617
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
# Copyright Kani Contributors | |
# SPDX-License-Identifier: Apache-2.0 OR MIT | |
name: Attempt toolchain update | |
on: | |
schedule: | |
- cron: "30 2 * * *" # Run this every day at 02:30 UTC | |
workflow_dispatch: # Allow manual dispatching for a custom branch / tag. | |
permissions: | |
checks: write | |
contents: write | |
issues: write | |
pull-requests: write | |
jobs: | |
create-toolchain-pr: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout Kani | |
uses: actions/checkout@v4 | |
- name: Setup Kani Dependencies | |
uses: ./.github/actions/setup | |
with: | |
os: ubuntu-22.04 | |
- name: Update toolchain config | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
source scripts/toolchain_update.sh | |
- name: Clean untracked files | |
run: git clean -f | |
- name: Create Pull Request | |
id: create_pr | |
if: ${{ env.next_step == 'create_pr' }} | |
uses: peter-evans/create-pull-request@v7 | |
with: | |
commit-message: Upgrade Rust toolchain to nightly-${{ env.next_toolchain_date }} | |
branch: toolchain-${{ env.next_toolchain_date }} | |
delete-branch: true | |
title: 'Automatic toolchain upgrade to nightly-${{ env.next_toolchain_date }}' | |
body: > | |
Update Rust toolchain from nightly-${{ env.current_toolchain_date }} to | |
nightly-${{ env.next_toolchain_date }} without any other source changes. | |
- name: Add debugging hints | |
if: ${{ steps.create_pr.outputs.pull-request-number }} | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
github.rest.issues.createComment({ | |
issue_number: ${{ steps.create_pr.outputs.pull-request-number }}, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: `This is an automatically generated pull request. If any of the CI checks fail, | |
manual intervention is required. In such a case, review the changes at | |
https://github.com/rust-lang/rust from | |
https://github.com/rust-lang/rust/commit/${{ env.current_toolchain_hash }} up to | |
https://github.com/rust-lang/rust/commit/${{ env.next_toolchain_hash }}. The log | |
for this commit range is: | |
` + process.env.git_log | |
}) | |
- name: Create Issue | |
if: ${{ env.next_step == 'create_issue' }} | |
uses: dacbd/create-issue-action@main | |
with: | |
token: ${{ github.token }} | |
title: 'Toolchain upgrade to nightly-${{ env.next_toolchain_date }} failed' | |
body: > | |
Updating Rust toolchain from nightly-${{ env.current_toolchain_date }} to | |
nightly-${{ env.next_toolchain_date }} requires source changes. | |
The failed automated run | |
[can be found here.](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) | |
Please review the changes at | |
https://github.com/rust-lang/rust from | |
https://github.com/rust-lang/rust/commit/${{ env.current_toolchain_hash }} up to | |
https://github.com/rust-lang/rust/commit/${{ env.next_toolchain_hash }}. The log | |
for this commit range is: | |
${{ env.git_log }} |