Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic toolchain upgrade improvements #20

Merged
merged 1 commit into from
Aug 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 40 additions & 4 deletions .github/workflows/toolchain-upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,22 @@ on:
- cron: "30 2 * * *" # Run this every day at 02:30 UTC
workflow_dispatch: # Allow manual dispatching for a custom branch / tag.

permissions:
contents: read
issues: write

jobs:
create-toolchain-pr:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Checkout Kani
uses: actions/checkout@v3

- name: Setup Kani Dependencies
uses: ./.github/actions/setup
with:
os: ubuntu-22.04

- name: Update toolchain config
run: |
current_toolchain_date=$(grep ^channel rust-toolchain.toml | sed 's/.*nightly-\(.*\)"/\1/')
Expand All @@ -23,7 +32,7 @@ jobs:
next_toolchain_date=$(date --date "@$(($current_toolchain_epoch + 86400))" +%Y-%m-%d)
echo "next_toolchain_date=$next_toolchain_date" >> $GITHUB_ENV
if ! git ls-remote --exit-code origin toolchain-$next_toolchain_date ; then
echo "branch_exists=false" >> $GITHUB_ENV
echo "next_step=create_pr" >> $GITHUB_ENV
sed -i "/^channel/ s/$current_toolchain_date/$next_toolchain_date/" rust-toolchain.toml
git diff
git clone --filter=tree:0 https://github.com/rust-lang/rust rust.git
Expand All @@ -39,11 +48,18 @@ jobs:
echo "$EOF" >> $GITHUB_ENV
cd ..
rm -rf rust.git
if ! cargo build-dev ; then
echo "next_step=create_issue" >> $GITHUB_ENV
else
if ! ./scripts/kani-regression.sh ; then
echo "next_step=create_issue" >> $GITHUB_ENV
fi
fi
else
echo "branch_exists=true" >> $GITHUB_ENV
echo "next_step=none" >> $GITHUB_ENV
fi
- name: Create Pull Request
if: ${{ env.branch_exists == 'false' }}
if: ${{ env.next_step == 'create_pr' }}
uses: peter-evans/create-pull-request@v5
with:
commit-message: Upgrade Rust toolchain to nightly-${{ env.next_toolchain_date }}
Expand All @@ -61,4 +77,24 @@ jobs:
https://github.com/rust-lang/rust/commit/${{ env.next_toolchain_hash }}. The log
for this commit range is:
${{ 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 }}
Loading