-
Notifications
You must be signed in to change notification settings - Fork 0
225 lines (218 loc) · 9.27 KB
/
Copy pathmutation-weekly.yml
File metadata and controls
225 lines (218 loc) · 9.27 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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
name: mutation-manual
on:
workflow_dispatch:
permissions:
contents: read
packages: read
concurrency:
group: mutation-manual-${{ github.ref }}
cancel-in-progress: true
jobs:
build-ci-image:
uses: ./.github/workflows/reusable-build-runtime-image.yml
secrets: inherit # pragma: allowlist secret
with:
artifact-name: mutation-image-contract
image-tag-prefix: mutation
python-mutmut:
needs: [build-ci-image]
timeout-minutes: 90
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 3
matrix:
include:
- module: core_utils
mutate_path: packages/domain/core_utils.py
tests: tests/unit/test_core_utils.py tests/unit/test_core_utils_more.py tests/unit/test_core_utils_timezone_and_truncate.py
- module: manifest_store
mutate_path: packages/infrastructure/manifest_store.py
tests: tests/unit/test_manifest_metadata.py tests/unit/test_manifest_store.py tests/unit/test_manifest_store_more.py
- module: config_loader
mutate_path: packages/infrastructure/config_loader.py
tests: tests/unit/test_config_loader.py tests/unit/test_config_loader_validate.py tests/unit/test_config_loader_strict_validation.py
- module: apply_command
mutate_path: packages/application/apply_command.py
tests: tests/unit/test_apply_changes.py tests/unit/test_apply_changes_more.py
- module: pipeline_config
mutate_path: packages/domain/pipeline_config.py
tests: tests/unit/test_pipeline_config_durability.py
- module: cli_app
mutate_path: apps/cli/cli_app.py
tests: tests/unit/test_cli_app.py
- module: gemini_client
mutate_path: packages/infrastructure/gemini_client.py
tests: tests/unit/test_gemini_client_parse.py tests/unit/test_gemini_client_more.py
- module: logging_utils
mutate_path: packages/observability/logging_utils.py
tests: tests/unit/test_logging_utils.py
- module: analyze_media
mutate_path: packages/application/analyze_media.py
tests: tests/unit/test_analyze_media_sanitize.py tests/unit/test_analyze_media_more_paths.py
- module: reporting
mutate_path: packages/application/reporting.py
tests: tests/unit/test_reporting.py
steps:
- name: Clear stale git metadata before checkout
run: |
set -euo pipefail
if [ -d "$GITHUB_WORKSPACE/.git" ]; then
rm -rf "$GITHUB_WORKSPACE/.git"
fi
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
with:
clean: false
persist-credentials: false
- name: Self-hosted workspace hygiene
run: |
set -euo pipefail
bash tooling/ci/gha_self_hosted_hygiene.sh --stage post-checkout --normalize-ownership
- name: Download CI runtime image contract
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
with:
name: mutation-image-contract
path: .runtime-cache/ci-contract
- name: Load CI runtime image from contract
env:
GHCR_LOGIN_TOKEN: ${{ github.token }}
GHCR_LOGIN_ACTOR: ${{ github.actor }}
run: |
set -euo pipefail
DOCKER_CONFIG_DIR="${RUNNER_TEMP:-${TMPDIR:-/tmp}}/movi-docker-config"
mkdir -p "$DOCKER_CONFIG_DIR"
printf '%s\n' '{"auths":{}}' > "$DOCKER_CONFIG_DIR/config.json"
export DOCKER_CONFIG="$DOCKER_CONFIG_DIR"
printf '%s' "$GHCR_LOGIN_TOKEN" | docker login ghcr.io -u "$GHCR_LOGIN_ACTOR" --password-stdin # pragma: allowlist secret
IMAGE_REF="$(bash tooling/ci/read_ci_contract_image_ref.sh .runtime-cache/ci-contract/py311.image.txt)"
docker pull "$IMAGE_REF"
echo "MOVI_CI_IMAGE=$IMAGE_REF" >> "$GITHUB_ENV"
- name: Prepare artifacts dir
run: mkdir -p .runtime-cache/logs .runtime-cache/ci
- name: Run mutmut (python)
env:
MATRIX_MUTATE_PATH: ${{ matrix.mutate_path }}
MATRIX_TESTS: ${{ matrix.tests }}
run: |
set -euo pipefail
bash tooling/scripts/container_exec.sh --label mutation-manual -- bash -lc '
set -euo pipefail
$HOME/.cache/movi-organizer/venv/default/bin/mutmut run \
--paths-to-mutate "${MATRIX_MUTATE_PATH}" \
--tests-dir tests/unit \
--runner "$HOME/.cache/movi-organizer/venv/default/bin/python -m pytest -q ${MATRIX_TESTS}"
'
- name: Mutation fail gate (no survived mutants)
env:
MATRIX_MODULE: ${{ matrix.module }}
run: |
set -euo pipefail
bash tooling/scripts/container_exec.sh --label mutation-manual-report -- bash -lc '
set -euo pipefail
$HOME/.cache/movi-organizer/venv/default/bin/mutmut results | tee ".runtime-cache/logs/mutmut-results-${MATRIX_MODULE}.txt"
$HOME/.cache/movi-organizer/venv/default/bin/python tooling/scripts/check_mutation_report.py \
--input ".runtime-cache/logs/mutmut-results-${MATRIX_MODULE}.txt" \
--max-survived 0 \
--max-timed-out 0 \
--max-suspicious 0 \
--min-killed 1 \
--require-non-empty-sample \
--json-output ".runtime-cache/logs/mutmut-summary-${MATRIX_MODULE}.json"
'
- name: Upload mutation diagnostics
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
with:
name: mutation-manual-diagnostics-${{ matrix.module }}
path: |
.runtime-cache/logs/
.runtime-cache/test/mutation/.mutmut-cache
if-no-files-found: warn
js-stryker:
needs: [build-ci-image]
timeout-minutes: 45
runs-on: ubuntu-latest
steps:
- name: Clear stale git metadata before checkout
run: |
set -euo pipefail
if [ -d "$GITHUB_WORKSPACE/.git" ]; then
rm -rf "$GITHUB_WORKSPACE/.git"
fi
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
with:
clean: false
persist-credentials: false
- name: Self-hosted workspace hygiene
run: |
set -euo pipefail
bash tooling/ci/gha_self_hosted_hygiene.sh --stage post-checkout --normalize-ownership
- name: Download CI runtime image contract
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
with:
name: mutation-image-contract
path: .runtime-cache/ci-contract
- name: Load CI runtime image from contract
env:
GHCR_LOGIN_TOKEN: ${{ github.token }}
GHCR_LOGIN_ACTOR: ${{ github.actor }}
run: |
set -euo pipefail
DOCKER_CONFIG_DIR="${RUNNER_TEMP:-${TMPDIR:-/tmp}}/movi-docker-config"
mkdir -p "$DOCKER_CONFIG_DIR"
printf '%s\n' '{"auths":{}}' > "$DOCKER_CONFIG_DIR/config.json"
export DOCKER_CONFIG="$DOCKER_CONFIG_DIR"
printf '%s' "$GHCR_LOGIN_TOKEN" | docker login ghcr.io -u "$GHCR_LOGIN_ACTOR" --password-stdin # pragma: allowlist secret
IMAGE_REF="$(bash tooling/ci/read_ci_contract_image_ref.sh .runtime-cache/ci-contract/py311.image.txt)"
docker pull "$IMAGE_REF"
echo "MOVI_CI_IMAGE=$IMAGE_REF" >> "$GITHUB_ENV"
- name: Run Stryker (js/ts)
run: |
set -euo pipefail
bash tooling/scripts/container_exec.sh --label js-stryker -- bash -lc '
set -euo pipefail
if [ -f stryker.config.json ] || [ -f stryker.config.mjs ] || [ -f stryker.config.cjs ]; then
npx stryker run
else
echo "No Stryker config found. Skip js-stryker job."
fi
'
rust-cargo-mutants:
timeout-minutes: 45
runs-on: ubuntu-latest
steps:
- name: Clear stale git metadata before checkout
run: |
set -euo pipefail
if [ -d "$GITHUB_WORKSPACE/.git" ]; then
rm -rf "$GITHUB_WORKSPACE/.git"
fi
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
with:
clean: false
persist-credentials: false
- name: Self-hosted workspace hygiene
run: |
set -euo pipefail
bash tooling/ci/gha_self_hosted_hygiene.sh --stage post-checkout --normalize-ownership
- name: Skip when no Rust sources
id: detect_rs
run: |
set -euo pipefail
if git ls-files | grep -E '\.rs$' >/dev/null; then
echo "has_rs=true" >> "$GITHUB_OUTPUT"
else
echo "has_rs=false" >> "$GITHUB_OUTPUT"
fi
- uses: taiki-e/install-action@dc65498be417cee56d567a702cfefe9337cf8ea6
if: steps.detect_rs.outputs.has_rs == 'true'
- name: Run cargo-mutants
if: steps.detect_rs.outputs.has_rs == 'true'
env:
XDG_CACHE_HOME: ${{ runner.temp }}/organizer-mutation-manual-xdg-cache
run: |
set -euo pipefail
cargo mutants --in-place
- name: No Rust sources
if: steps.detect_rs.outputs.has_rs != 'true'
run: echo "No Rust sources detected. Skip rust-cargo-mutants."