-
-
Notifications
You must be signed in to change notification settings - Fork 341
187 lines (172 loc) · 6.81 KB
/
tests.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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# Workflow for testing Spoon.
#
# Note that actions are specified by commit hash. This is to avoid the security
# risk of someone injecting malicious code into a release and then simply
# changing a tag.
name: tests
on:
pull_request:
branches:
- master
push:
branches:
- master
schedule:
- cron: "0 0 * * *"
env:
JAVA_DISTRIBUTION: temurin
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
java: [11, 17]
os: [ubuntu-latest, windows-latest]
exclude:
- os: windows-latest
java: 17
env:
MAVEN_OPTS: -Djava.src.version=${{ matrix.java }} -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false
name: Tests with Java ${{ matrix.java }} on ${{ matrix.os }}
steps:
- name: Disable Git's autocrlf
run: git config --global core.autocrlf false
- uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 # tag=v3.0.0
- uses: actions/setup-java@f69f00b5e5324696b07f6b1c92f0470a6df00780 # tag=v3.0.0
with:
java-version: ${{ matrix.java }}
distribution: ${{ env.JAVA_DISTRIBUTION }}
- name: Get date for cache # see https://github.com/actions/cache README
id: get-date
run: echo "::set-output name=date::$(/bin/date -u "+%Y%m%d")"
shell: bash
- name: Use Maven dependency cache
uses: actions/cache@4b0cf6cc4619e737324ddfcec08fff2413359514 # tag=v3.0.0
with:
path: ~/.m2/repository
key: ${{ runner.os }}-${{ steps.get-date.outputs.date }}-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
- name: Use silent log config
run: mv chore/logback.xml src/test/resources/
- name: Build
run: |
mvn -B test-compile
- name: Fetch final dependencies
# this is a hack to download the final test dependencies required to actually run the tests
run: timeout 20 mvn -B test || echo "Done fetching dependencies"
shell: bash
- name: Test
run:
mvn test
- name: print run tests
run: cat testResults.spoon
coverage:
runs-on: ubuntu-latest
env:
MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false
name: Test with coverage
steps:
- uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 # tag=v3.0.0
- uses: actions/setup-java@f69f00b5e5324696b07f6b1c92f0470a6df00780 # tag=v3.0.0
with:
java-version: 17
distribution: ${{ env.JAVA_DISTRIBUTION }}
- name: Get date for cache # see https://github.com/actions/cache README
id: get-date
run: echo "::set-output name=date::$(/bin/date -u "+%Y%m%d")"
shell: bash
- name: Use Maven dependency cache
uses: actions/cache@4b0cf6cc4619e737324ddfcec08fff2413359514 # tag=v3.0.0
with:
path: ~/.m2/repository
key: ${{ runner.os }}-${{ steps.get-date.outputs.date }}-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
- name: Use silent log config
run: mv chore/logback.xml src/test/resources/
- name: Build
run: |
mvn -B test-compile
- name: Test with coverage
run: mvn -Pcoveralls test jacoco:report coveralls:report -DrepoToken=$GITHUB_TOKEN -DserviceName=github -DpullRequest=$PR_NUMBER --fail-never
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.number }}
extra:
runs-on: ubuntu-latest
env:
MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false
name: Extra checks
steps:
- uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 # tag=v3.0.0
with:
fetch-depth: 0
- uses: actions/setup-java@f69f00b5e5324696b07f6b1c92f0470a6df00780 # tag=v3.0.0
with:
java-version: 17
distribution: ${{ env.JAVA_DISTRIBUTION }}
- uses: actions/setup-python@0ebf233433c08fb9061af664d501c3f3ff0e9e20 # tag=v3.0.0
with:
python-version: 3.6
- name: Get date for cache # see https://github.com/actions/cache README
id: get-date
run: echo "::set-output name=date::$(/bin/date -u "+%Y%m%d")"
shell: bash
- name: Use Maven dependency cache
uses: actions/cache@4b0cf6cc4619e737324ddfcec08fff2413359514 # tag=v3.0.0
with:
path: ~/.m2/repository
key: ${{ runner.os }}-${{ steps.get-date.outputs.date }}-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
- name: Use silent log config
run: mv chore/logback.xml src/test/resources/
- name: Run extra checks
run: ./chore/ci-extra.sh
- name: Run Javadoc quality check
run: ./chore/check-javadoc-regressions.py COMPARE_WITH_MASTER
code-quality: # we create a new step here because qodana analyzer takes around 10min
runs-on: ubuntu-latest
env:
MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false
QODANA_LINTER: jetbrains/qodana-jvm-community@sha256:c388ddd7b852296f71b1a786d3b30f458a993eb252d5cd4963422007e5b824db
name: code-quality qodana
steps:
- name: Checkout
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 # tag=v3.0.0
with:
path: pull_request
- uses: actions/setup-java@f69f00b5e5324696b07f6b1c92f0470a6df00780 # tag=v3.0.0
with:
java-version: 17
distribution: ${{ env.JAVA_DISTRIBUTION }}
- name: git reset
run: cd pull_request && git fetch && git reset --soft origin/master
- name: Qodana - Code Inspection
uses: JetBrains/qodana-action@9e56346b427d9ed086178d0e60e424c451979261 # tag=v5.0.2
with:
linter: ${{ env.QODANA_LINTER }}
project-dir: "${{ github.workspace }}/pull_request"
inspected-dir: ./src/main/java # only main spoon project at first
results-dir: "${{ github.workspace }}/result"
changes: true
fail-threshold: 0
use-annotations: false
use-caches: false # we disable cache for consistent results
- uses: github/codeql-action/upload-sarif@v1
if: always()
with:
sarif_file: "${{ github.workspace }}/result/qodana.sarif.json"
reproducible-builds:
runs-on: ubuntu-latest
env:
MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false
name: reproducible-builds
steps:
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # renovate: tag=v2.4.0
with:
fetch-depth: 0
- uses: actions/setup-java@f0bb91606209742fe3ea40199be2f3ef195ecabf # renovate: tag=v2.5.0
with:
java-version: 17
distribution: ${{ env.JAVA_DISTRIBUTION }}
- name: Check status
run: chore/check-reproducible-builds.sh