Skip to content

Commit 4714ac5

Browse files
committed
fix: exclude benchmark targets from mutation testing
Add --lib --tests to cargo args so criterion benchmarks (harness=false) are not compiled and passed --test-threads=4 which they don't accept.
1 parent 91be747 commit 4714ac5

1 file changed

Lines changed: 67 additions & 37 deletions

File tree

.github/workflows/nightly.yml

Lines changed: 67 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ on:
88
suite:
99
description: 'Which suite to run'
1010
required: false
11-
default: 'all'
11+
default: 'auto'
1212
type: choice
1313
options:
14-
- all # Run everything
14+
- auto # Scheduled behavior: one heavy suite + light suites
15+
- all # Everything (for manual sweeps)
1516
- mutation # Mutation testing only
1617
- miri # Miri only
1718
- stress # Stress tests only
@@ -27,12 +28,53 @@ env:
2728
CARGO_INCREMENTAL: 0
2829

2930
jobs:
30-
# ─── Lightweight jobs: run every night ───────────────────────────────
31+
heavy_plan:
32+
name: Select Heavy Suite
33+
runs-on: ubuntu-latest
34+
outputs:
35+
run_mutation: ${{ steps.select.outputs.run_mutation }}
36+
run_miri: ${{ steps.select.outputs.run_miri }}
37+
steps:
38+
- id: select
39+
env:
40+
EVENT_NAME: ${{ github.event_name }}
41+
SUITE_INPUT: ${{ github.event.inputs.suite }}
42+
run: |
43+
suite="${SUITE_INPUT:-auto}"
44+
run_mutation=false
45+
run_miri=false
46+
47+
if [ "$EVENT_NAME" = "schedule" ] || [ "$suite" = "auto" ]; then
48+
# Alternate heavy suites by UTC weekday to keep wall-time bounded.
49+
# Mon/Wed/Fri/Sun => mutation, Tue/Thu/Sat => miri
50+
weekday="$(date -u +%u)"
51+
case "$weekday" in
52+
1|3|5|7) run_mutation=true ;;
53+
2|4|6) run_miri=true ;;
54+
esac
55+
else
56+
case "$suite" in
57+
all)
58+
run_mutation=true
59+
run_miri=true
60+
;;
61+
mutation)
62+
run_mutation=true
63+
;;
64+
miri)
65+
run_miri=true
66+
;;
67+
esac
68+
fi
69+
70+
echo "run_mutation=$run_mutation" >> "$GITHUB_OUTPUT"
71+
echo "run_miri=$run_miri" >> "$GITHUB_OUTPUT"
3172
3273
stress-tests:
3374
name: Stress Tests
3475
if: >-
3576
github.event_name == 'schedule'
77+
|| github.event.inputs.suite == 'auto'
3678
|| github.event.inputs.suite == 'all'
3779
|| github.event.inputs.suite == 'stress'
3880
runs-on: ubuntu-latest
@@ -69,6 +111,7 @@ jobs:
69111
name: Thread Sanitizer
70112
if: >-
71113
github.event_name == 'schedule'
114+
|| github.event.inputs.suite == 'auto'
72115
|| github.event.inputs.suite == 'all'
73116
|| github.event.inputs.suite == 'sanitizers'
74117
runs-on: ubuntu-latest
@@ -106,6 +149,7 @@ jobs:
106149
name: Address Sanitizer
107150
if: >-
108151
github.event_name == 'schedule'
152+
|| github.event.inputs.suite == 'auto'
109153
|| github.event.inputs.suite == 'all'
110154
|| github.event.inputs.suite == 'sanitizers'
111155
runs-on: ubuntu-latest
@@ -139,19 +183,11 @@ jobs:
139183
env:
140184
ASAN_OPTIONS: "detect_leaks=0"
141185

142-
# ─── Heavy jobs: sharded / parallelized ──────────────────────────────
143-
144186
mutation:
145-
name: Mutation Testing (shard ${{ matrix.shard }})
146-
if: >-
147-
github.event_name == 'schedule'
148-
|| github.event.inputs.suite == 'all'
149-
|| github.event.inputs.suite == 'mutation'
187+
name: Mutation Testing (budgeted shard)
188+
needs: heavy_plan
189+
if: needs.heavy_plan.outputs.run_mutation == 'true'
150190
runs-on: ubuntu-latest
151-
strategy:
152-
fail-fast: false
153-
matrix:
154-
shard: [0, 1, 2, 3, 4, 5, 6, 7]
155191
steps:
156192
- name: Free disk space
157193
run: |
@@ -169,45 +205,45 @@ jobs:
169205
- name: Cache
170206
uses: Swatinem/rust-cache@v2
171207

172-
- name: Install mold linker
173-
run: sudo apt-get install -y mold
174-
175208
- name: Install cargo-mutants
176209
uses: taiki-e/install-action@v2
177210
with:
178211
tool: cargo-mutants
179212

180-
- name: Run mutation testing (shard ${{ matrix.shard }}/8)
213+
- name: Run mutation testing (day shard)
181214
run: |
215+
TOTAL_SHARDS=96
216+
DAY_OF_YEAR="$(date -u +%j)"
217+
SHARD_INDEX=$((10#$DAY_OF_YEAR % TOTAL_SHARDS))
218+
echo "Running shard ${SHARD_INDEX}/${TOTAL_SHARDS}"
219+
182220
cargo mutants --package stoolap \
183221
--in-place \
184-
--shard ${{ matrix.shard }}/8 \
222+
--baseline=skip \
223+
--timeout 420 \
224+
--shard "${SHARD_INDEX}/${TOTAL_SHARDS}" \
185225
-f src/executor/expression/ \
186226
-f src/executor/aggregation.rs \
187227
-f src/executor/subquery.rs \
188228
-f src/functions/scalar/ \
189229
-f src/storage/mvcc/transaction.rs \
190230
-f src/storage/mvcc/registry.rs \
191-
-- --all-targets -- --test-threads=4
192-
timeout-minutes: 90
193-
env:
194-
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER: clang
195-
RUSTFLAGS: "-C link-arg=-fuse-ld=mold"
231+
-- --lib --tests -- --test-threads=4
232+
timeout-minutes: 100
196233

197234
- name: Upload mutation report
198235
if: always()
199236
uses: actions/upload-artifact@v4
200237
with:
201-
name: mutation-report-${{ matrix.shard }}
238+
name: mutation-report
202239
path: mutants.out/
203240

204241
miri:
205242
name: Miri
206-
if: >-
207-
github.event_name == 'schedule'
208-
|| github.event.inputs.suite == 'all'
209-
|| github.event.inputs.suite == 'miri'
243+
needs: heavy_plan
244+
if: needs.heavy_plan.outputs.run_miri == 'true'
210245
runs-on: ubuntu-latest
246+
timeout-minutes: 100
211247
steps:
212248
- uses: actions/checkout@v4
213249

@@ -216,16 +252,10 @@ jobs:
216252
with:
217253
components: miri
218254

219-
- name: Install nextest
220-
uses: taiki-e/install-action@v2
221-
with:
222-
tool: cargo-nextest
223-
224255
- name: Cache
225256
uses: Swatinem/rust-cache@v2
226257

227-
- name: Run Miri on core modules (parallel via nextest)
228-
run: cargo +nightly miri nextest run --lib -E 'test(/^(core|common)::/)' --no-fail-fast
229-
timeout-minutes: 45
258+
- name: Run Miri on core modules
259+
run: "cargo +nightly miri test --lib -- core:: common::"
230260
env:
231261
MIRIFLAGS: "-Zmiri-disable-isolation"

0 commit comments

Comments
 (0)