8
8
- cron : " 30 2 * * *" # Run this every day at 02:30 UTC
9
9
workflow_dispatch : # Allow manual dispatching for a custom branch / tag.
10
10
11
+ permissions :
12
+ contents : read
13
+ issues : write
14
+
11
15
jobs :
12
16
create-toolchain-pr :
13
- runs-on : ubuntu-latest
17
+ runs-on : ubuntu-22.04
14
18
steps :
15
19
- name : Checkout Kani
16
20
uses : actions/checkout@v3
17
21
22
+ - name : Setup Kani Dependencies
23
+ uses : ./.github/actions/setup
24
+ with :
25
+ os : ubuntu-22.04
26
+
18
27
- name : Update toolchain config
19
28
run : |
20
29
current_toolchain_date=$(grep ^channel rust-toolchain.toml | sed 's/.*nightly-\(.*\)"/\1/')
21
30
echo "current_toolchain_date=$current_toolchain_date" >> $GITHUB_ENV
22
31
current_toolchain_epoch=$(date --date $current_toolchain_date +%s)
23
32
next_toolchain_date=$(date --date "@$(($current_toolchain_epoch + 86400))" +%Y-%m-%d)
24
33
echo "next_toolchain_date=$next_toolchain_date" >> $GITHUB_ENV
25
- if ! git ls-remote --exit-code origin toolchain-$next_toolchain_date ; then
26
- echo "branch_exists=false" >> $GITHUB_ENV
34
+ if gh issue list -S \
35
+ "Toolchain upgrade to nightly-$next_toolchain_date failed" \
36
+ --json number,title | grep title ; then
37
+ echo "next_step=none" >> $GITHUB_ENV
38
+ elif ! git ls-remote --exit-code origin toolchain-$next_toolchain_date ; then
39
+ echo "next_step=create_pr" >> $GITHUB_ENV
27
40
sed -i "/^channel/ s/$current_toolchain_date/$next_toolchain_date/" rust-toolchain.toml
28
41
git diff
29
42
git clone --filter=tree:0 https://github.com/rust-lang/rust rust.git
@@ -39,17 +52,25 @@ jobs:
39
52
echo "$EOF" >> $GITHUB_ENV
40
53
cd ..
41
54
rm -rf rust.git
55
+ if ! cargo build-dev ; then
56
+ echo "next_step=create_issue" >> $GITHUB_ENV
57
+ else
58
+ if ! ./scripts/kani-regression.sh ; then
59
+ echo "next_step=create_issue" >> $GITHUB_ENV
60
+ fi
61
+ fi
42
62
else
43
- echo "branch_exists=true " >> $GITHUB_ENV
63
+ echo "next_step=none " >> $GITHUB_ENV
44
64
fi
45
65
- name : Create Pull Request
46
- if : ${{ env.branch_exists == 'false ' }}
66
+ if : ${{ env.next_step == 'create_pr ' }}
47
67
uses : peter-evans/create-pull-request@v5
48
68
with :
49
69
commit-message : Upgrade Rust toolchain to nightly-${{ env.next_toolchain_date }}
50
70
branch : toolchain-${{ env.next_toolchain_date }}
51
71
delete-branch : true
52
72
title : ' Automatic toolchain upgrade to nightly-${{ env.next_toolchain_date }}'
73
+ labels : Z-BenchCI
53
74
body : >
54
75
Update Rust toolchain from nightly-${{ env.current_toolchain_date }} to
55
76
nightly-${{ env.next_toolchain_date }} without any other source changes.
61
82
https://github.com/rust-lang/rust/commit/${{ env.next_toolchain_hash }}. The log
62
83
for this commit range is:
63
84
85
+ ${{ env.git_log }}
86
+ - name : Create Issue
87
+ if : ${{ env.next_step == 'create_issue' }}
88
+ uses : dacbd/create-issue-action@main
89
+ with :
90
+ token : ${{ github.token }}
91
+ title : ' Toolchain upgrade to nightly-${{ env.next_toolchain_date }} failed'
92
+ body : >
93
+ Updating Rust toolchain from nightly-${{ env.current_toolchain_date }} to
94
+ nightly-${{ env.next_toolchain_date }} requires source changes.
95
+
96
+ The failed automated run
97
+ [can be found here.](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
98
+
99
+ Please review the changes at
100
+ https://github.com/rust-lang/rust from
101
+ https://github.com/rust-lang/rust/commit/${{ env.current_toolchain_hash }} up to
102
+ https://github.com/rust-lang/rust/commit/${{ env.next_toolchain_hash }}. The log
103
+ for this commit range is:
104
+
64
105
${{ env.git_log }}
0 commit comments