Skip to content

Commit

Permalink
Merge branch '4.0.x' into renovate/javaparserversion
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesfredley authored Oct 1, 2024
2 parents 9797f38 + b5c2235 commit 99f66a7
Show file tree
Hide file tree
Showing 19 changed files with 300 additions and 221 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
id: tests
uses: gradle/gradle-build-action@v3
with:
arguments: check
arguments: check -Dgeb.env=chromeHeadless
env:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }}
Expand All @@ -43,7 +43,7 @@ jobs:
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }}
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }}
with:
arguments: build
arguments: build -Dgeb.env=chromeHeadless
- name: Publish Test Report
if: steps.build.outcome == 'failure' || steps.tests.outcome == 'failure'
uses: scacap/action-surefire-report@v1
Expand Down
199 changes: 97 additions & 102 deletions .github/workflows/groovy-joint-workflow.yml
Original file line number Diff line number Diff line change
@@ -1,150 +1,145 @@
# 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
#
# http://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: "Grails Joint Validation Build"
# GROOVY_2_5_X == Grails 4.0.x
# GROOVY_3_0_X == grails master
# Groovy master branch does not map to any due to changed package names.
name: "Groovy Joint Validation Build"
on:
push:
branches:
- '[3-9]+.[1-9]+.x'
- '[3-9]+.[0-9]+.x'
pull_request:
branches:
- '[3-9]+.[1-9]+.x'
- '[3-9]+.[0-9]+.x'
workflow_dispatch:
permissions:
contents: read
env:
CI_GROOVY_VERSION:
jobs:
build_groovy:
strategy:
fail-fast: true
runs-on: ubuntu-latest
outputs:
groovyVersion: ${{ steps.groovy-version.outputs.value }}
steps:
- name: Set up JDK
- name: "☕️ Setup JDK"
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Cache local Maven repository & Groovy
distribution: temurin
java-version: 17
- name: "🗄️ Cache local Maven repository"
uses: actions/cache@v4
with:
path: |
~/groovy
~/.m2/repository
key: cache-local-groovy-maven-${{ github.sha }}
- name: Checkout Groovy 3_0_X (Grails 5 and later)
if: startsWith(github.ref, 'refs/heads/3.') || startsWith(github.base_ref, '3.')
run: cd .. && git clone --depth 1 https://github.com/apache/groovy.git -b GROOVY_3_0_X --single-branch
- name: Set CI_GROOVY_VERSION for Grails
path: ~/.m2/repository
key: cache-local-maven-${{ github.sha }}
- name: "📥 Checkout Grails Testing Support to fetch Gradle Plugin versions it uses"
uses: actions/checkout@v4
with:
sparse-checkout-cone-mode: false
sparse-checkout: settings.gradle
- name: "📝 Store the Gradle Plugin versions used in Grails Testing Support"
id: gradle-plugin-versions
run: |
DEVELOCITY_PLUGIN_VERSION=$(grep -m 1 'id\s*\(\"com.gradle.develocity\"\|'"'com.gradle.develocity'"'\)\s*version' settings.gradle | sed -E "s/.*version[[:space:]]*['\"]?([0-9]+\.[0-9]+(\.[0-9]+)?)['\"]?.*/\1/" | tr -d [:space:])
COMMON_CUSTOM_USER_DATA_PLUGIN_VERSION=$(grep -m 1 'id\s*\(\"com.gradle.common-custom-user-data-gradle-plugin\"\|'"'com.gradle.common-custom-user-data-gradle-plugin'"'\)\s*version' settings.gradle | sed -E "s/.*version[[:space:]]*['\"]?([0-9]+\.[0-9]+(\.[0-9]+)?)['\"]?.*/\1/" | tr -d [:space:])
echo "Project uses Develocity Plugin version: $DEVELOCITY_PLUGIN_VERSION"
echo "Project uses Common Custom User Data Plugin version: $COMMON_CUSTOM_USER_DATA_PLUGIN_VERSION"
echo "develocity_plugin_version=$DEVELOCITY_PLUGIN_VERSION" >> $GITHUB_OUTPUT
echo "common_custom_user_data_plugin_version=$COMMON_CUSTOM_USER_DATA_PLUGIN_VERSION" >> $GITHUB_OUTPUT
rm settings.gradle
- name: "📥 Checkout Groovy 4_0_X (Grails 7 and later)"
run: git clone --depth 1 https://github.com/apache/groovy.git -b GROOVY_4_0_X --single-branch
- name: "🐘 Setup Gradle"
uses: gradle/actions/setup-gradle@v4
with:
develocity-access-key: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
- name: "📝 Store Groovy version to use when building Grails Testing Support"
id: groovy-version
run: |
cd ../groovy
echo "CI_GROOVY_VERSION=$(cat gradle.properties | grep groovyVersion | cut -d\= -f2 | tr -d '[:space:]')" >> $GITHUB_ENV
echo "value=$(cat gradle.properties | grep groovyVersion | cut -d\= -f2 | tr -d '[:space:]')" >> $GITHUB_OUTPUT
- name: Prepare GE Set-up Configuration
id: ge_conf
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: "🐘 Configure Gradle Plugins (Step 1/3)"
id: develocity-conf-1
run: |
echo "VALUE<<EOF" >> $GITHUB_OUTPUT
echo "plugins { " >> $GITHUB_OUTPUT
echo " id 'com.gradle.enterprise' version '3.15.1'" >> $GITHUB_OUTPUT
echo " id 'com.gradle.common-custom-user-data-gradle-plugin' version '1.11.3'" >> $GITHUB_OUTPUT
echo "}" >> $GITHUB_OUTPUT
echo " id 'com.gradle.develocity' version '${{ steps.gradle-plugin-versions.outputs.develocity_plugin_version }}'" >> $GITHUB_OUTPUT
echo " id 'com.gradle.common-custom-user-data-gradle-plugin' version '${{ steps.gradle-plugin-versions.outputs.common_custom_user_data_plugin_version }}'" >> $GITHUB_OUTPUT
echo "}" >> $GITHUB_OUTPUT
echo "" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: "🐘 Configure Gradle Plugins (Step 2/3)"
id: develocity-conf-2
run: |
echo "VALUE<<EOF" >> $GITHUB_OUTPUT
echo "def isAuthenticated = System.getenv('DEVELOCITY_ACCESS_KEY') != null" >> $GITHUB_OUTPUT
echo "def isBuildCacheAuthenticated =" >> $GITHUB_OUTPUT
echo " System.getenv('DEVELOCITY_BUILD_CACHE_NODE_USER') != null &&" >> $GITHUB_OUTPUT
echo " System.getenv('DEVELOCITY_BUILD_CACHE_NODE_KEY') != null" >> $GITHUB_OUTPUT
echo "" >> $GITHUB_OUTPUT
echo "gradleEnterprise {" >> $GITHUB_OUTPUT
echo "develocity {" >> $GITHUB_OUTPUT
echo " server = 'https://ge.grails.org'" >> $GITHUB_OUTPUT
echo " buildScan {" >> $GITHUB_OUTPUT
echo " publishAlways()" >> $GITHUB_OUTPUT
echo " publishIfAuthenticated()" >> $GITHUB_OUTPUT
echo " uploadInBackground = System.getenv('CI') == null" >> $GITHUB_OUTPUT
echo " capture {" >> $GITHUB_OUTPUT
echo " taskInputFiles = true" >> $GITHUB_OUTPUT
echo " }" >> $GITHUB_OUTPUT
echo " publishing.onlyIf { isAuthenticated }" >> $GITHUB_OUTPUT
echo " uploadInBackground = false" >> $GITHUB_OUTPUT
echo " }" >> $GITHUB_OUTPUT
echo "}" >> $GITHUB_OUTPUT
echo "" >> $GITHUB_OUTPUT
echo "buildCache {" >> $GITHUB_OUTPUT
echo " local { enabled = System.getenv('CI') != 'true' }" >> $GITHUB_OUTPUT
echo " remote(HttpBuildCache) {" >> $GITHUB_OUTPUT
echo " push = System.getenv('CI') == 'true'" >> $GITHUB_OUTPUT
echo " local { enabled = false }" >> $GITHUB_OUTPUT
echo " remote(develocity.buildCache) {" >> $GITHUB_OUTPUT
echo " push = isBuildCacheAuthenticated" >> $GITHUB_OUTPUT
echo " enabled = true" >> $GITHUB_OUTPUT
echo " url = 'https://ge.grails.org/cache/'" >> $GITHUB_OUTPUT
echo " credentials {" >> $GITHUB_OUTPUT
echo " username = System.getenv('GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER')" >> $GITHUB_OUTPUT
echo " password = System.getenv('GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY')" >> $GITHUB_OUTPUT
echo " }" >> $GITHUB_OUTPUT
echo " usernameAndPassword(" >> $GITHUB_OUTPUT
echo " System.getenv('DEVELOCITY_BUILD_CACHE_NODE_USER') ?: ''," >> $GITHUB_OUTPUT
echo " System.getenv('DEVELOCITY_BUILD_CACHE_NODE_KEY') ?: ''" >> $GITHUB_OUTPUT
echo " )" >> $GITHUB_OUTPUT
echo " }" >> $GITHUB_OUTPUT
echo "}" >> $GITHUB_OUTPUT
echo "" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Gradle Enterprise Set-up
- name: "🐘 Configure Gradle Plugins (step 3/3)"
run: |
cd ../groovy
# Delete exiting plugins and build-scan from settings.gradle file
sed -i '21,31d' settings.gradle
# Add Gradle Enterprise set-up related configuration after line no 20 in settings.gradle
echo "${{ steps.ge_conf.outputs.value}}" | sed -i -e "20r /dev/stdin" settings.gradle
- name: Build and install groovy (no docs)
uses: gradle/gradle-build-action@v3
cd groovy
# Delete existing plugins from settings.gradle file
sed -i '32,37d' settings.gradle
# Add Develocity setup related configuration after line no 31 in settings.gradle
echo "${{ steps.develocity-conf-1.outputs.value }}" | sed -i -e "31r /dev/stdin" settings.gradle
# Delete existing buildCache configuration from gradle/build-scans.gradle file
sed -i '23,46d' gradle/build-scans.gradle
# Add Develocity setup related configuration after line no 22 in gradle/build-scans.gradle
echo "${{ steps.develocity-conf-2.outputs.value }}" | sed -i -e "22r /dev/stdin" gradle/build-scans.gradle
- name: "🔨 Publish Groovy to local maven repository (no docs)"
env:
GRADLE_SCANS_ACCEPT: yes
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }}
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }}
with:
build-root-directory: ../groovy
arguments: |
install
-x groovydoc
-x javadoc
-x javadocAll
-x groovydocAll
-x asciidoc
-x docGDK
DEVELOCITY_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }}
DEVELOCITY_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }}
run: |
cd groovy
./gradlew pTML -x groovydoc -x javadoc -x javadocAll -x groovydocAll -x asciidoc -x docGDK
build_grails_testing_support:
needs: [build_groovy]
strategy:
fail-fast: true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK
- name: "📥 Checkout project"
uses: actions/checkout@v4
- name: "☕️ Setup JDK"
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- name: Cache local Maven repository & Groovy
- name: "🐘 Setup Gradle"
uses: gradle/actions/setup-gradle@v4
with:
develocity-access-key: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
- name: "🗄️ Restore local Maven repository from cache"
uses: actions/cache@v4
with:
path: |
~/groovy
~/.m2/repository
key: cache-local-groovy-maven-${{ github.sha }}
- name: Set CI_GROOVY_VERSION for Grails
run: |
echo "CI_GROOVY_VERSION=${{needs.build_groovy.outputs.groovyVersion}}" >> $GITHUB_ENV
- name: Build
id: build
uses: gradle/gradle-build-action@v3
path: ~/.m2/repository
key: cache-local-maven-${{ github.sha }}
- name: "🪶 Add mavenLocal repository to build"
run: sed -i 's|// mavenLocal() // Keep|mavenLocal() // Keep|' build.gradle
- name: "🔨 Build and test Grails Testing Support using the locally built Groovy snapshot"
env:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }}
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }}
with:
arguments: build
DEVELOCITY_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }}
DEVELOCITY_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }}
run: >
./gradlew build
-Dgeb.env=chromeHeadless
-PgroovyVersion=${{needs.build_groovy.outputs.groovyVersion}}
-x groovydoc
20 changes: 16 additions & 4 deletions README.adoc
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
# Grails Testing Support

image:https://github.com/grails/grails-testing-support/actions/workflows/gradle.yml/badge.svg["Java CI", link: "https://github.com/grails/grails-testing-support/actions/workflows/gradle.yml"]
image:https://img.shields.io/badge/Revved%20up%20by-Develocity-06A0CE?logo=Gradle&labelColor=02303A["Revved up by Develocity", link=https://ge.grails.org/scans]
image:https://github.com/grails/grails-testing-support/actions/workflows/gradle.yml/badge.svg?event=push["Java CI", link=https://github.com/grails/grails-testing-support/actions/workflows/gradle.yml]
image:https://github.com/grails/grails-testing-support/actions/workflows/groovy-joint-workflow.yml/badge.svg?event=push["Groovy Joint Validation Build", link=https://github.com/grails/grails-testing-support/actions/workflows/groovy-joint-workflow.yml]

Documentation is available at link:https://testing.grails.org[https://testing.grails.org/]

Grails 3.x branch is https://github.com/grails/grails-testing-support/tree/1.1.x[1.1.x].
Documentation SNAPSHOT is available at link:https://testing.grails.org/snapshot/guide/index.html[https://testing.grails.org/snapshot/guide/index.html]

Grails 4.0.x branch is https://github.com/grails/grails-testing-support/tree/2.1.x[2.1.x].
Grails 7.0 branch is https://github.com/grails/grails-testing-support/tree/4.0.x[4.0.x]

Grails 6.2 branch is https://github.com/grails/grails-testing-support/tree/3.2.x[3.2.x]

Grails 6.1 branch is https://github.com/grails/grails-testing-support/tree/3.1.x[3.1.x]

Grails 6 branch is https://github.com/grails/grails-testing-support/tree/3.0.x[3.0.x]

Grails 5 branch is https://github.com/grails/grails-testing-support/tree/2.4.x[2.4.x] which includes support for Groovy 3.

Please checkout https://github.com/grails/grails-testing-support/releases[release notes] for more information.
Grails 4.0.x branch is https://github.com/grails/grails-testing-support/tree/2.1.x[2.1.x].

Grails 3.x branch is https://github.com/grails/grails-testing-support/tree/1.1.x[1.1.x].

Please see https://github.com/grails/grails-testing-support/releases[release notes] for more information.
4 changes: 3 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ allprojects {
repositories {
maven { url "https://repo.grails.org/grails/core" }
mavenCentral()
// mavenLocal() // Keep, this will be uncommented and used by CI (groovy-joint-workflow)
if (groovyVersion && groovyVersion.endsWith('-SNAPSHOT')) {
maven {
name = 'ASF Snapshot repo'
Expand Down Expand Up @@ -72,7 +73,7 @@ subprojects { project ->
apply plugin: "groovy"
if (project.name.startsWith("examples")) {
apply plugin: "org.grails.grails-web"
apply plugin: "org.grails.plugins.views-json"
//apply plugin: "org.grails.plugins.views-json"
} else {
apply plugin: "java-library"
if (isGrailsPlugin) {
Expand Down Expand Up @@ -125,6 +126,7 @@ subprojects { project ->
testImplementation "org.junit.jupiter:junit-jupiter-api:$junitJupiterVersion"
testImplementation "org.junit.platform:junit-platform-runner:$junitPlatformVersion"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitJupiterVersion"
testRuntimeOnly "org.junit.platform:junit-platform-commons:$junitPlatformVersion"
}

tasks.withType(Test) {
Expand Down
15 changes: 7 additions & 8 deletions examples/demo33/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ apply plugin:"com.github.erdi.webdriver-binaries"

webdriverBinaries {
if (!System.getenv().containsKey('CI')) {
chromedriver "$chromeDriverVersion"
geckodriver "$geckodriverVersion"
chromedriver "$chromeDriverVersion"
}
}

Expand Down Expand Up @@ -45,17 +45,16 @@ dependencies {
runtimeOnly "com.h2database:h2"
runtimeOnly "org.apache.tomcat:tomcat-jdbc"
runtimeOnly "com.bertramlabs.plugins:asset-pipeline-grails:$assetPipelineVersion"
testImplementation "org.grails.plugins:geb"
testRuntimeOnly "org.seleniumhq.selenium:htmlunit-driver:$seleniumHtmlunitVersion"
testRuntimeOnly "net.sourceforge.htmlunit:htmlunit:$htmlunitVersion"

testImplementation project(':grails-web-testing-support')
testImplementation project(':grails-gorm-testing-support')

testImplementation "org.seleniumhq.selenium:selenium-remote-driver:$seleniumVersion"
testImplementation "org.seleniumhq.selenium:selenium-api:$seleniumVersion"
testImplementation "org.seleniumhq.selenium:selenium-support:$seleniumVersion"
testImplementation "org.seleniumhq.selenium:selenium-chrome-driver:$seleniumVersion"
integrationTestImplementation "org.grails.plugins:geb"
integrationTestRuntimeOnly "org.seleniumhq.selenium:selenium-remote-driver:$seleniumVersion"
integrationTestRuntimeOnly "org.seleniumhq.selenium:selenium-api:$seleniumVersion"
integrationTestRuntimeOnly "org.seleniumhq.selenium:selenium-support:$seleniumVersion"
integrationTestRuntimeOnly "org.seleniumhq.selenium:selenium-chrome-driver:$seleniumVersion"
integrationTestRuntimeOnly "org.seleniumhq.selenium:selenium-firefox-driver:$seleniumVersion"
}

bootRun {
Expand Down
8 changes: 0 additions & 8 deletions examples/demo33/gradle.properties

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
package demo

import grails.testing.mixin.integration.Integration
import grails.testing.spock.OnceBefore
import spock.lang.Specification

@Integration
class DependencyInjectionSpec extends Specification {

HelperService helperService

@OnceBefore
void init() {
def setup() {
assert helperService != null
}

Expand Down
Loading

0 comments on commit 99f66a7

Please sign in to comment.