-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
303 lines (263 loc) · 11.8 KB
/
Copy pathquickstart_ci.yml
File metadata and controls
303 lines (263 loc) · 11.8 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
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
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
# Single CI workflow that tests all quickstarts, and project build.
#
# A quickstart opts in to CI by providing either:
# <qs>/.ci/test-quickstart.env — common flow (sourced by the project runner)
# <qs>/.ci/test-quickstart.sh — fully standalone script
#
# All test logic lives in per-quickstart .ci/ files and the shared project runner
# .ci/test-quickstarts.sh. This workflow handles only GitHub-specific concerns:
# change detection, matrix construction, JDK setup, the WildFly snapshot build,
# and artifact upload on failure.
#
# Job order:
# WildFly-build → Setup → Quickstart-default (always)
# → Quickstart-with-deps (only when WildFly branch exists)
# → Project-default (always)
# → Project-with-deps (only when WildFly branch exists)
name: Quickstarts CI
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
# No paths filter — all PRs trigger; the Setup job decides what actually runs.
# Cancel in-progress runs for the same workflow + ref
concurrency:
group: '${{ github.workflow }} @ ${{ github.ref || github.run_id }}'
cancel-in-progress: true
jobs:
# ---------------------------------------------------------------------------
# Build WildFly from the PR's target branch (if that branch exists in
# wildfly/wildfly). Silently skipped when the branch is not found; downstream
# jobs still run with an empty wildfly-version output.
# ---------------------------------------------------------------------------
WildFly-build:
uses: wildfly/wildfly/.github/workflows/shared-wildfly-build.yml@main
with:
wildfly-branch: ${{ github.base_ref }}
wildfly-repo: "wildfly/wildfly"
# ---------------------------------------------------------------------------
# Detect which quickstarts changed and build two matrix JSON arrays:
# default-matrix — always populated (tests against released WildFly)
# with-deps-matrix — populated only when WildFly-build produced a version
# ---------------------------------------------------------------------------
Setup:
runs-on: ubuntu-latest
needs: [WildFly-build]
outputs:
default-matrix: ${{ steps.build-matrix.outputs.default-matrix }}
with-deps-matrix: ${{ steps.build-matrix.outputs.with-deps-matrix }}
wildfly-version: ${{ steps.build-matrix.outputs.wildfly-version }}
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Build test matrices
id: build-matrix
env:
WILDFLY_VERSION: ${{ needs.WildFly-build.outputs.wildfly-version }}
run: |
BASE="${{ github.base_ref }}"
changed=$(git diff --name-only "origin/${BASE}...HEAD" 2>/dev/null || git diff --name-only HEAD~1)
# Shared infrastructure paths — any change here runs all quickstarts
run_all=false
for path in shared-doc .ci pom.xml .github/workflows/quickstart_ci.yml; do
if echo "${changed}" | grep -q "^${path}"; then
run_all=true
echo "Shared infra change detected (${path}) — running all quickstarts"
break
fi
done
# Collect all testable quickstarts (have .ci/test-quickstart.env OR
# .ci/test-quickstart.sh), deduplicated and sorted
all_qs=()
for marker in */.ci/test-quickstart.env */.ci/test-quickstart.sh; do
[[ -f "${marker}" ]] || continue
qs="$(dirname "$(dirname "${marker}")")"
all_qs+=("${qs}")
done
# Deduplicate and sort
IFS=$'\n' all_qs=($(printf '%s\n' "${all_qs[@]}" | sort -u)); unset IFS
# Filter to changed quickstarts unless run_all=true
to_test=()
for qs in "${all_qs[@]}"; do
if ${run_all} || echo "${changed}" | grep -q "^${qs}/"; then
to_test+=("${qs}")
fi
done
echo "Quickstarts to test: ${to_test[*]:-none}"
JDKS=(17 25)
default_entries=()
with_deps_entries=()
for qs in "${to_test[@]}"; do
# Read QS_LINUX_ONLY:
# .env quickstarts → source test-quickstart.env in a subshell
# standalone .sh → grep for 'export QS_LINUX_ONLY=true' near the top
# (sourcing is unsafe: the script uses set -euo pipefail
# and runs server/docker commands on execution)
qs_linux_only="false"
if [[ -f "${qs}/.ci/test-quickstart.env" ]]; then
qs_linux_only=$(set -a; source "${qs}/.ci/test-quickstart.env" 2>/dev/null; echo "${QS_LINUX_ONLY:-false}")
elif [[ -f "${qs}/.ci/test-quickstart.sh" ]]; then
grep -q "^export QS_LINUX_ONLY=true" "${qs}/.ci/test-quickstart.sh" && qs_linux_only="true"
fi
for jdk in "${JDKS[@]}"; do
entry_ubuntu="{\"qs\":\"${qs}\",\"os\":\"ubuntu-latest\",\"jdk\":${jdk}}"
entry_windows="{\"qs\":\"${qs}\",\"os\":\"windows-latest\",\"jdk\":${jdk}}"
default_entries+=("${entry_ubuntu}")
[[ -n "${WILDFLY_VERSION}" ]] && with_deps_entries+=("${entry_ubuntu}")
if [[ "${qs_linux_only}" != "true" ]]; then
default_entries+=("${entry_windows}")
[[ -n "${WILDFLY_VERSION}" ]] && with_deps_entries+=("${entry_windows}")
fi
done
done
# Emit outputs
if [[ ${#default_entries[@]} -gt 0 ]]; then
default_json="[$(IFS=,; echo "${default_entries[*]}")]"
else
default_json="[]"
fi
if [[ ${#with_deps_entries[@]} -gt 0 ]]; then
with_deps_json="[$(IFS=,; echo "${with_deps_entries[*]}")]"
else
with_deps_json="[]"
fi
echo "default-matrix=${default_json}" >> "$GITHUB_OUTPUT"
echo "with-deps-matrix=${with_deps_json}" >> "$GITHUB_OUTPUT"
echo "wildfly-version=${WILDFLY_VERSION}" >> "$GITHUB_OUTPUT"
echo "default-matrix entries: ${#default_entries[@]}"
echo "with-deps-matrix entries: ${#with_deps_entries[@]}"
shell: bash
# ---------------------------------------------------------------------------
# Test against the released WildFly version (always runs when matrix non-empty)
# ---------------------------------------------------------------------------
Quickstart-default:
name: "${{ matrix.qs }} — JDK ${{ matrix.jdk }} — ${{ matrix.os }}"
runs-on: ${{ matrix.os }}
needs: [Setup]
if: needs.Setup.outputs.default-matrix != '[]'
strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(needs.Setup.outputs.default-matrix) }}
steps:
- uses: actions/checkout@v7
- name: Set up JDK ${{ matrix.jdk }}
uses: actions/setup-java@v6
with:
java-version: ${{ matrix.jdk }}
distribution: temurin
cache: maven
- name: Run quickstart tests
run: .ci/test-quickstarts.sh -q ${{ matrix.qs }}
shell: bash
- uses: actions/upload-artifact@v7
if: failure()
with:
name: surefire-${{ matrix.qs }}-JDK${{ matrix.jdk }}-${{ matrix.os }}
path: "${{ matrix.qs }}/**/surefire-reports/*.txt"
# ---------------------------------------------------------------------------
# Test against the WildFly snapshot built from the same branch name
# (only runs when WildFly-build produced a wildfly-version output)
# ---------------------------------------------------------------------------
Quickstart-with-deps:
name: "${{ matrix.qs }} — JDK ${{ matrix.jdk }} — ${{ matrix.os }} — ${{ needs.Setup.outputs.wildfly-version }}"
runs-on: ${{ matrix.os }}
needs: [Setup, WildFly-build]
if: needs.Setup.outputs.with-deps-matrix != '[]'
strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(needs.Setup.outputs.with-deps-matrix) }}
steps:
- uses: actions/checkout@v7
- name: Set up JDK ${{ matrix.jdk }}
uses: actions/setup-java@v6
with:
java-version: ${{ matrix.jdk }}
distribution: temurin
cache: maven
- name: Download WildFly Maven repository
uses: actions/download-artifact@v8
with:
name: wildfly-maven-repository
path: .
- name: Extract WildFly Maven repository
run: tar -xzf wildfly-maven-repository.tar.gz -C ~
shell: bash
- name: Run quickstart tests
env:
VERSION_SERVER: ${{ needs.Setup.outputs.wildfly-version }}
run: .ci/test-quickstarts.sh -q ${{ matrix.qs }}
shell: bash
- uses: actions/upload-artifact@v7
if: failure()
with:
name: surefire-${{ matrix.qs }}-JDK${{ matrix.jdk }}-${{ matrix.os }}-${{ needs.Setup.outputs.wildfly-version }}
path: "${{ matrix.qs }}/**/surefire-reports/*.txt"
# ---------------------------------------------------------------------------
# Project release build against the released WildFly version (always runs).
# Runs mvn clean install -Drelease skipping provisioned-server and bootable-jar
# profiles, which are covered by the per-quickstart Test-* jobs.
# ---------------------------------------------------------------------------
Project-default:
name: "Project: JDK ${{ matrix.jdk }} — ${{ matrix.os }}"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
jdk: [17, 25]
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v7
- name: Set up JDK ${{ matrix.jdk }}
uses: actions/setup-java@v6
with:
java-version: ${{ matrix.jdk }}
distribution: temurin
cache: maven
- name: Build project release
run: mvn -U -B -fae clean install -Drelease -P-provisioned-server,-bootable-jar
shell: bash
- uses: actions/upload-artifact@v7
if: failure()
with:
name: surefire-project-JDK${{ matrix.jdk }}-${{ matrix.os }}
path: "**/surefire-reports/*.txt"
# ---------------------------------------------------------------------------
# Project release build against the WildFly snapshot (only when WildFly-build
# produced a wildfly-version output).
# ---------------------------------------------------------------------------
Project-with-deps:
name: "Project: JDK ${{ matrix.jdk }} — ${{ matrix.os }} — ${{ needs.WildFly-build.outputs.wildfly-version }}"
runs-on: ${{ matrix.os }}
needs: [WildFly-build]
if: needs.WildFly-build.outputs.wildfly-version != ''
strategy:
fail-fast: false
matrix:
jdk: [17, 25]
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v7
- name: Set up JDK ${{ matrix.jdk }}
uses: actions/setup-java@v6
with:
java-version: ${{ matrix.jdk }}
distribution: temurin
cache: maven
- name: Download WildFly Maven repository
uses: actions/download-artifact@v8
with:
name: wildfly-maven-repository
path: .
- name: Extract WildFly Maven repository
run: tar -xzf wildfly-maven-repository.tar.gz -C ~
shell: bash
- name: Build project release with snapshot server
run: mvn -U -B -fae clean install -Drelease -P-provisioned-server,-bootable-jar -Dversion.server=${{ needs.WildFly-build.outputs.wildfly-version }}
shell: bash
- uses: actions/upload-artifact@v7
if: failure()
with:
name: surefire-project-JDK${{ matrix.jdk }}-${{ matrix.os }}-${{ needs.WildFly-build.outputs.wildfly-version }}
path: "**/surefire-reports/*.txt"