-
Notifications
You must be signed in to change notification settings - Fork 0
172 lines (148 loc) · 5.9 KB
/
code-maven_java-QA_mutation.yml
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
---
# The name of the workflow
name: code-maven-QA-mutation
# The name of the workflow run
run-name: "${{ github.workflow }}-[${{ github.head_ref || github.ref_name }}]=>[${{ github.base_ref }}]"
# Concurrency configuration
concurrency:
# The concurrency group for this workflow
group: "${{ github.workflow }}-[${{ github.head_ref || github.ref_name }}]=>[${{ github.base_ref }}]"
# Cancel all previous runs in progress
cancel-in-progress: true
# Events that trigger the workflow
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
MUTATION_COVERAGE_THRESHOLD:
description: |
The minimum coverage threshold to pass the mutation tests, for example 80
'DEFAULT' uses the value set in github_config.yml "mutation.coverage.threshold".
required: false
default: DEFAULT
# Automatically run the workflow on pull_request events
pull_request:
types: [ opened, edited, labeled, synchronize, ready_for_review, reopened ]
paths:
- 'code/**'
- '.github/workflows/code*'
# Environment variables available to all jobs and steps in this workflow
env:
WORKFLOW_VERSION: 1.0.0
MAVEN_OPTS: "-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn"
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# mutation-tests
mutation-tests:
# The name of the job
name: mutation-tests
# The type of runner that the job will run on
runs-on: ubuntu-20.04
# Conditions to run the job
if: ${{ github.event_name == 'workflow_dispatch' || github.event.pull_request.draft == false }}
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# checkout
- name: checkout
id: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
# config
- name: config
id: config
uses: ./.github/actions/config-resolver
with:
create-annotations: true
files: |
github_config.yml
input-vars: "${{ toJSON(github.event.inputs) }}" # it injects all workflows inputs
# setup-maven-cache
- name: setup-maven-cache
uses: actions/cache@v4
continue-on-error: true
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
# setup-asdf-cache
- name: setup-asdf-cache
uses: actions/cache@v4
continue-on-error: true
with:
path: ~/.asdf/data
key: ${{ runner.os }}-asdf-${{ hashFiles('**/.tool-versions') }}
restore-keys: |
${{ runner.os }}-asdf-
# save-tool-versions-content
- name: save-tool-versions-content
run: |
{
echo "TOOL_VERSIONS<<EOF"
cat code/.tool-versions
echo "EOF"
} >> "$GITHUB_ENV"
# asdf-install
- name: asdf-install
id: asdf-install
uses: asdf-vm/actions/install@v3
with:
tool_versions: ${{ env.TOOL_VERSIONS }}
# set-java-home
- name: set-java-home
id: set-java-home
run: |
# set-java-home
echo "::group::+++ set-java-home +++"
# Set JAVA_HOME
JAVA_HOME="$(asdf where java)"
echo "JAVA_HOME=$JAVA_HOME"
echo "JAVA_HOME=$JAVA_HOME" >> $GITHUB_ENV
echo "::endgroup::"
# mvn-clean-verify
- name: mvn-clean-verify
id: mvn-clean-verify
working-directory: code
run: |
# mvn-clean-verify
echo "::group::+++ mvn-clean-verify +++"
# Maven Properties
MVN_PROPERTIES="pitest:mutationCoverage pitest:report-aggregate-module -DskipITs"
echo "MVN_PROPERTIES=${MVN_PROPERTIES}"
# mvn clean verify
mvn -B -ntp clean verify $MVN_PROPERTIES
echo "::endgroup::"
# pitest-results-verification
- name: pitest-results-verification
id: pitest-results-verification
if: ${{ always() && !cancelled() && steps.mvn-clean-verify.conclusion != 'skipped' }}
uses: ./.github/actions/test-results-verification
with:
# type: The type of results. Supported types: 'surefire', 'failsafe', 'jacoco', 'karate' and 'pitest'.
type: pitest
# results_folder: The folder of the results. For example:
# 'surefire/failsafe': code/target/reports
# 'jacoco': code/jacoco-report-aggregate/target/site/jacoco-aggregate or code/jacoco-report-aggregate/target/site/jacoco-aggregate-it
# 'pitest': code/target/pit-reports
# 'karate': e2e/karate/target/karate-reports
results_folder: ${{ fromJSON(steps.config.outputs.config).mutation.report.folder }}
# threshold: the threshold to verify, For example: 'coverage %' for 'jacoco' and 'pitest', 'success rate %' for 'surefire', 'failsafe' and 'karate'
threshold: ${{ fromJSON(steps.config.outputs.config).mutation.coverage.threshold || 80 }}
# pitest-report-upload
- name: pitest-report-upload
id: pitest-report-upload
if: ${{ always() && !cancelled() && steps.mvn-clean-verify.conclusion != 'skipped' }}
uses: actions/upload-artifact@v4
with:
name: ${{ github.event.repository.name }}-mutation-${{ github.run_number }}-pitest-report
path: ${{ fromJSON(steps.config.outputs.config).mutation.report.folder }}
# execution-logs-upload
- name: execution-logs-upload
id: execution-logs-upload
if: ${{ always() && !cancelled() && steps.mvn-clean-verify.conclusion != 'skipped' }}
uses: actions/upload-artifact@v4
with:
name: ${{ github.event.repository.name }}-karate-${{ github.run_number }}-logs
path: |
code/**/*.log