Skip to content

9.0 (fix): Report a failure an error handler answered once on Spring Framework 7.1 #3815

9.0 (fix): Report a failure an error handler answered once on Spring Framework 7.1

9.0 (fix): Report a failure an error handler answered once on Spring Framework 7.1 #3815

Workflow file for this run

# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# The end-to-end suite is its own Gradle build, so the core build never reaches it and
# `./gradlew build` at the root is unaffected.
#
# It resolves Grails from the artifacts the core build publishes rather than by project
# substitution - that is what makes the tests end-to-end. The repository is the same
# build/local-maven that grails-forge points its generated applications at, populated by
# publishAllPublicationsToTestCaseMavenRepoRepository, so the suite exercises real poms and
# module metadata including the CLI companion artifacts. That is a hard requirement for some of
# these projects rather than a nicety: spring-dependency-management imports grails-bom as a Maven
# BOM through io.spring.dependency-management, which resolves it in its own detached configuration
# and so can only ever consume a published pom.
#
# It also needs two JDKs, which is the other reason it gets its own workflow: the Grails 7
# fixture must be compiled on Java 17 (the minimum for a Grails 7 app, so the binary matches
# what a real Grails 7 plugin is built with), while the core build and the Grails 8
# application consuming the fixture need 21. The Grails 8 side simply tracks the repository's
# root .sdkmanrc - it has to run on whatever the core build it consumes runs on - and only the
# fixture carries its own pin. The steps below read both out of those files rather than relying
# on Gradle toolchain auto-detection.
#
# A third, GraalVM 25.2, builds the native-i18n image at the end of the job, from the same published
# artifacts.
name: "End to End"
on:
push:
branches:
- '[0-9]+.[0-9]+.x'
pull_request:
# ready_for_review is not a default type: a draft runs nothing until it is ready or labelled "run ci".
types: [ opened, synchronize, reopened, ready_for_review ]
workflow_dispatch:
inputs:
run-tests:
description: "Run the test jobs where the branch rule would skip them (a release branch below the default); a [skip tests] head commit still skips them"
type: boolean
default: false
# One run per branch or pull request: a new commit cancels the run in flight, whose result would be for a
# superseded commit. This workflow publishes nothing, so nothing here needs to survive the cancel.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
policy:
name: "CI policy"
# A pull request labelled "no ci", or a draft without the "run ci" label, skips this job; every other
# job needs it, so nothing runs for such a pull request.
if: >-
github.event_name != 'pull_request'
|| (!contains(github.event.pull_request.labels.*.name, 'no ci')
&& (!github.event.pull_request.draft || contains(github.event.pull_request.labels.*.name, 'run ci')))
uses: ./.github/workflows/ci-policy.yml
endToEnd:
name: "End to End Tests (end-to-end build only)"
needs: [ policy ]
if: ${{ needs.policy.outputs.run-tests == 'true' }}
runs-on: ubuntu-24.04
steps:
- name: "πŸ“₯ Checkout repository"
uses: actions/checkout@v7.0.1
- name: "β˜•οΈ Determine JDKs from .sdkmanrc"
# Read both pins out of the files that already declare them. Only the major is kept:
# `sdk env` gives a developer the exact Liberica patch, but the fixture and the suite are
# test builds outside the reproducible-build surface, so CI deliberately takes the
# runner's current release of each major rather than pinning patch versions here.
id: jdks
run: |
set -euo pipefail
fixture_java=$(grep -E '^java=' end-to-end/legacy-g7-command-plugin/.sdkmanrc | cut -d= -f2)
build_java=$(grep -E '^java=' .sdkmanrc | cut -d= -f2)
echo "fixture-java=${fixture_java%%.*}" >> "$GITHUB_OUTPUT"
echo "build-java=${build_java%%.*}" >> "$GITHUB_OUTPUT"
echo "Grails 7 fixture JDK: ${fixture_java}"
echo "end-to-end build JDK (from root .sdkmanrc): ${build_java}"
- name: "β˜•οΈ Setup JDKs"
# Both, in one step. The last version listed becomes the default JAVA_HOME (the Grails 8
# side); the fixture step below switches to the matching JAVA_HOME_<major>_X64 for its
# single invocation.
uses: actions/setup-java@v6.1.0
with:
distribution: liberica
java-version: |
${{ steps.jdks.outputs.fixture-java }}
${{ steps.jdks.outputs.build-java }}
- name: "πŸ—„οΈ Decide the Gradle cache mode"
id: gradle-cache-policy
uses: ./.github/actions/gradle-cache-policy
- name: "🐘 Setup Gradle"
uses: gradle/actions/setup-gradle@3f5f9adaf7d9fecd50b5935e54106014257a94e6 # v6.4.0
with:
# Decided by the step above; see .github/actions/gradle-cache-policy.
cache-read-only: ${{ steps.gradle-cache-policy.outputs.read-only }}
develocity-access-key: ${{ secrets.GRAILS_DEVELOCITY_ACCESS_KEY }}
- name: "πŸ“¦ Setup: publish grails-gradle to the local repository the tests resolve from"
# Both builds publish into the same build/local-maven, and both are needed: the Grails BOM
# constrains org.apache.grails.gradle artifacts. grails-forge depends on this same pair of
# publish tasks for the applications its tests generate.
working-directory: 'grails-gradle'
run: ./gradlew publishAllPublicationsToTestCaseMavenRepoRepository -PskipTests --stacktrace
- name: "πŸ“¦ Setup: publish Grails to the local repository the tests resolve from"
id: publish-grails
run: ./gradlew publishAllPublicationsToTestCaseMavenRepoRepository -PskipTests --stacktrace
- name: "πŸ“¦ Setup: build the precompiled Grails 7 / Groovy 4 fixture"
working-directory: 'end-to-end/legacy-g7-command-plugin'
env:
# Derived from the major the jdks step read out of the fixture's .sdkmanrc, so a fixture
# JDK bump changes this lookup with it instead of leaving a stale literal behind.
JAVA_HOME: ${{ env[format('JAVA_HOME_{0}_X64', steps.jdks.outputs.fixture-java)] }}
run: |
set -euo pipefail
if [ -z "${JAVA_HOME:-}" ]; then
echo "setup-java did not provision JDK ${{ steps.jdks.outputs.fixture-java }}; refusing to build the fixture on the default JDK" >&2
exit 1
fi
./gradlew jar --stacktrace
- name: "πŸ” Verify the fixture really was built by the Grails 7 toolchain"
working-directory: 'end-to-end/legacy-g7-command-plugin'
# A fixture silently built by the wrong toolchain would still pass the suite while
# proving nothing, so fail loudly here instead. Grails-/Groovy-Compile-Version come from
# the resolved BOM and Build-Jdk-Spec from the JVM that ran Gradle (all stamped into the
# manifest at jar time); the class-file major version is the ground truth for what the
# bytecode actually targets, since the fixture deliberately sets no toolchain or release.
run: |
set -euo pipefail
fixture_java='${{ steps.jdks.outputs.fixture-java }}'
jar=$(ls build/libs/*.jar)
unzip -p "$jar" META-INF/MANIFEST.MF | tr -d '\r' > /tmp/fixture-manifest
cat /tmp/fixture-manifest
grep -q '^Grails-Compile-Version: 7\.' /tmp/fixture-manifest
grep -q '^Groovy-Compile-Version: 4\.' /tmp/fixture-manifest
grep -q "^Build-Jdk-Spec: ${fixture_java}\$" /tmp/fixture-manifest
expected_major=$((fixture_java + 44))
actual_major=$(unzip -p "$jar" legacy/g7/commands/HelloG7PrecompiledCommand.class \
| od -An -t u1 -j 6 -N 2 | awk 'NF { print $1 * 256 + $2; exit }')
echo "class-file major version: ${actual_major} (expected ${expected_major} for Java ${fixture_java})"
[ "$actual_major" -eq "$expected_major" ]
- name: "πŸ” Setup TestLens"
uses: testlens-app/setup-testlens@89edf53f781ac41833b4bc74d0e19a5315c79c67 # v1.10.0
- name: "πŸ§ͺ Run the end-to-end tests"
# Only the end-to-end build. grails-core's own unit and functional suites are the CI
# workflow's job; nothing here re-runs them. The publish steps above are setup, not tests.
working-directory: 'end-to-end'
env:
DO_NOT_CACHE_TESTS: '1'
run: ./gradlew check --continue --stacktrace
- name: "β˜•οΈ Setup GraalVM for the native image"
# In this job rather than its own, so the image is built from the framework published above
# instead of publishing it a second time. It runs whether or not the tests above passed, and
# leaves JAVA_HOME alone: only the step below uses GraalVM.
if: ${{ !cancelled() && steps.publish-grails.outcome == 'success' }}
uses: graalvm/setup-graalvm@27b360dbb857524eaf0b4c4cef364d38e5b4f173 # v1.6.7
with:
distribution: graalvm-community
# The GraalVM release, not just the JDK: a java-version alone resolves to the last release tagged
# by JDK version, CE 25.0.2, which still cannot compile Groovy 4 or later. Releases since are
# tagged by GraalVM version, which is what this selects.
version: '25.2'
java-version: '25'
set-java-home: 'false'
check-for-updates: 'false'
- name: "πŸ§ͺ Build and run the native-i18n image"
# The native half of native-i18n: compile the application to a binary with no recorded
# metadata and resolve every message bundle from it. GraalVM 25.2 or later, because GraalVM 21 and
# the first GraalVM 25 releases cannot compile Groovy 4 or later (oracle/graal#10200); see
# end-to-end/README.md.
if: ${{ !cancelled() && steps.publish-grails.outcome == 'success' }}
working-directory: 'end-to-end'
env:
JAVA_HOME: ${{ env.GRAALVM_HOME }}
run: |
set -euo pipefail
if [ -z "${JAVA_HOME:-}" ]; then
echo "setup-graalvm did not set GRAALVM_HOME; refusing to build the image on another JDK" >&2
exit 1
fi
./gradlew :native-i18n:i18nCheckOnNative -PnativeTests --stacktrace
- name: "πŸ“€ Upload test reports"
if: failure()
uses: actions/upload-artifact@v7.0.1
with:
name: end-to-end-test-reports
path: end-to-end/**/build/reports/tests/**