-
Notifications
You must be signed in to change notification settings - Fork 9
133 lines (122 loc) · 4.56 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: CI
on:
pull_request:
merge_group:
schedule:
- cron: '10 2 * * *' # At 02:10 UTC every day (a bit after rustup-components-history).
jobs:
test-core:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup environment
run: bash ./ci-setup.sh
- name: Test
run: bash ./ci-test.sh core
test-alloc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup environment
run: bash ./ci-setup.sh
- name: Test
run: bash ./ci-test.sh alloc
test-std:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup environment
run: bash ./ci-setup.sh
- name: Test
run: bash ./ci-test.sh std
test-simd:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup environment
run: bash ./ci-setup.sh
- name: Test
run: bash ./ci-test.sh simd
test-stdarch:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup environment
run: bash ./ci-setup.sh
- name: Test
run: bash ./ci-test.sh stdarch
# One job that "summarizes" the success state of this pipeline. This can then be added to branch
# protection, rather than having to add each job separately.
# ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!
success:
name: Success
runs-on: ubuntu-latest
needs: [test-core, test-alloc, test-std, test-simd, test-stdarch]
# We need to ensure this job does *not* get skipped if its dependencies fail,
# because a skipped job is considered a success by Github. So we have to
# overwrite `if:`. We use `!cancelled()` to ensure the job does still not get run
# when the workflow is canceled manually.
if: ${{ !cancelled() }}
steps:
# Manually check the status of all dependencies. `if: failure()` does not work.
- name: check if any dependency failed
run: |
# Print the dependent jobs to see them in the CI log
jq -C <<< '${{ toJson(needs) }}'
# Check if all jobs that we depend on (in the needs array) were successful.
jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'
# Make a PR to update `rust-version` when the cron job succeeds.
# The primary reason for this is that Github stops running our cron job
# if there is no repo activity for a while, so we use these PRs to generate activity.
cron-success-pr:
name: automatic rustup PR
runs-on: ubuntu-latest
needs: [success]
if: github.event_name == 'schedule'
steps:
- uses: actions/checkout@v4
- name: setup bot git name and email
run: |
git config --global user.name 'The Miri Cronjob Bot'
git config --global user.email '[email protected]'
- name: Create PR
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# If this is not the first of the month, stop here.
if [[ $(date -u +%d) != "01" ]]; then
echo "It's not the first of a month, so there will be no PR."
exit 0
fi
# Create commit
DATE=$(date -u +%Y-%m-%d)
echo "nightly-$DATE" > rust-version
git commit -am "automatic rustup"
# Switch to a PR branch
BRANCH="rustup-$DATE"
git switch -c $BRANCH
git push -u origin $BRANCH
# Create PR
gh pr create -B master --title 'Automatic Rustup' --body 'Please close and re-open this PR to trigger CI, then enable auto-merge.'
# Send a Zulip notification when a cron job fails
cron-fail-notify:
name: cronjob failure notification
runs-on: ubuntu-latest
needs: [success]
if: github.event_name == 'schedule' && failure()
steps:
- name: Install zulip-send
run: pip3 install zulip
- name: Send Zulip notification
shell: bash
env:
ZULIP_BOT_EMAIL: ${{ secrets.ZULIP_BOT_EMAIL }}
ZULIP_API_TOKEN: ${{ secrets.ZULIP_API_TOKEN }}
run: |
~/.local/bin/zulip-send --stream miri --subject "Miri test-libstd Failure ($(date -u +%Y-%m))" \
--message 'Dear @*T-miri*,
The standard library test suite is [failing under Miri]('"https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"'). Would you mind investigating this issue?
Thanks in advance!
Sincerely,
The Miri Cronjobs Bot' \
--user $ZULIP_BOT_EMAIL --api-key $ZULIP_API_TOKEN --site https://rust-lang.zulipchat.com