|
| 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 | + if: startsWith(github.ref, 'refs/heads/8.') || startsWith(github.base_ref, '8.') |
| 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 |
| 56 | + id: groovy-version |
| 57 | + 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 |
| 63 | + run: | |
| 64 | + echo "VALUE<<EOF" >> $GITHUB_OUTPUT |
| 65 | + 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 |
| 69 | + echo "" >> $GITHUB_OUTPUT |
| 70 | + echo "gradleEnterprise {" >> $GITHUB_OUTPUT |
| 71 | + echo " server = 'https://ge.grails.org'" >> $GITHUB_OUTPUT |
| 72 | + 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 |
| 79 | + echo " }" >> $GITHUB_OUTPUT |
| 80 | + echo "}" >> $GITHUB_OUTPUT |
| 81 | + echo "" >> $GITHUB_OUTPUT |
| 82 | + 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 |
| 86 | + 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 |
| 92 | + echo " }" >> $GITHUB_OUTPUT |
| 93 | + echo "}" >> $GITHUB_OUTPUT |
| 94 | + echo "" >> $GITHUB_OUTPUT |
| 95 | + echo "EOF" >> $GITHUB_OUTPUT |
| 96 | + - name: Gradle Enterprise Set-up |
| 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@v2 |
| 105 | + 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 |
| 120 | + build_gorm_hibernate5: |
| 121 | + needs: [build_groovy] |
| 122 | + strategy: |
| 123 | + fail-fast: true |
| 124 | + runs-on: ubuntu-latest |
| 125 | + steps: |
| 126 | + - uses: actions/checkout@v4 |
| 127 | + - name: Set up JDK |
| 128 | + uses: actions/setup-java@v4 |
| 129 | + with: |
| 130 | + distribution: 'adopt' |
| 131 | + java-version: '11' |
| 132 | + - name: Cache local Maven repository & Groovy |
| 133 | + uses: actions/cache@v3 |
| 134 | + 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 GORM Hibernate5 |
| 143 | + id: build_gorm_hibernate5 |
| 144 | + uses: gradle/gradle-build-action@v2 |
| 145 | + 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: | |
| 151 | + build |
| 152 | + -x groovydoc |
0 commit comments