-
-
Notifications
You must be signed in to change notification settings - Fork 77
274 lines (234 loc) · 10.4 KB
/
system-test.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
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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
name: system-test
on:
push:
workflow_dispatch:
jobs:
waitForNative:
uses: ./.github/workflows/buildNative.yml
buildMockserver:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
name: "Check out source"
with:
# Check out last 15 commits
fetch-depth: 15
- name: "Get changed files in core module"
id: changed-files-specific
uses: tj-actions/changed-files@v35
with:
since_last_remote_commit: true
files: |
other/mockserver/**
- if: steps.changed-files-specific.outputs.any_changed == 'true'
run: |
echo "::notice::Will build new mock server container. Changed files since last push:"
echo "${{ steps.changed-files-specific.outputs.all_changed_files }}"
- if: steps.changed-files-specific.outputs.any_changed == 'false'
run: |
echo "::notice::Will skip build of new mock server container. No changed files since last push."
- name: Set up JDK 17
if: steps.changed-files-specific.outputs.any_changed == 'true'
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
cache: 'maven'
- name: "Login to GitHub Container Registry"
if: steps.changed-files-specific.outputs.any_changed == 'true'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: "Build and push mockserver container"
if: steps.changed-files-specific.outputs.any_changed == 'true'
run: |
mvn --batch-mode install -DskipTests -T 1C
cd other/mockserver/
mvn --batch-mode spring-boot:build-image
docker tag mockserver:3.1.0 ghcr.io/theotherp/mockserver:3.1.0
docker push ghcr.io/theotherp/mockserver:3.1.0
runSystemTestsLinux:
needs: [ waitForNative, buildMockserver ]
runs-on: ubuntu-latest
strategy:
matrix:
test: [ { port: 5076, name: core }, { port: 5077, name: v1Migration } ]
env:
spring_profiles_active: build,systemtest,${{ matrix.test.name }}
nzbhydra_port: ${{ matrix.test.port }}
nzbhydra.port: ${{ matrix.test.port }}
nzbhydra_name: ${{ matrix.test.name }}
NZBHYDRANAME: ${{ matrix.test.name }}
nzbhydra.name: ${{ matrix.test.name }}
steps:
- run: echo Running test ${{ matrix.test.name }} with port ${{ matrix.test.port }}
- uses: actions/checkout@v3
name: "Check out source"
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
cache: 'maven'
- name: "Install"
run: mvn --batch-mode clean install -DskipTests -pl org.nzbhydra:nzbhydra2,org.nzbhydra:shared,org.nzbhydra:mapping,org.nzbhydra:assertions
- name: "Create docker network"
run: docker network create systemtest
- name: "Copy v1Migration docker data"
run: |
mkdir -p /tmp/hydra/v1MigrationDataFolder
cp -R tests/system/instanceData/v1Migration/* /tmp/hydra/v1MigrationDataFolder/
- name: "Run docker compose"
run: |
cd docker/docker-compose-systemtest/linux
docker-compose up -d
cd ../../..
- name: "Wait for healthy containers"
run: |
docker ps
sleep 10
docker ps
sleep 10
docker ps
echo "Core container mounts:"
docker container inspect -f '{{ .Mounts}}' core
echo "v1Migration container mounts:"
docker container inspect -f '{{ .Mounts}}' v1Migration
- name: "Run tests"
run: mvn --batch-mode test -pl org.nzbhydra.tests:system -DtrimStackTrace=false
- name: "Write docker-compose logs"
if: always()
run: |
cd docker/docker-compose-systemtest/linux
echo "Writing docker compose logs to files"
docker-compose logs --no-color radarr > docker-compose-radarr.log
docker-compose logs --no-color sonarr > docker-compose-sonarr.log
docker-compose logs --no-color mockserver > docker-compose-mockserver.log
docker-compose logs --no-color core > docker-compose-core.log
docker-compose logs --no-color v1Migration > docker-compose-v1Migration.log
echo "Found log files:"
find . -name "*.log"
cd ../../..
- name: "Truncate large log files"
if: always()
# If the logs are larger than 1MB there's probably something wrong
run: |
for d in ./**/*.log ; do (truncate --size=1M $d); done
- name: "Upload data folder artifact"
uses: actions/upload-artifact@v3
if: always()
with:
name: dataLinux
path: /tmp/hydra
- name: "Upload test logs artifact"
uses: actions/upload-artifact@v3
if: always()
with:
name: ${{ matrix.test.name }}-test-logs
path: tests/**/*.log
- name: "Upload docker logs artifact"
uses: actions/upload-artifact@v3
if: always()
with:
name: ${{ matrix.test.name }}-docker-logs
path: docker/docker-compose-systemtest/linux/*.log
- name: "Create test Report"
uses: dorny/test-reporter@v1
if: always()
continue-on-error: true
with:
name: System test report ${{ matrix.test.name }}
path: "**/surefire-reports/*.xml"
reporter: java-junit
runSystemTestsWindows:
needs: [ waitForNative, buildMockserver ]
runs-on: windows-latest
env:
spring_profiles_active: build,systemtest,core
nzbhydra_port: 5076
nzbhydra.port: 5076
nzbhydra_name: windows
NZBHYDRANAME: windows
nzbhydra.name: windows
steps:
- uses: actions/checkout@v3
name: "Check out source"
- name: "Copy wrapper exe"
run: |
copy releases/windows-release/include/NZBHydra2.exe ./
- name: "Download windows artifact"
uses: actions/download-artifact@master
with:
name: core-windows
path: core.exe
- name: "Start NZBHydra"
run: |
# Produces "The specified executable is not a valid application for this OS platform." on GH runner.
# Start-Process .\NZBHydra2.exe
$Env:SPRING_PROFILES_ACTIVE= "build,systemtest,core"
Start-Process .\core.exe directstart
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
cache: 'maven'
- name: "Install"
run: mvn --batch-mode clean install -DskipTests -pl org.nzbhydra:nzbhydra2,org.nzbhydra:shared,org.nzbhydra:mapping,org.nzbhydra:assertions
- name: "Run docker compose"
run: |
cd docker/docker-compose-systemtest/windows
docker-compose up -d
cd ../../..
- name: "Wait for healthy containers"
run: |
docker ps
sleep 10
docker ps
sleep 10
- name: "Run tests"
run: mvn --batch-mode test -pl org.nzbhydra.tests:system -DtrimStackTrace=false
- name: "Write docker-compose logs"
if: always()
run: |
cd docker/docker-compose-systemtest/windows
echo "Writing docker compose logs to files"
docker-compose logs --no-color radarr > docker-compose-radarr.log
docker-compose logs --no-color sonarr > docker-compose-sonarr.log
docker-compose logs --no-color mockserver > docker-compose-mockserver.log
echo "Found log files:"
find . -name "*.log"
cd ../../..
- name: "Truncate large log files"
if: always()
# If the logs are larger than 1MB there's probably something wrong
run: |
for d in ./**/*.log ; do (truncate --size=1M $d); done
- name: "Upload data folder artifact"
uses: actions/upload-artifact@v3
if: always()
with:
name: dataWindows
path: data
- name: "Upload test logs artifact"
uses: actions/upload-artifact@v3
if: always()
with:
name: windows-test-logs
path: tests/**/*.log
- name: "Upload docker logs artifact"
uses: actions/upload-artifact@v3
if: always()
with:
name: windows-docker-logs
path: docker/*.log
- name: "Create test Report"
uses: dorny/test-reporter@v1
if: always()
continue-on-error: true
with:
name: System test report windows
path: "**/surefire-reports/*.xml"
reporter: java-junit