Skip to content

Commit 6411d77

Browse files
authored
Add Groovy joint workflow (#1778)
* Add groovy-joint-workflow * Update groovy-joint-workflow.yml
1 parent 8de60db commit 6411d77

File tree

2 files changed

+152
-0
lines changed

2 files changed

+152
-0
lines changed
Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
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.
20+
on:
21+
push:
22+
branches:
23+
- '[8-9]+.[0-9]+.x'
24+
pull_request:
25+
branches:
26+
- '[8-9]+.[0-9]+.x'
27+
workflow_dispatch:
28+
permissions:
29+
contents: read
30+
env:
31+
CI_GROOVY_VERSION:
32+
jobs:
33+
build_groovy:
34+
strategy:
35+
fail-fast: true
36+
runs-on: ubuntu-latest
37+
outputs:
38+
groovyVersion: ${{ steps.groovy-version.outputs.value }}
39+
steps:
40+
- name: Set up JDK
41+
uses: actions/setup-java@v4
42+
with:
43+
distribution: 'adopt'
44+
java-version: '11.0.6'
45+
- name: Cache local Maven repository & Groovy
46+
uses: actions/cache@v3
47+
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+
run: cd .. && git clone --depth 1 https://github.com/apache/groovy.git -b GROOVY_3_0_X --single-branch
54+
- name: Set CI_GROOVY_VERSION for Grails
55+
id: groovy-version
56+
run: |
57+
cd ../groovy
58+
echo "CI_GROOVY_VERSION=$(cat gradle.properties | grep groovyVersion | cut -d\= -f2 | tr -d '[:space:]')" >> $GITHUB_ENV
59+
echo "value=$(cat gradle.properties | grep groovyVersion | cut -d\= -f2 | tr -d '[:space:]')" >> $GITHUB_OUTPUT
60+
- name: Prepare GE Set-up Configuration
61+
id: ge_conf
62+
run: |
63+
echo "VALUE<<EOF" >> $GITHUB_OUTPUT
64+
echo "plugins { " >> $GITHUB_OUTPUT
65+
echo " id 'com.gradle.enterprise' version '3.15.1'" >> $GITHUB_OUTPUT
66+
echo " id 'com.gradle.common-custom-user-data-gradle-plugin' version '1.11.3'" >> $GITHUB_OUTPUT
67+
echo "}" >> $GITHUB_OUTPUT
68+
echo "" >> $GITHUB_OUTPUT
69+
echo "gradleEnterprise {" >> $GITHUB_OUTPUT
70+
echo " server = 'https://ge.grails.org'" >> $GITHUB_OUTPUT
71+
echo " buildScan {" >> $GITHUB_OUTPUT
72+
echo " publishAlways()" >> $GITHUB_OUTPUT
73+
echo " publishIfAuthenticated()" >> $GITHUB_OUTPUT
74+
echo " uploadInBackground = System.getenv('CI') == null" >> $GITHUB_OUTPUT
75+
echo " capture {" >> $GITHUB_OUTPUT
76+
echo " taskInputFiles = true" >> $GITHUB_OUTPUT
77+
echo " }" >> $GITHUB_OUTPUT
78+
echo " }" >> $GITHUB_OUTPUT
79+
echo "}" >> $GITHUB_OUTPUT
80+
echo "" >> $GITHUB_OUTPUT
81+
echo "buildCache {" >> $GITHUB_OUTPUT
82+
echo " local { enabled = System.getenv('CI') != 'true' }" >> $GITHUB_OUTPUT
83+
echo " remote(HttpBuildCache) {" >> $GITHUB_OUTPUT
84+
echo " push = System.getenv('CI') == 'true'" >> $GITHUB_OUTPUT
85+
echo " enabled = true" >> $GITHUB_OUTPUT
86+
echo " url = 'https://ge.grails.org/cache/'" >> $GITHUB_OUTPUT
87+
echo " credentials {" >> $GITHUB_OUTPUT
88+
echo " username = System.getenv('GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER')" >> $GITHUB_OUTPUT
89+
echo " password = System.getenv('GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY')" >> $GITHUB_OUTPUT
90+
echo " }" >> $GITHUB_OUTPUT
91+
echo " }" >> $GITHUB_OUTPUT
92+
echo "}" >> $GITHUB_OUTPUT
93+
echo "" >> $GITHUB_OUTPUT
94+
echo "EOF" >> $GITHUB_OUTPUT
95+
- name: Gradle Enterprise Set-up
96+
run: |
97+
cd ../groovy
98+
# Delete exiting plugins and build-scan from settings.gradle file
99+
sed -i '21,31d' settings.gradle
100+
# Add Gradle Enterprise set-up related configuration after line no 20 in settings.gradle
101+
echo "${{ steps.ge_conf.outputs.value}}" | sed -i -e "20r /dev/stdin" settings.gradle
102+
- name: Build and install groovy (no docs)
103+
uses: gradle/gradle-build-action@v2
104+
env:
105+
GRADLE_SCANS_ACCEPT: yes
106+
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
107+
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }}
108+
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }}
109+
with:
110+
build-root-directory: ../groovy
111+
arguments: |
112+
install
113+
-x groovydoc
114+
-x javadoc
115+
-x javadocAll
116+
-x groovydocAll
117+
-x asciidoc
118+
-x docGDK
119+
build_gorm:
120+
needs: [build_groovy]
121+
strategy:
122+
fail-fast: true
123+
runs-on: ubuntu-latest
124+
steps:
125+
- uses: actions/checkout@v4
126+
- name: Set up JDK
127+
uses: actions/setup-java@v4
128+
with:
129+
distribution: 'adopt'
130+
java-version: '11'
131+
- name: Cache local Maven repository & Groovy
132+
uses: actions/cache@v3
133+
with:
134+
path: |
135+
~/groovy
136+
~/.m2/repository
137+
key: cache-local-groovy-maven-${{ github.sha }}
138+
- name: Set CI_GROOVY_VERSION for Grails
139+
run: |
140+
echo "CI_GROOVY_VERSION=${{needs.build_groovy.outputs.groovyVersion}}" >> $GITHUB_ENV
141+
- name: Build GORM
142+
id: build_gorm
143+
uses: gradle/gradle-build-action@v2
144+
env:
145+
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
146+
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }}
147+
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }}
148+
with:
149+
arguments: |
150+
build
151+
-x groovydoc

build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ buildscript {
1010
}
1111

1212
ext {
13+
groovyVersion = System.getenv('CI_GROOVY_VERSION') ?: project.groovyVersion
1314
// overall project version
1415
isCiBuild = System.getenv().get("CI") as Boolean
1516
isSnapshot = project.projectVersion.endsWith("-SNAPSHOT")

0 commit comments

Comments
 (0)