chore(build): Modernise and clean up build #29
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Groovy Joint Validation Build" | |
on: | |
push: | |
branches: | |
- '[3-9]+.[1-9]+.x' | |
pull_request: | |
branches: | |
- '[3-9]+.[1-9]+.x' | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
build_groovy: | |
runs-on: ubuntu-latest | |
outputs: | |
groovyVersion: ${{ steps.groovy-version.outputs.value }} | |
steps: | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'adopt' | |
java-version: '11.0.6' | |
- name: Cache local Maven repository & Groovy | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/groovy | |
~/.m2/repository | |
key: cache-local-groovy-maven-${{ github.sha }} | |
- name: Checkout Groovy 3_0_X (Views 3 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: Get Groovy Version for Project build | |
id: groovy-version | |
run: | | |
cd ../groovy | |
echo "value=$(cat gradle.properties | grep groovyVersion | cut -d\= -f2 | tr -d '[:space:]')" >> $GITHUB_OUTPUT | |
- name: Prepare Gradle Enterprise Set-up Configuration | |
id: ge_conf | |
run: | | |
echo "VALUE<<EOF" >> $GITHUB_OUTPUT | |
echo "plugins { " >> $GITHUB_OUTPUT | |
echo " id 'com.gradle.enterprise' version '3.16.1'" >> $GITHUB_OUTPUT | |
echo " id 'com.gradle.common-custom-user-data-gradle-plugin' version '1.12.1'" >> $GITHUB_OUTPUT | |
echo "}" >> $GITHUB_OUTPUT | |
echo "" >> $GITHUB_OUTPUT | |
echo "gradleEnterprise {" >> $GITHUB_OUTPUT | |
echo " server = 'https://ge.grails.org'" >> $GITHUB_OUTPUT | |
echo " buildScan {" >> $GITHUB_OUTPUT | |
echo " publishAlways()" >> $GITHUB_OUTPUT | |
echo " publishIfAuthenticated()" >> $GITHUB_OUTPUT | |
echo " uploadInBackground = false" >> $GITHUB_OUTPUT | |
echo " capture {" >> $GITHUB_OUTPUT | |
echo " taskInputFiles = true" >> $GITHUB_OUTPUT | |
echo " }" >> $GITHUB_OUTPUT | |
echo " }" >> $GITHUB_OUTPUT | |
echo "}" >> $GITHUB_OUTPUT | |
echo "" >> $GITHUB_OUTPUT | |
echo "buildCache {" >> $GITHUB_OUTPUT | |
echo " local { enabled = false }" >> $GITHUB_OUTPUT | |
echo " remote(HttpBuildCache) {" >> $GITHUB_OUTPUT | |
echo " push = true" >> $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 " }" >> $GITHUB_OUTPUT | |
echo "}" >> $GITHUB_OUTPUT | |
echo "" >> $GITHUB_OUTPUT | |
echo "EOF" >> $GITHUB_OUTPUT | |
- name: Gradle Enterprise Set-up | |
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@v2 | |
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 | |
build_grails_views: | |
needs: [build_groovy] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'adopt' | |
java-version: '11' | |
- name: Cache local Maven repository & Groovy | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/groovy | |
~/.m2/repository | |
key: cache-local-groovy-maven-${{ github.sha }} | |
- name: Build Project | |
uses: gradle/gradle-build-action@v2 | |
env: | |
GROOVY_VERSION: ${{ needs.build_groovy.outputs.groovyVersion }} | |
CI_GROOVY_VERSION: ${{ needs.build_groovy.outputs.groovyVersion }} | |
ORG_GRADLE_PROJECT_groovyVersion: ${{ needs.build_groovy.outputs.groovyVersion }} | |
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 | |
-Dgeb.env=chromeHeadless |