Skip to content

Commit 5b8f154

Browse files
authored
Merge pull request #14007 from jdaugherty/7.0.x
#13557 - Move functional tests to grails-core
2 parents 3ddee98 + dc4296b commit 5b8f154

File tree

643 files changed

+72246
-95
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

643 files changed

+72246
-95
lines changed

.github/workflows/gradle.yml

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ jobs:
2828
echo "value=false" >> $GITHUB_OUTPUT
2929
fi
3030
build:
31+
name: 'Build'
3132
needs: skip_check
3233
permissions:
3334
contents: read # to fetch code (actions/checkout)
@@ -54,10 +55,37 @@ jobs:
5455
env:
5556
DEVELOCITY_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }}
5657
DEVELOCITY_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }}
57-
run: ./gradlew build assemble groovydoc --continue
58+
run: ./gradlew build assemble groovydoc -PskipFunctionalTests --continue
59+
functional:
60+
name: "Functional Tests"
61+
needs: skip_check
62+
permissions:
63+
contents: read # to fetch code (actions/checkout)
64+
strategy:
65+
fail-fast: false
66+
matrix:
67+
java: [ '17', '21', '23' ]
68+
runs-on: ubuntu-latest
69+
steps:
70+
- name: "📥 Checkout repository"
71+
uses: actions/checkout@v4
72+
- name: "☕️ Setup JDK"
73+
uses: actions/setup-java@v4
74+
with:
75+
distribution: liberica
76+
java-version: ${{ matrix.java }}
77+
- name: "🐘 Setup Gradle"
78+
uses: gradle/actions/setup-gradle@v4
79+
with:
80+
develocity-access-key: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
81+
- name: "🔨 Functional Tests"
82+
env:
83+
DEVELOCITY_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }}
84+
DEVELOCITY_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }}
85+
run: ./gradlew build -PonlyFunctionalTests
5886
publish:
5987
if: github.event_name == 'push' && needs.skip_check.outputs.found_skip_publish != 'true'
60-
needs: build
88+
needs: [build, functional]
6189
permissions:
6290
contents: read # limit to read access
6391
runs-on: ubuntu-latest
@@ -104,29 +132,4 @@ jobs:
104132
workflow: Java CI
105133
repo: grails/grails-doc
106134
ref: ${{ steps.extract_branch.outputs.value }}
107-
token: ${{ secrets.GH_TOKEN }}
108-
invoke-third-party-workflows:
109-
if: github.event_name == 'push'
110-
needs: [build, publish]
111-
permissions:
112-
contents: read # limit to read access
113-
runs-on: ubuntu-latest
114-
steps:
115-
- name: "📝 Store the target branch"
116-
id: extract_branch
117-
run: |
118-
echo "Determining Target Branch"
119-
TARGET_BRANCH=${GITHUB_REF#refs/heads/}
120-
echo $TARGET_BRANCH
121-
echo "value=${TARGET_BRANCH}" >> $GITHUB_OUTPUT
122-
- name: "📝 Create Snapshot Message for the Workflow Dispatch"
123-
id: dispatch_message
124-
run: echo "value={\"message\":\"New Core Snapshot $(date) - $GITHUB_SHA\"}" >> $GITHUB_OUTPUT
125-
- name: "📡 Invoke the Java CI workflow in Grails Functional Tests"
126-
uses: benc-uk/workflow-dispatch@e2e5e9a103e331dad343f381a29e654aea3cf8fc # v1.2.4 (Use commit sha as this is a 3rd party action)
127-
with:
128-
workflow: Java CI
129-
repo: grails/grails-functional-tests
130-
ref: ${{ steps.extract_branch.outputs.value }}
131-
token: ${{ secrets.GH_TOKEN }}
132-
inputs: ${{ steps.dispatch_message.outputs.value }}
135+
token: ${{ secrets.GH_TOKEN }}

build.gradle

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ buildscript {
1717
apply plugin: 'idea'
1818

1919
ext {
20-
isJava8Compatible = org.gradle.api.JavaVersion.current().isJava8Compatible()
2120
grailsVersion = project.projectVersion
2221
isCiBuild = System.getenv().get("CI") as Boolean
2322
isGitHubRepoPublish = System.getenv("GITHUB_PUBLISH") == 'true'
@@ -185,12 +184,6 @@ subprojects { subproject ->
185184
'grails-plugin-converters': 'converters'
186185
]
187186

188-
if (isPlugin) {
189-
group = 'org.grails.plugins'
190-
} else {
191-
group = 'org.grails'
192-
}
193-
194187
if(isExample) {
195188
// Test projects will often include dependencies from grails-core, this file will ensure any dependencies included
196189
// will be substituted with projects in this repository instead of pulling upstream
@@ -206,6 +199,14 @@ subprojects { subproject ->
206199
}
207200
}
208201
}
202+
203+
return
204+
}
205+
206+
if (isPlugin) {
207+
group = 'org.grails.plugins'
208+
} else {
209+
group = 'org.grails'
209210
}
210211

211212
ext.pomInfo = {
@@ -258,7 +259,7 @@ subprojects { subproject ->
258259
apply plugin: 'project-report'
259260
}
260261

261-
if (!isTestSuite && !isExample) {
262+
if (!isTestSuite) {
262263

263264
apply plugin: 'maven-publish'
264265
apply plugin: 'signing'
@@ -346,7 +347,7 @@ subprojects { subproject ->
346347
}
347348
}
348349

349-
if (subproject.name in ['grails-dependencies', 'grails-bom'] || isExample) return
350+
if (subproject.name in ['grails-dependencies', 'grails-bom']) return
350351

351352
dependencies {
352353
implementation platform(project(':grails-bom'))
@@ -429,6 +430,12 @@ subprojects { subproject ->
429430
]
430431

431432
tasks.withType(Test).configureEach {
433+
onlyIf {
434+
if(project.hasProperty('onlyFunctionalTests')) {
435+
return false
436+
}
437+
true
438+
}
432439
useJUnitPlatform()
433440
jvmArgs += java17moduleReflectionCompatibilityArguments
434441
}
@@ -586,4 +593,4 @@ project.afterEvaluate {
586593
// see: https://docs.gradle.org/current/userguide/compatibility.html#groovy
587594
boolean compiledByGradleGroovyVersion(Project currentProject) {
588595
currentProject.name in ['grails-bootstrap', 'grails-gradle-model', 'grails-shell']
589-
}
596+
}

gradle.properties

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ org.gradle.parallel=true
2222
org.gradle.daemon=true
2323
org.gradle.jvmargs=-Dfile.encoding=UTF-8 -Xmx1536M -XX:MaxMetaspaceSize=1024M
2424

25+
# libraries only specific to test apps, these should not be exposed
26+
micronautVersion=4.6.5
27+
micronautSerdeJacksonVersion=2.11.0
28+
springSecurityCoreVersion=7.0.0-SNAPSHOT
29+
2530
# Set when we are temporarily releasing, should be false unless we want to prevent
2631
# snapshot or documentation publishes.
2732
preventSnapshotPublish=false

gradle/functional-test-project.gradle

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
ext {
2+
isFunctionalTestProject = true
3+
}
4+
5+
tasks.withType(Test).configureEach {
6+
onlyIf {
7+
if(project.hasProperty('skipFunctionalTests')) {
8+
return false
9+
}
10+
11+
true
12+
}
13+
useJUnitPlatform()
14+
testLogging {
15+
events "passed", "skipped", "failed"
16+
17+
showExceptions true
18+
exceptionFormat "full"
19+
showCauses true
20+
showStackTraces true
21+
}
22+
}
23+
24+
// Don't need groovydoc for example project
25+
tasks.named('groovydoc') {
26+
enabled = false
27+
}

grails-dependencies/build.gradle

Lines changed: 24 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,36 @@
1+
dependencies {
2+
for (String exported : [
3+
"org.grails:grails-bootstrap:${project.version}",
4+
"org.grails:grails-plugin-rest:${project.version}",
5+
"org.grails:grails-plugin-databinding:${project.version}",
6+
"org.grails:grails-plugin-i18n:${project.version}",
7+
"org.grails:grails-plugin-services:${project.version}",
8+
"org.grails:grails-plugin-url-mappings:${project.version}",
9+
"org.grails:grails-plugin-interceptors:${project.version}",
10+
"org.grails.plugins:async:${project.version}",
11+
"org.grails.plugins:events:${project.version}",
12+
"org.grails.plugins:gsp:${project['gsp.version']}",
13+
]) {
14+
api "${exported}"
15+
}
16+
for (String exported : [
17+
"com.h2database:h2:${project['h2.version']}",
18+
]) {
19+
runtimeOnly "${exported}"
20+
}
21+
}
122

223
apply plugin: 'maven-publish'
3-
424
publishing {
525
publications {
626
maven(MavenPublication) {
27+
from components.java
28+
729
pom.withXml {
830
def xml = asNode()
931

10-
xml.children().last() + pomInfo
11-
12-
xml.children().last() + {
13-
delegate.dependencies {
14-
delegate.dependency {
15-
delegate.groupId "org.grails"
16-
delegate.artifactId "grails-bootstrap"
17-
delegate.version project.version
18-
delegate.scope "api"
19-
}
20-
for(sub in ['rest', 'databinding', 'i18n', 'services', 'url-mappings', 'interceptors']) {
21-
delegate.dependency {
22-
delegate.groupId "org.grails"
23-
delegate.artifactId "grails-plugin-${sub}"
24-
delegate.version project.version
25-
delegate.scope "api"
26-
}
27-
}
28-
for(sub in ['async', 'events']) {
29-
delegate.dependency {
30-
delegate.groupId "org.grails.plugins"
31-
delegate.artifactId sub
32-
delegate.version project.version
33-
delegate.scope "api"
34-
}
35-
}
36-
delegate.dependency {
37-
delegate.groupId "org.grails.plugins"
38-
delegate.artifactId "gsp"
39-
delegate.version project['gsp.version']
40-
delegate.scope "api"
41-
}
42-
delegate.dependency {
43-
delegate.groupId "com.h2database"
44-
delegate.artifactId "h2"
45-
delegate.version project['h2.version']
46-
delegate.scope "runtimeOnly"
47-
}
48-
49-
}
50-
}
32+
xml.children().last() + pomInfo
5133
}
52-
5334
}
5435
}
5536
}

grails-test-examples/README.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1-
# grails-test-examples
1+
# Functional tests for Grails Core
22

3-
Example projects that test across Grails functions should live in this directory
3+
A Suite of functional tests for Grails.
4+
5+
The following properties exist to not run or only run tests in these directories:
6+
- `onlyFunctionalTests` - Only run tests in this directory
7+
- `skipFunctionalTests` - Skip tests in this directory
8+
9+
For example, at the root directory to only run the functional tests:
10+
11+
./gradlew -PonlyFunctionalTests build
12+
13+
Or to skip the functional tests:
14+
15+
./gradlew -PskipFunctionalTests build
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
buildscript {
2+
repositories {
3+
maven { url "https://repo.grails.org/grails/core" }
4+
mavenCentral()
5+
}
6+
dependencies {
7+
classpath "org.grails:grails-gradle-plugin:${project['grails-gradle-plugin.version']}"
8+
classpath "com.bertramlabs.plugins:asset-pipeline-gradle:${project['asset-pipeline-gradle.version']}"
9+
}
10+
}
11+
12+
version "0.1"
13+
group "functionaltests"
14+
15+
apply plugin: "war"
16+
apply plugin: "asset-pipeline"
17+
apply plugin: "org.grails.grails-web"
18+
apply plugin: "org.grails.grails-gsp"
19+
20+
assets {
21+
minifyJs = true
22+
minifyCss = true
23+
}
24+
25+
apply plugin: 'java'
26+
compileJava.options.release = 17
27+
28+
dependencies {
29+
implementation platform(project(':grails-bom'))
30+
31+
implementation "org.springframework.boot:spring-boot-starter-logging"
32+
implementation "org.springframework.boot:spring-boot-starter-actuator"
33+
implementation "org.springframework.boot:spring-boot-autoconfigure"
34+
implementation "org.springframework.boot:spring-boot-starter-tomcat"
35+
implementation "org.grails:grails-dependencies"
36+
implementation "org.grails:grails-web-boot"
37+
implementation "org.grails:grails-core"
38+
39+
implementation "org.grails.plugins:hibernate5"
40+
implementation "org.grails.plugins:cache"
41+
implementation "org.grails.plugins:scaffolding"
42+
43+
runtimeOnly "com.bertramlabs.plugins:asset-pipeline-grails"
44+
runtimeOnly "org.grails.plugins:fields"
45+
runtimeOnly "org.apache.tomcat:tomcat-jdbc"
46+
47+
testImplementation "org.grails:grails-web-testing-support"
48+
testImplementation "org.grails:grails-gorm-testing-support"
49+
50+
console "org.grails:grails-console"
51+
testImplementation "io.micronaut:micronaut-http-client:$micronautVersion"
52+
testImplementation "io.micronaut.serde:micronaut-serde-jackson:$micronautSerdeJacksonVersion"
53+
54+
implementation project(':grails-test-examples-plugins-loadfirst')
55+
implementation project(':grails-test-examples-plugins-loadsecond')
56+
implementation project(':grails-test-examples-plugins-loadafter')
57+
58+
integrationTestImplementation testFixtures("org.grails.plugins:geb")
59+
}
60+
61+
tasks.withType(org.gradle.api.tasks.JavaExec) {
62+
systemProperty('REPLACE_ME', 'test')
63+
systemProperty('foo.bar', 'test')
64+
// jvmArgs '-javaagent:agent.jar'
65+
}
66+
test {
67+
systemProperty('REPLACE_ME', 'test')
68+
systemProperty('foo.bar', 'test')
69+
}
70+
71+
//compileTestGroovy.groovyOptions.forkOptions.jvmArgs = ['-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005']
72+
//compileGroovy.groovyOptions.fork = true
73+
//compileGroovy.groovyOptions.forkOptions.jvmArgs = ['-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005']
74+
75+
apply from: rootProject.file('gradle/functional-test-project.gradle')
Loading
Loading
Binary file not shown.
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// This is a manifest file that'll be compiled into application.js.
2+
//
3+
// Any JavaScript file within this directory can be referenced here using a relative path.
4+
//
5+
// You're free to add application-wide JavaScript to this file, but it's generally better
6+
// to create separate JavaScript files as needed.
7+
//
8+
//= require jquery-2.1.3.js
9+
//= require_tree .
10+
//= require_self
11+
12+
if (typeof jQuery !== 'undefined') {
13+
(function($) {
14+
$('#spinner').ajaxStart(function() {
15+
$(this).fadeIn();
16+
}).ajaxStop(function() {
17+
$(this).fadeOut();
18+
});
19+
})(jQuery);
20+
}

0 commit comments

Comments
 (0)