1
- # Licensed to the Apache Software Foundation (ASF) under one or more
2
- # contributor license agreements. See the NOTICE file distributed with
3
- # this work for additional information regarding copyright ownership.
4
- # The ASF licenses this file to You under the Apache License, Version 2.0
5
- # (the "License"); you may not use this file except in compliance with
6
- # the License. You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
-
16
- name : " Grails Joint Validation Build"
17
- # GROOVY_2_5_X == Grails 4.0.x
18
- # GROOVY_3_0_X == grails master
19
- # Groovy master branch does not map to any due to changed package names.
1
+ name : " Groovy Joint Validation Build"
20
2
on :
21
3
push :
22
4
branches :
23
- - ' [3-9]+.[1 -9]+.x'
5
+ - ' [3-9]+.[0 -9]+.x'
24
6
pull_request :
25
7
branches :
26
- - ' [3-9]+.[1 -9]+.x'
8
+ - ' [3-9]+.[0 -9]+.x'
27
9
workflow_dispatch :
28
10
permissions :
29
11
contents : read
30
- env :
31
- CI_GROOVY_VERSION :
32
12
jobs :
33
13
build_groovy :
34
- strategy :
35
- fail-fast : true
36
14
runs-on : ubuntu-latest
37
15
outputs :
38
16
groovyVersion : ${{ steps.groovy-version.outputs.value }}
39
17
steps :
40
- - name : Set up JDK
18
+ - name : " ☕️ Setup JDK"
41
19
uses : actions/setup-java@v4
42
20
with :
43
- distribution : ' temurin'
44
- java-version : ' 17 '
45
- - name : Cache local Maven repository & Groovy
21
+ distribution : temurin
22
+ java-version : 17
23
+ - name : " 🗄️ Cache local Maven repository"
46
24
uses : actions/cache@v4
47
25
with :
48
- path : |
49
- ~/groovy
50
- ~/.m2/repository
51
- key : cache-local-groovy-maven-${{ github.sha }}
52
- - name : Checkout Groovy 3_0_X (Grails 5 and later)
53
- if : startsWith(github.ref, 'refs/heads/3.') || startsWith(github.base_ref, '3.')
54
- run : cd .. && git clone --depth 1 https://github.com/apache/groovy.git -b GROOVY_3_0_X --single-branch
55
- - name : Set CI_GROOVY_VERSION for Grails
26
+ path : ~/.m2/repository
27
+ key : cache-local-maven-${{ github.sha }}
28
+ - name : " 📥 Checkout Grails Testing Support to fetch Gradle Plugin versions it uses"
29
+ uses : actions/checkout@v4
30
+ with :
31
+ sparse-checkout-cone-mode : false
32
+ sparse-checkout : settings.gradle
33
+ - name : " 📝 Store the Gradle Plugin versions used in Grails Testing Support"
34
+ id : gradle-plugin-versions
35
+ run : |
36
+ 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:])
37
+ 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:])
38
+ echo "Project uses Develocity Plugin version: $DEVELOCITY_PLUGIN_VERSION"
39
+ echo "Project uses Common Custom User Data Plugin version: $COMMON_CUSTOM_USER_DATA_PLUGIN_VERSION"
40
+ echo "develocity_plugin_version=$DEVELOCITY_PLUGIN_VERSION" >> $GITHUB_OUTPUT
41
+ echo "common_custom_user_data_plugin_version=$COMMON_CUSTOM_USER_DATA_PLUGIN_VERSION" >> $GITHUB_OUTPUT
42
+ rm settings.gradle
43
+ - name : " 📥 Checkout Groovy 4_0_X (Grails 7 and later)"
44
+ run : git clone --depth 1 https://github.com/apache/groovy.git -b GROOVY_4_0_X --single-branch
45
+ - name : " 🐘 Setup Gradle"
46
+ uses : gradle/actions/setup-gradle@v4
47
+ with :
48
+ develocity-access-key : ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
49
+ - name : " 📝 Store Groovy version to use when building Grails Testing Support"
56
50
id : groovy-version
57
51
run : |
58
- cd ../groovy
59
- echo "CI_GROOVY_VERSION=$(cat gradle.properties | grep groovyVersion | cut -d\= -f2 | tr -d '[:space:]')" >> $GITHUB_ENV
60
- echo "value=$(cat gradle.properties | grep groovyVersion | cut -d\= -f2 | tr -d '[:space:]')" >> $GITHUB_OUTPUT
61
- - name : Prepare GE Set-up Configuration
62
- id : ge_conf
52
+ cd groovy
53
+ GROOVY_VERSION=$(cat gradle.properties | grep groovyVersion | cut -d\= -f2 | tr -d '[:space:]')
54
+ echo "Groovy version $GROOVY_VERSION stored"
55
+ echo "value=$GROOVY_VERSION" >> $GITHUB_OUTPUT
56
+ - name : " 🐘 Configure Gradle Plugins (Step 1/3)"
57
+ id : develocity-conf-1
63
58
run : |
64
59
echo "VALUE<<EOF" >> $GITHUB_OUTPUT
65
60
echo "plugins { " >> $GITHUB_OUTPUT
66
- echo " id 'com.gradle.enterprise' version '3.15.1'" >> $GITHUB_OUTPUT
67
- echo " id 'com.gradle.common-custom-user-data-gradle-plugin' version '1.11.3'" >> $GITHUB_OUTPUT
68
- echo "}" >> $GITHUB_OUTPUT
61
+ echo " id 'com.gradle.develocity' version '${{ steps.gradle-plugin-versions.outputs.develocity_plugin_version }}'" >> $GITHUB_OUTPUT
62
+ echo " id 'com.gradle.common-custom-user-data-gradle-plugin' version '${{ steps.gradle-plugin-versions.outputs.common_custom_user_data_plugin_version }}'" >> $GITHUB_OUTPUT
63
+ echo "}" >> $GITHUB_OUTPUT
64
+ echo "" >> $GITHUB_OUTPUT
65
+ echo "EOF" >> $GITHUB_OUTPUT
66
+ - name : " 🐘 Configure Gradle Plugins (Step 2/3)"
67
+ id : develocity-conf-2
68
+ run : |
69
+ echo "VALUE<<EOF" >> $GITHUB_OUTPUT
70
+ echo "def isAuthenticated = System.getenv('DEVELOCITY_ACCESS_KEY') != null" >> $GITHUB_OUTPUT
71
+ echo "def isBuildCacheAuthenticated =" >> $GITHUB_OUTPUT
72
+ echo " System.getenv('DEVELOCITY_BUILD_CACHE_NODE_USER') != null &&" >> $GITHUB_OUTPUT
73
+ echo " System.getenv('DEVELOCITY_BUILD_CACHE_NODE_KEY') != null" >> $GITHUB_OUTPUT
69
74
echo "" >> $GITHUB_OUTPUT
70
- echo "gradleEnterprise {" >> $GITHUB_OUTPUT
75
+ echo "develocity {" >> $GITHUB_OUTPUT
71
76
echo " server = 'https://ge.grails.org'" >> $GITHUB_OUTPUT
72
77
echo " buildScan {" >> $GITHUB_OUTPUT
73
- echo " publishAlways()" >> $GITHUB_OUTPUT
74
- echo " publishIfAuthenticated()" >> $GITHUB_OUTPUT
75
- echo " uploadInBackground = System.getenv('CI') == null" >> $GITHUB_OUTPUT
76
- echo " capture {" >> $GITHUB_OUTPUT
77
- echo " taskInputFiles = true" >> $GITHUB_OUTPUT
78
- echo " }" >> $GITHUB_OUTPUT
78
+ echo " publishing.onlyIf { isAuthenticated }" >> $GITHUB_OUTPUT
79
+ echo " uploadInBackground = false" >> $GITHUB_OUTPUT
79
80
echo " }" >> $GITHUB_OUTPUT
80
81
echo "}" >> $GITHUB_OUTPUT
81
82
echo "" >> $GITHUB_OUTPUT
82
83
echo "buildCache {" >> $GITHUB_OUTPUT
83
- echo " local { enabled = System.getenv('CI') != 'true' }" >> $GITHUB_OUTPUT
84
- echo " remote(HttpBuildCache ) {" >> $GITHUB_OUTPUT
85
- echo " push = System.getenv('CI') == 'true' " >> $GITHUB_OUTPUT
84
+ echo " local { enabled = false }" >> $GITHUB_OUTPUT
85
+ echo " remote(develocity.buildCache ) {" >> $GITHUB_OUTPUT
86
+ echo " push = isBuildCacheAuthenticated " >> $GITHUB_OUTPUT
86
87
echo " enabled = true" >> $GITHUB_OUTPUT
87
- echo " url = 'https://ge.grails.org/cache/'" >> $GITHUB_OUTPUT
88
- echo " credentials {" >> $GITHUB_OUTPUT
89
- echo " username = System.getenv('GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER')" >> $GITHUB_OUTPUT
90
- echo " password = System.getenv('GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY')" >> $GITHUB_OUTPUT
91
- echo " }" >> $GITHUB_OUTPUT
88
+ echo " usernameAndPassword(" >> $GITHUB_OUTPUT
89
+ echo " System.getenv('DEVELOCITY_BUILD_CACHE_NODE_USER') ?: ''," >> $GITHUB_OUTPUT
90
+ echo " System.getenv('DEVELOCITY_BUILD_CACHE_NODE_KEY') ?: ''" >> $GITHUB_OUTPUT
91
+ echo " )" >> $GITHUB_OUTPUT
92
92
echo " }" >> $GITHUB_OUTPUT
93
93
echo "}" >> $GITHUB_OUTPUT
94
94
echo "" >> $GITHUB_OUTPUT
95
95
echo "EOF" >> $GITHUB_OUTPUT
96
- - name : Gradle Enterprise Set-up
96
+ - name : " 🐘 Configure Gradle Plugins (step 3/3) "
97
97
run : |
98
- cd ../groovy
99
- # Delete exiting plugins and build-scan from settings.gradle file
100
- sed -i '21,31d' settings.gradle
101
- # Add Gradle Enterprise set-up related configuration after line no 20 in settings.gradle
102
- echo "${{ steps.ge_conf.outputs.value}}" | sed -i -e "20r /dev/stdin" settings.gradle
103
- - name : Build and install groovy (no docs)
104
- uses : gradle/gradle-build-action@v3
98
+ cd groovy
99
+ # Delete existing plugins from settings.gradle file
100
+ sed -i '32,37d' settings.gradle
101
+ # Add Develocity setup related configuration after line no 31 in settings.gradle
102
+ echo "${{ steps.develocity-conf-1.outputs.value }}" | sed -i -e "31r /dev/stdin" settings.gradle
103
+ # Delete existing buildCache configuration from gradle/build-scans.gradle file
104
+ sed -i '23,46d' gradle/build-scans.gradle
105
+ # Add Develocity setup related configuration after line no 22 in gradle/build-scans.gradle
106
+ echo "${{ steps.develocity-conf-2.outputs.value }}" | sed -i -e "22r /dev/stdin" gradle/build-scans.gradle
107
+ - name : " 🔨 Publish Groovy to local maven repository (no docs)"
105
108
env :
106
- GRADLE_SCANS_ACCEPT : yes
107
- GRADLE_ENTERPRISE_ACCESS_KEY : ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
108
- GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER : ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }}
109
- GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY : ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }}
110
- with :
111
- build-root-directory : ../groovy
112
- arguments : |
113
- install
114
- -x groovydoc
115
- -x javadoc
116
- -x javadocAll
117
- -x groovydocAll
118
- -x asciidoc
119
- -x docGDK
109
+ DEVELOCITY_BUILD_CACHE_NODE_USER : ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }}
110
+ DEVELOCITY_BUILD_CACHE_NODE_KEY : ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }}
111
+ run : |
112
+ cd groovy
113
+ ./gradlew pTML -x groovydoc -x javadoc -x javadocAll -x groovydocAll -x asciidoc -x docGDK
114
+
120
115
build_grails_testing_support :
121
116
needs : [build_groovy]
122
- strategy :
123
- fail-fast : true
124
117
runs-on : ubuntu-latest
125
118
steps :
126
- - uses : actions/checkout@v4
127
- - name : Set up JDK
119
+ - name : " 📥 Checkout project"
120
+ uses : actions/checkout@v4
121
+ - name : " ☕️ Setup JDK"
128
122
uses : actions/setup-java@v4
129
123
with :
130
124
distribution : temurin
131
125
java-version : 17
132
- - name : Cache local Maven repository & Groovy
126
+ - name : " 🐘 Setup Gradle"
127
+ uses : gradle/actions/setup-gradle@v4
128
+ with :
129
+ develocity-access-key : ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
130
+ - name : " 🗄️ Restore local Maven repository from cache"
133
131
uses : actions/cache@v4
134
132
with :
135
- path : |
136
- ~/groovy
137
- ~/.m2/repository
138
- key : cache-local-groovy-maven-${{ github.sha }}
139
- - name : Set CI_GROOVY_VERSION for Grails
140
- run : |
141
- echo "CI_GROOVY_VERSION=${{needs.build_groovy.outputs.groovyVersion}}" >> $GITHUB_ENV
142
- - name : Build
143
- id : build
144
- uses : gradle/gradle-build-action@v3
133
+ path : ~/.m2/repository
134
+ key : cache-local-maven-${{ github.sha }}
135
+ - name : " 🪶 Add mavenLocal repository to build"
136
+ run : sed -i 's|// mavenLocal() // Keep|mavenLocal() // Keep|' build.gradle
137
+ - name : " 🔨 Build and test Grails Testing Support using the locally built Groovy snapshot"
145
138
env :
146
- GRADLE_ENTERPRISE_ACCESS_KEY : ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
147
- GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER : ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }}
148
- GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY : ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }}
149
- with :
150
- arguments : build
139
+ DEVELOCITY_BUILD_CACHE_NODE_USER : ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }}
140
+ DEVELOCITY_BUILD_CACHE_NODE_KEY : ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }}
141
+ run : >
142
+ ./gradlew build
143
+ -Dgeb.env=chromeHeadless
144
+ -PgroovyVersion=${{needs.build_groovy.outputs.groovyVersion}}
145
+ -x groovydoc
0 commit comments