Skip to content

fix: preserve full transaction attribute state in GrailsTransactionAttribute (web) copy constructors #9708

fix: preserve full transaction attribute state in GrailsTransactionAttribute (web) copy constructors

fix: preserve full transaction attribute state in GrailsTransactionAttribute (web) copy constructors #9708

# 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.
name: "CI - Groovy Joint Validation Build"
on:
push:
branches:
- '[0-9]+.[0-9]+.x'
pull_request:
branches:
- '[0-9]+.[0-9]+.x'
workflow_dispatch:
# queue jobs and only allow 1 run per branch due to the likelihood of hitting GitHub resource limits
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
contents: read
jobs:
build_groovy:
if: ${{ !contains(github.event.head_commit.message, '[skip tests]') }}
runs-on: ubuntu-latest
outputs:
groovyVersion: ${{ steps.groovy-version.outputs.value }}
steps:
- name: "☕️ Setup JDK"
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
with:
java-version: 21
distribution: liberica
- name: "📥 Checkout Grails Core to fetch Gradle Plugin versions it uses"
# Sparse-checkout fetches only the two paths this job actually needs:
# - dependencies.gradle: parsed below to derive the matching Apache
# Groovy branch (GROOVY_<major>_0_X) for this Grails branch.
# - .github/scripts/groovy-joint-build.init.gradle: passed to
# ./gradlew --init-script when publishing Groovy to local Maven so
# the joint build reuses our Develocity / build-cache settings.
# Both paths must be listed here; otherwise the init-script step fails
# with "The specified initialization script ... does not exist."
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
sparse-checkout-cone-mode: false
sparse-checkout: |
dependencies.gradle
.github/scripts/groovy-joint-build.init.gradle
- name: "📝 Derive matching Apache Groovy branch from dependencies.gradle"
id: groovy-branch
run: |
# Extract the major version of `groovy.version` declared in this branch's
# dependencies.gradle (e.g. '5.0.5' -> '5', '4.0.31' -> '4') and use it to
# pick the matching Apache Groovy development branch (GROOVY_<major>_0_X).
# This keeps `7.0.x` PRs validating against Groovy 4 and `8.0.x` PRs
# validating against Groovy 5 without hard-coding the branch here.
GROOVY_MAJOR=$(grep -m 1 "'groovy\.version'" dependencies.gradle | sed -E "s/.*'([0-9]+)\.[0-9]+\.[0-9]+.*/\1/" | tr -d '[:space:]')
if [ -z "$GROOVY_MAJOR" ]; then
echo "::error::Could not determine Apache Groovy major version from dependencies.gradle"
exit 1
fi
GROOVY_BRANCH="GROOVY_${GROOVY_MAJOR}_0_X"
echo "Validating against Apache Groovy branch: $GROOVY_BRANCH"
echo "value=$GROOVY_BRANCH" >> $GITHUB_OUTPUT
rm dependencies.gradle
- name: "📥 Checkout Apache Groovy (${{ steps.groovy-branch.outputs.value }})"
run: git clone --depth 1 https://github.com/apache/groovy.git -b ${{ steps.groovy-branch.outputs.value }} --single-branch
- name: "🐘 Setup Gradle"
uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0
with:
cache-disabled: true # this workflow rebuilds Groovy each run; a Gradle home cache is not useful here
develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
- name: "🔍 Setup TestLens"
uses: testlens-app/setup-testlens@d96a555133c275a00949d2cc77b70fe9a4242ebf # v1.9.2
- name: "📝 Store Groovy version to use when building Grails"
id: groovy-version
run: |
cd groovy
GROOVY_VERSION=$(cat gradle.properties | grep groovyVersion | cut -d\= -f2 | tr -d '[:space:]')
echo "Groovy version $GROOVY_VERSION stored"
echo "value=$GROOVY_VERSION" >> $GITHUB_OUTPUT
- name: "🔨 Publish Groovy to local maven repository (no docs)"
run: |
cd groovy
./gradlew pTML -x groovydoc -x javadoc -x javadocAll -x groovydocAll -x asciidoc -x docGDK \
--init-script $GITHUB_WORKSPACE/.github/scripts/groovy-joint-build.init.gradle
- name: "📤 Share locally built Groovy artifacts with the build_grails job"
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: local-groovy-maven-repo
path: ~/.m2/repository/org/apache/groovy/
if-no-files-found: 'error'
retention-days: 1
build_grails:
needs: [build_groovy]
runs-on: ubuntu-latest
services:
mongodb:
image: mongo:8
ports:
- 27017:27017
options: >-
--health-cmd "mongosh --eval 'db.adminCommand(\"ping\")'"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: "⚙️ Maximize build space"
run: |
echo "-- Dotnet"
sudo rm -rf /usr/share/dotnet
echo "-- Android"
sudo rm -rf /usr/local/lib/android
echo "-- Haskell"
sudo rm -rf /opt/ghc
echo "-- CodeQL"
sudo rm -rf /opt/hostedtoolcache/CodeQL
df -h
- name: "📥 Checkout project"
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: "☕️ Setup JDK"
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
with:
java-version: 21
distribution: liberica
- name: "🐘 Setup Gradle"
uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0
with:
cache-disabled: true # this workflow rebuilds Groovy each run; a Gradle home cache is not useful here
develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
- name: "🔍 Setup TestLens"
uses: testlens-app/setup-testlens@d96a555133c275a00949d2cc77b70fe9a4242ebf # v1.9.2
- name: "📥 Fetch the locally built Groovy artifacts"
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: local-groovy-maven-repo
path: ~/.m2/repository/org/apache/groovy
- name: 'Swap Groovy Version'
run: |
sed -i "/['\"]groovy\.version['\"][[:space:]]*:/c\'groovy.version':'${{ needs.build_groovy.outputs.groovyVersion }}'," dependencies.gradle
- name: "🔨 Build and test Grails using the locally built Groovy snapshot"
# -PskipMicronautProjects excludes the Grails-Micronaut "island" (grails-micronaut,
# grails-micronaut-bom, and the micronaut-tied test-examples) from the build graph.
# That island intentionally pins Groovy 5 / Spock 2.4-groovy-5.0 via grails-micronaut-bom,
# which is incompatible with the Groovy 4.x snapshot this job swaps in above.
# See https://github.com/apache/grails-core/issues/15613.
run: >
./gradlew build
--continue
--stacktrace
-x groovydoc
-PskipCodeStyle
-PskipMicronautProjects
-PmaxTestParallel=3
env:
GRAILS_INCLUDE_MAVEN_LOCAL: true