mirror of
https://github.com/callstack/agent-device.git
synced 2026-09-14 20:06:34 +08:00
539e848e0c
* fix(ci): stop ten artifact uploads discarding their hidden paths `actions/upload-artifact` has excluded hidden files and directories by default since v4.4 (this repository pins v4.6.2), and most diagnostics here are written under `.tmp`. Ten upload steps across seven files therefore uploaded nothing from those paths: macos.yml's xcresult bundle, both mutation lanes' reports and shards, replays-nightly's fuzz output, xctest-nightly's results, test-app-build-cache's fixture tarball, and 1874-diagnose's per-iteration logs. Most fail silently, since they pair the omission with `if-no-files-found: warn` or `ignore`. test-app-build-cache sets `error`, so that one does not. A structural guard rather than a shared upload wrapper: the wrapper would be a shallow mirror of the action's options over artifacts with different owners, while the policy question — a hidden path needs the flag — is one rule that belongs in one place. Each workflow still declares its own artifact. test/ci/upload-artifact-hidden-paths.test.ts holds it across every workflow and composite action, and is red if any single flag is dropped. * test(ci): scan every YAML shape GitHub accepts, not just top-level *.yml The guard read `.github/workflows/*.yml` and assumed local actions live one directory deep as `action.yml`. GitHub also reads `.yaml` for both, and local actions nest, so a hidden-path upload in any of those shapes passed the gate. It now walks the `.github` tree recursively for either extension, and a second test plants the three shapes the old scan missed and asserts all three are found — executable rather than a one-off manual check. Red against narrowing the extension, against dropping the recursive walk, and against removing any single real flag. Also drops the action-version note under the comment rule in #2087; the version behaviour belongs in the PR, and the assertion message already says what the omission costs.
169 lines
6.5 KiB
YAML
169 lines
6.5 KiB
YAML
name: Mutation Weekly
|
|
|
|
# Weekly mutation sweep over the enumerated decision kernels (issue #1415).
|
|
# Mutation score is the mechanical answer to "is this test load-bearing or
|
|
# decorative"; a full-suite sweep is unaffordable, so the scope is the kernel
|
|
# registry in scripts/mutation/modules.ts and nothing else.
|
|
#
|
|
# Sharded one job per module: the whole sweep is ~2,150 mutants, and the selector
|
|
# module alone is ~1,280 of them, so a single job would sit near the 30-minute
|
|
# acceptance budget on an ubuntu runner. The shards' JSON reports are merged into
|
|
# one score table by the report job (`--report-dir`).
|
|
#
|
|
# The lane reports and never gates (#1457): the per-kernel table lands in the job
|
|
# summary and the artifact, and a low score is an input for a human-authored
|
|
# test-strengthening PR (#1474, #1475 were written that way).
|
|
|
|
on:
|
|
schedule:
|
|
# Sundays 05:00 UTC — after the nightly lanes, before the working week.
|
|
- cron: '0 5 * * 0'
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: ci-${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
shard:
|
|
name: Mutants (${{ matrix.name }})
|
|
runs-on: ubuntu-latest
|
|
# The acceptance budget is 30 minutes of wall clock for the lane, and shards
|
|
# run in parallel, so the budget is per shard. The observed rate on a 2-core
|
|
# runner is ~3s/mutant, which is why selectors (~1,280 mutants) is sliced.
|
|
timeout-minutes: 30
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
# Kept in step with KERNEL_MODULES by the shard-coverage assertion in
|
|
# scripts/mutation/workflow.test.ts, which also pins --expect-shards to
|
|
# the number of entries here.
|
|
include:
|
|
- { name: kernel-errors, module: kernel-errors }
|
|
- { name: daemon-ref-frame, module: daemon-ref-frame }
|
|
- { name: interaction-settle, module: interaction-settle }
|
|
- { name: scroll-edge-state, module: scroll-edge-state }
|
|
- { name: selectors-1, module: selectors, shard: 1/4 }
|
|
- { name: selectors-2, module: selectors, shard: 2/4 }
|
|
- { name: selectors-3, module: selectors, shard: 3/4 }
|
|
- { name: selectors-4, module: selectors, shard: 4/4 }
|
|
- { name: target-annotation-serde, module: target-annotation-serde }
|
|
- { name: snapshot-occlusion, module: snapshot-occlusion }
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
|
|
- name: Setup toolchain
|
|
uses: ./.github/actions/setup-node-pnpm
|
|
|
|
- name: Run mutants for ${{ matrix.name }}
|
|
uses: ./.github/actions/run-gate
|
|
with:
|
|
gate: mutation
|
|
args: |
|
|
--modules
|
|
${{ matrix.module }}
|
|
${{ matrix.shard && '--shard' || '' }}
|
|
${{ matrix.shard || '' }}
|
|
|
|
# A shard can die before Stryker writes anything (install, config, crash);
|
|
# without this the artifact is absent and "shard failed" is indistinguishable
|
|
# from "lane never ran". --fail-envelope leaves a real verdict untouched.
|
|
- name: Record a failed shard envelope
|
|
if: failure()
|
|
run: |
|
|
pnpm gate mutation --modules ${{ matrix.module }} --fail-envelope \
|
|
"shard ${{ matrix.name }} failed before producing a report (run ${{ github.run_id }})" || true
|
|
|
|
- name: Upload shard report
|
|
if: always()
|
|
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
|
with:
|
|
name: mutation-shard-${{ matrix.name }}
|
|
include-hidden-files: true
|
|
path: |
|
|
.tmp/mutation/mutation.json
|
|
.tmp/mutation/lane-envelope.json
|
|
if-no-files-found: warn
|
|
|
|
report:
|
|
name: Mutation score report
|
|
runs-on: ubuntu-latest
|
|
needs: shard
|
|
if: always()
|
|
timeout-minutes: 15
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
|
|
- name: Setup toolchain
|
|
uses: ./.github/actions/setup-node-pnpm
|
|
|
|
- name: Harness self-test
|
|
uses: ./.github/actions/run-gate
|
|
with: { gate: mutation-model }
|
|
|
|
- name: Download shard reports
|
|
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
|
|
with:
|
|
pattern: mutation-shard-*
|
|
path: .tmp/mutation/shards
|
|
|
|
# run.ts writes the per-kernel score table to $GITHUB_STEP_SUMMARY when the
|
|
# runner exports it, so the summary and the artifact carry the same numbers.
|
|
# It publishes the table before judging the shard set, so even the one
|
|
# failure it can raise — an incomplete shard set — still reports the kernels
|
|
# that completed. A red lane here always means the sweep did not happen,
|
|
# never a low score.
|
|
- name: Score the merged sweep
|
|
uses: ./.github/actions/run-gate
|
|
with:
|
|
gate: mutation-check
|
|
args: |
|
|
--report-dir
|
|
.tmp/mutation/shards
|
|
--expect-shards
|
|
10
|
|
|
|
# The self-test and the artifact download both run before the scoring step,
|
|
# so a failure there would otherwise leave the aggregate lane with no envelope.
|
|
- name: Record a failed lane envelope
|
|
if: failure()
|
|
run: |
|
|
pnpm gate mutation --fail-envelope \
|
|
"weekly report job failed before producing a score table (run ${{ github.run_id }})" || true
|
|
|
|
# Freshness/drift telemetry (#1430): the envelope states commit, Stryker
|
|
# version, config hash, duration and result, so a lane going dark or a tool
|
|
# bump is visible without reading these logs.
|
|
- name: Lane envelope
|
|
if: always()
|
|
run: |
|
|
if [ ! -f .tmp/mutation/lane-envelope.json ]; then
|
|
echo 'No lane envelope was written — the job died before it could run node.' \
|
|
>> "$GITHUB_STEP_SUMMARY"
|
|
exit 0
|
|
fi
|
|
{
|
|
echo '<details><summary>Lane envelope (schema #1430)</summary>'
|
|
echo
|
|
echo '```json'
|
|
cat .tmp/mutation/lane-envelope.json
|
|
echo '```'
|
|
echo '</details>'
|
|
} >> "$GITHUB_STEP_SUMMARY"
|
|
|
|
- name: Upload mutation report
|
|
if: always()
|
|
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
|
with:
|
|
name: mutation-decision-kernels
|
|
include-hidden-files: true
|
|
path: |
|
|
.tmp/mutation/shards
|
|
.tmp/mutation/lane-envelope.json
|
|
if-no-files-found: warn
|