-
Notifications
You must be signed in to change notification settings - Fork 269
79 lines (68 loc) · 3.15 KB
/
Copy pathmutation-testing.yml
File metadata and controls
79 lines (68 loc) · 3.15 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
name: Changed-code mutation testing
on:
pull_request:
types: [edited, opened, reopened, ready_for_review, synchronize]
merge_group:
types: [checks_requested]
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
mutation-diff:
name: mutation-diff
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Record merge-queue enforcement
if: github.event_name == 'merge_group'
run: |
echo "## Changed-code mutation testing" >> "$GITHUB_STEP_SUMMARY"
echo "Mutation testing was enforced on each pull request before it entered the merge queue." >> "$GITHUB_STEP_SUMMARY"
- name: Checkout pull request merge result
if: github.event_name == 'pull_request'
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.sha }}
fetch-depth: 0
persist-credentials: false
- name: Fetch pull request base
if: github.event_name == 'pull_request'
env:
BASE_REPOSITORY_URL: ${{ github.server_url }}/${{ github.repository }}.git
BASE_SHA: ${{ github.event.pull_request.base.sha }}
run: git fetch --no-tags "$BASE_REPOSITORY_URL" "$BASE_SHA"
- name: Setup Node.js and pnpm
if: github.event_name == 'pull_request'
uses: ./.github/actions/setup-node-pnpm
with:
install-args: "--frozen-lockfile"
- name: Test mutation gate logic
if: github.event_name == 'pull_request'
run: pnpm test:mutation-ci
- name: Mutate changed executable lines
if: github.event_name == 'pull_request'
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.sha }}
run: node scripts/stryker-diff.mjs ci --base "$BASE_SHA" --head "$HEAD_SHA"
- name: Upload mutation reports
id: mutation_report
if: always() && github.event_name == 'pull_request'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: changed-code-mutation-report
path: reports/mutation/
if-no-files-found: ignore
retention-days: 7
- name: Link mutation report artifact
if: always() && github.event_name == 'pull_request' && steps.mutation_report.outputs.artifact-url != ''
env:
ARTIFACT_URL: ${{ steps.mutation_report.outputs.artifact-url }}
run: |
{
echo ""
echo "### Download mutation reports"
echo "[Open the changed-code-mutation-report artifact]($ARTIFACT_URL), then open the package's mutation.html file."
} >> "$GITHUB_STEP_SUMMARY"