1+ name : Sync Upstream Verus & Dispatch
2+
3+ on :
4+ workflow_dispatch :
5+ schedule :
6+ - cron : " 0 23 * * *"
7+
8+ jobs :
9+ check-version :
10+ runs-on : ubuntu-latest
11+ outputs :
12+ continue : ${{ steps.version-check.outputs.continue }}
13+ steps :
14+ - name : Checkout
15+ uses : actions/checkout@v3
16+ with :
17+ fetch-depth : 0
18+
19+ - name : Fetch upstream
20+ run : |
21+ git remote add upstream https://github.com/verus-lang/verus.git || true
22+ git fetch upstream main
23+
24+ - name : Read versions
25+ id : version-check
26+ run : |
27+ # upstream version
28+ UPSTREAM_VERSION=$(git show upstream/main:rust-toolchain.toml | grep '^channel' | awk -F'"' '{print $2}')
29+ echo "Upstream version: $UPSTREAM_VERSION"
30+
31+ # local fork version
32+ VERUS_VERSION=$(grep '^channel' rust-toolchain.toml | awk -F'"' '{print $2}')
33+ echo "Local VERUS_VERSION: $VERUS_VERSION"
34+
35+ if [ "$UPSTREAM_VERSION" != "$VERUS_VERSION" ]; then
36+ echo "Version changed! Fail workflow and create issue."
37+ echo "continue=false" >> $GITHUB_OUTPUT
38+ exit 1
39+ else
40+ echo "Version unchanged."
41+ echo "continue=true" >> $GITHUB_OUTPUT
42+ fi
43+
44+ - name : Create issue if version changed
45+ if : failure()
46+ uses : peter-evans/create-issue-from-file@v6
47+ with :
48+ title : " Detected upstream Verus rust-toolchain version change"
49+ content : |
50+ Detected upstream Verus rust-toolchain version change.
51+
52+ The [upstream repo](https://github.com/verus-lang/verus) has updated its rust-toolchain channel version.
53+
54+ Automation is halted.
55+
56+ Old version: ${{ steps.version-check.outputs.VERUS_VERSION }}
57+ New version: ${{ steps.version-check.outputs.UPSTREAM_VERSION }}
58+ Upstream commit: $(git rev-parse upstream/main)
59+
60+ Please manually update local code before re-running this workflow.
61+ assignees : your-github-username
62+ labels : automation
63+ issue-reuse-message : " An open issue already exists for rust-toolchain version change."
64+ token : ${{ secrets.GITHUB_TOKEN }}
65+
66+ update-test :
67+ needs : check-version
68+ if : needs.check-version.outputs.continue == 'true'
69+ runs-on : ubuntu-latest
70+ steps :
71+ - name : Checkout
72+ uses : actions/checkout@v3
73+ with :
74+ fetch-depth : 0
75+
76+ - name : Configure Git for CI
77+ run : |
78+ git config user.name "Verus CI Bot"
79+ git config user.email "[email protected] " 80+
81+ - name : Fetch upstream & origin
82+ run : |
83+ git remote add upstream https://github.com/verus-lang/verus.git || true
84+ git fetch upstream main
85+ git fetch origin update-test
86+
87+ - name : Switch to update-test
88+ run : git checkout update-test
89+
90+ - name : Reset update-test to upstream/main
91+ run : git reset --hard upstream/main
92+
93+ - name : Cherry-pick "Fix for asterinas" commit
94+ run : |
95+ COMMIT_SHA=$(git log main --grep="Fix for asterinas" --pretty=format:"%H" -n 1)
96+ if [ -z "$COMMIT_SHA" ]; then
97+ echo "No commit with message 'Fix for asterinas' found on main. Aborting."
98+ exit 1
99+ else
100+ git cherry-pick $COMMIT_SHA
101+ fi
102+
103+ - name : Push update-test to origin
104+ run : git push origin update-test --force
105+
106+ - name : Repository dispatch to vostd
107+ uses : peter-evans/repository-dispatch@v2
108+ with :
109+ token : ${{ secrets.VERUS_TEST_TOKEN }}
110+ repository : asterinas/vostd
111+ event-type : verus-update-test
112+ client-payload : ' {"branch":"main"}'
0 commit comments