Skip to content

[WFLY-21303] CI testsuite redesign; include… #3

[WFLY-21303] CI testsuite redesign; include…

[WFLY-21303] CI testsuite redesign; include… #3

Workflow file for this run

# Single CI workflow for all WildFly quickstarts.
#
# 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 → Test-default (always)
# → Test-with-deps (only when WildFly branch exists)
name: WildFly Quickstarts CI v2
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@v4
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)
# ---------------------------------------------------------------------------
Test-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@v4
- name: Set up JDK ${{ matrix.jdk }}
uses: actions/setup-java@v4
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@v4
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)
# ---------------------------------------------------------------------------
Test-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@v4
- name: Set up JDK ${{ matrix.jdk }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.jdk }}
distribution: temurin
cache: maven
- name: Download WildFly Maven repository
uses: actions/download-artifact@v4
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@v4
if: failure()
with:
name: surefire-${{ matrix.qs }}-JDK${{ matrix.jdk }}-${{ matrix.os }}-${{ needs.Setup.outputs.wildfly-version }}
path: "${{ matrix.qs }}/**/surefire-reports/*.txt"