diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index cfe0fec0..8170219e 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -2,12 +2,10 @@ name: Java CI on: push: branches: - - master - - '[7-9]+.[1-9]+.x' + - '[6-9]+.[0-9]+.x' pull_request: branches: - - master - - '[7-9]+.[1-9]+.x' + - '[6-9]+.[0-9]+.x' workflow_dispatch: inputs: message: @@ -30,46 +28,52 @@ jobs: DISPATCH_INFORMATION: ${{ github.event.inputs.message }} run: echo $DISPATCH_INFORMATION - uses: actions/checkout@v2 - - uses: actions/cache@v2 - with: - path: ~/.gradle/caches - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} - restore-keys: | - ${{ runner.os }}-gradle- - name: Set up JDK uses: actions/setup-java@v2 with: distribution: 'adopt' java-version: ${{ matrix.java }} - - name: Optional setup step - run: | - [ -f ./setup.sh ] && ./setup.sh || true - name: Start MongoDB uses: supercharge/mongodb-github-action@1.6.0 with: mongodb-version: ${{ matrix.mongodb-version }} - - name: Compile and Run Tests - run: | - ./gradlew compileGroovy --no-daemon - ./gradlew compileTestGroovy --no-daemon - ./gradlew -Dgeb.env=chromeHeadless check --no-daemon + - name: Run Tests + if: github.event_name == 'pull_request' + id: tests + uses: gradle/gradle-build-action@v2 + with: + arguments: check -Dgeb.env=chromeHeadless + - name: Run Build + if: github.event_name == 'push' + id: build + uses: gradle/gradle-build-action@v2 + env: + GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} + with: + arguments: build -Dgeb.env=chromeHeadless - name: Publish Test Report - if: failure() + if: steps.build.outcome == 'failure' || steps.tests.outcome == 'failure' uses: scacap/action-surefire-report@v1 with: github_token: ${{ secrets.GITHUB_TOKEN }} report_paths: '**/build/test-results/test/TEST-*.xml' - name: Publish to repo.grails.org - if: success() && github.event_name == 'push' && matrix.java == '8' + id: publish + uses: gradle/gradle-build-action@v2 + if: steps.build.outcome == 'success' && github.event_name == 'push' && matrix.java == '8' env: ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} - run: | - ./gradlew -Dorg.gradle.internal.publish.checksums.insecure=true publish - echo "Publishing Documentation..." - ./gradlew docs:docs + with: + arguments: -Dorg.gradle.internal.publish.checksums.insecure=true publish + - name: Build Docs + id: docs + if: steps.build.outcome == 'success' && github.event_name == 'push' && matrix.java == '8' + uses: gradle/gradle-build-action@v2 + with: + arguments: docs:docs - name: Determine docs target repository - if: success() && github.event_name == 'push' && matrix.java == '8' + if: steps.docs.outcome == 'success' && github.event_name == 'push' && matrix.java == '8' uses: haya14busa/action-cond@v1 id: docs_target with: @@ -77,7 +81,7 @@ jobs: if_true: "grails/grails-data-mapping" if_false: ${{ github.repository }} - name: Publish to Github Pages - if: success() && github.event_name == 'push' && matrix.java == '8' + if: steps.docs.outcome == 'success' && github.event_name == 'push' && matrix.java == '8' uses: micronaut-projects/github-pages-deploy-action@master env: TARGET_REPOSITORY: ${{ steps.docs_target.outputs.value }}