-
Notifications
You must be signed in to change notification settings - Fork 1
189 lines (165 loc) · 5.18 KB
/
check-build.yml
File metadata and controls
189 lines (165 loc) · 5.18 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
name: Check Build
on:
workflow_dispatch:
push:
branches: [ develop ]
paths-ignore:
- '**.md'
- '.config/**'
- '.github/**'
- '.idea/**'
- 'assets/**'
pull_request:
branches: [ develop ]
paths-ignore:
- '**.md'
- '.config/**'
- '.github/**'
- '.idea/**'
- 'assets/**'
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
matrix:
java: [17, 21, 25]
distribution: [temurin]
steps:
- uses: actions/checkout@v6
- name: Set up JDK
uses: actions/setup-java@v5
with:
distribution: ${{ matrix.distribution }}
java-version: ${{ matrix.java }}
- name: Cache Maven
uses: actions/cache@v5
with:
path: ~/.m2/repository
key: ${{ runner.os }}-mvn-build-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-mvn-build-
- name: Build with Maven
run: ./mvnw -B clean package -T2C
- name: Check for uncommited changes
run: |
if [[ "$(git status --porcelain)" != "" ]]; then
echo ----------------------------------------
echo git status
echo ----------------------------------------
git status
echo ----------------------------------------
echo git diff
echo ----------------------------------------
git diff
echo ----------------------------------------
echo Troubleshooting
echo ----------------------------------------
echo "::error::Unstaged changes detected. Locally try running: git clean -ffdx && ./mvnw -B clean package"
exit 1
fi
- name: Upload standalone server JAR
uses: actions/upload-artifact@v7
with:
name: server-${{ matrix.java }}
path: server/target/server-standalone.jar
if-no-files-found: error
# Build docker
- uses: docker/setup-qemu-action@v4
- uses: docker/setup-buildx-action@v4
- uses: docker/build-push-action@v7
with:
context: ./server
push: false
tags: mockserver-standalone:experimental
platforms: linux/amd64,linux/arm64
cache-from: type=gha,scope=build
cache-to: type=gha,mode=max,scope=build
# 2 steps required because "failed to build: docker exporter does not currently support exporting manifest lists"
- uses: docker/build-push-action@v7
with:
context: ./server
push: false
load: true
tags: mockserver-standalone:experimental
cache-from: type=gha,scope=build-for-it
cache-to: type=gha,mode=max,scope=build-for-it
- name: Run integration tests
run: |
./mvnw -B test \
-P run-integration-tests \
-T2C \
-Dmockserver-image=mockserver-standalone:experimental
checkstyle:
runs-on: ubuntu-latest
if: ${{ github.event_name != 'pull_request' || !startsWith(github.head_ref, 'renovate/') }}
timeout-minutes: 15
strategy:
matrix:
java: [21]
distribution: [temurin]
steps:
- uses: actions/checkout@v6
- name: Set up JDK
uses: actions/setup-java@v5
with:
distribution: ${{ matrix.distribution }}
java-version: ${{ matrix.java }}
- name: Cache Maven
uses: actions/cache@v5
with:
path: ~/.m2/repository
key: ${{ runner.os }}-mvn-checkstyle-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-mvn-checkstyle-
- name: CheckStyle Cache
uses: actions/cache@v5
with:
path: '**/target/checkstyle-cachefile'
key: ${{ runner.os }}-checkstyle-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-checkstyle-
- name: Run Checkstyle
run: ./mvnw -B checkstyle:check -P checkstyle -T2C
pmd:
runs-on: ubuntu-latest
if: ${{ github.event_name != 'pull_request' || !startsWith(github.head_ref, 'renovate/') }}
timeout-minutes: 15
strategy:
matrix:
java: [17]
distribution: [temurin]
steps:
- uses: actions/checkout@v6
- name: Set up JDK
uses: actions/setup-java@v5
with:
distribution: ${{ matrix.distribution }}
java-version: ${{ matrix.java }}
- name: Cache Maven
uses: actions/cache@v5
with:
path: ~/.m2/repository
key: ${{ runner.os }}-mvn-pmd-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-mvn-pmd-
- name: PMD Cache
uses: actions/cache@v5
with:
path: '**/target/pmd/pmd.cache'
key: ${{ runner.os }}-pmd-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-pmd-
- name: Run PMD
run: ./mvnw -B test pmd:aggregate-pmd-no-fork pmd:check -P pmd -DskipTests -T2C
- name: Run CPD (Copy Paste Detector)
# Todo: Readd pmd:cpd-check - Disabled for now due to upstream code
run: ./mvnw -B pmd:aggregate-cpd -P pmd -DskipTests -T2C
- name: Upload report
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v7
with:
name: pmd-report
if-no-files-found: ignore
path: |
target/reports/**