-
Notifications
You must be signed in to change notification settings - Fork 20
203 lines (186 loc) · 7.05 KB
/
Copy pathnightly.yml
File metadata and controls
203 lines (186 loc) · 7.05 KB
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
name: nightly
permissions:
contents: read
pull-requests: read
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
nightly-gatekeeper:
runs-on: ubuntu-slim
outputs:
should_skip: ${{ steps.check.outputs.should_skip }}
steps:
- uses: actions/checkout@v7.0.0
with:
fetch-depth: 0
- name: Check for changes in last 24 hours
id: check
run: |
# Check logs for commits in the last 24 hours on the current branch
if [[ -z $(git log --since="24 hours ago" --pretty=format:"%H") ]]; then
echo "No commits in the last 24 hours. Skipping..."
echo "should_skip=true" >> "$GITHUB_OUTPUT"
else
echo "New commits found. Proceeding..."
echo "should_skip=false" >> "$GITHUB_OUTPUT"
fi
mutation-testing:
needs: [nightly-gatekeeper]
if: ${{ needs.nightly-gatekeeper.outputs.should_skip != 'true' }}
runs-on: ubuntu-latest
steps:
# prep
- name: Checkout
uses: actions/checkout@v7.0.0
- name: Setup
uses: ./.github/actions/setup
with:
enable-sccache: true
enable-wild-linker: true
rust-toolchain: RUST_NIGHTLY
cargo-tools: CARGO_MUTANTS_VERSION
# execute
- name: Mutate All
run: cargo +${{ env.RUST_NIGHTLY }} -Zscript scripts/mutants.rs
miri-tree-borrows:
needs: [nightly-gatekeeper]
if: ${{ needs.nightly-gatekeeper.outputs.should_skip != 'true' }}
runs-on: ubuntu-latest
# Suppression file: .miri-tree-borrows-skip
#
# Miri's tree-borrows mode tracks per-byte aliasing provenance,
# which can cause certain tests to exceed the runner's 16 GB memory
# limit even though the allocations under test are small. Tests
# listed in .miri-tree-borrows-skip (one fully-qualified path per
# line, # comments for justification) are passed as --skip arguments
# and reported as a ::warning annotation at the end of the run.
# These tests are functionally correct and pass on 32+ GB machines.
steps:
# prep
- name: Checkout
uses: actions/checkout@v7.0.0
- name: Setup
uses: ./.github/actions/setup
with:
enable-sccache: true
rust-toolchain: RUST_NIGHTLY
rust-components: miri
# execute
- name: Miri (tree borrows)
env:
MIRIFLAGS: -Zmiri-tree-borrows
shell: pwsh
run: |
# Build --skip arguments from the suppression file.
# See .miri-tree-borrows-skip for the list and justifications.
$skipArgs = @()
if (Test-Path .miri-tree-borrows-skip) {
$skipArgs = @(
Get-Content .miri-tree-borrows-skip |
ForEach-Object { ($_ -replace '#.*').Trim() } |
Where-Object { $_ -ne '' }
)
}
$skipFlags = @($skipArgs | ForEach-Object { "--skip"; $_ })
$cargoArgs = @(
"+${{ env.RUST_NIGHTLY }}"
"miri"; "test"
"--all-features"; "--workspace"; "--lib"; "--tests"
"--"
) + $skipFlags
cargo @cargoArgs
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
# Report skipped tests clearly at the end
if ($skipArgs.Count -gt 0) {
Write-Host ""
Write-Host "::warning::$($skipArgs.Count) test(s) skipped via .miri-tree-borrows-skip (tree-borrows provenance tracking exceeds runner memory):"
$skipArgs | ForEach-Object { Write-Host " - $_" }
}
timeout-minutes: 240
miri-strict-provenance:
needs: [nightly-gatekeeper]
if: ${{ needs.nightly-gatekeeper.outputs.should_skip != 'true' }}
runs-on: ubuntu-latest
steps:
# prep
- name: Checkout
uses: actions/checkout@v7.0.0
- name: Setup
uses: ./.github/actions/setup
with:
enable-sccache: true
rust-toolchain: RUST_NIGHTLY
rust-components: miri
# execute
- name: Miri (strict provenance)
env:
MIRIFLAGS: -Zmiri-strict-provenance
run: cargo +${{ env.RUST_NIGHTLY }} miri test --all-features --workspace --lib --tests
timeout-minutes: 240
miri-race-coverage:
needs: [nightly-gatekeeper]
if: ${{ needs.nightly-gatekeeper.outputs.should_skip != 'true' }}
runs-on: ubuntu-latest
timeout-minutes: 720 # 12 hours, to accommodate the large number of seeds
steps:
# prep
- name: Checkout
uses: actions/checkout@v7.0.0
- name: Setup
uses: ./.github/actions/setup
with:
enable-sccache: true
rust-toolchain: RUST_NIGHTLY
rust-components: miri
- name: Setup Miri Flags
# Rotate seed pairs daily based on day-of-month (1–31) to spread
# coverage over time. -Zmiri-many-seeds uses an exclusive upper
# bound, so we add 1: day 1 → seeds 1..3 (runs 1,2), day 2 →
# seeds 3..5 (runs 3,4), …, day 31 → seeds 61..63 (runs 61,62).
# Over a full month this covers seeds 1–62.
shell: pwsh
run: |
$seedBase = [int](Get-Date -AsUtc -Format 'dd')
$seedLow = 2 * $seedBase - 1
$seedHigh = 2 * $seedBase + 1
"MIRIFLAGS=-Zmiri-many-seeds=${seedLow}..${seedHigh}" >> $env:GITHUB_ENV
# execute
- name: Miri (race coverage)
run: cargo +${{ env.RUST_NIGHTLY }} miri test --all-features --workspace --lib --tests
timeout-minutes: 720 # 12 hours, to accommodate the large number of seeds
report-failure:
needs:
- nightly-gatekeeper
- mutation-testing
- miri-tree-borrows
- miri-strict-provenance
- miri-race-coverage
# `always()` ensures we still run when a dependency fails; the
# gatekeeper guard skips the report on no-op nights.
if: ${{ always() && needs.nightly-gatekeeper.outputs.should_skip != 'true' && contains(needs.*.result, 'failure') }}
runs-on: ubuntu-slim
permissions:
issues: write
steps:
- name: Create or Update Issue on Failure
env:
GH_TOKEN: ${{ github.token }}
run: |
ISSUE_TITLE="🚨 Nightly Build Failed"
ISSUE_DATE="$(date +'%Y-%m-%d')"
ISSUE_FULL_TITLE="$ISSUE_TITLE: $ISSUE_DATE"
ISSUE_BODY="The nightly scheduled build failed. Please check the logs here: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"
# Search for open issues with the same base title and label
EXISTING_ISSUE=$(gh issue list --label "bug" --state open --search "$ISSUE_TITLE" --json number,title | jq -r '.[] | select(.title | startswith("'"$ISSUE_TITLE"'")) | .number' | head -n 1)
if [[ -n "$EXISTING_ISSUE" ]]; then
# Add a comment to the existing issue
gh issue comment "$EXISTING_ISSUE" --body "$ISSUE_BODY"
else
# Create a new issue
gh issue create \
--title "$ISSUE_FULL_TITLE" \
--body "$ISSUE_BODY" \
--label "bug"
fi