Skip to content

Commit 40b4c63

Browse files
authored
Update gradle.yml (#13267)
Break down into multiple jobs
1 parent 696d33a commit 40b4c63

File tree

1 file changed

+51
-55
lines changed

1 file changed

+51
-55
lines changed

.github/workflows/gradle.yml

Lines changed: 51 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -2,82 +2,78 @@ name: Java CI
22
on:
33
push:
44
branches:
5-
- master
5+
- '[4-9]+.[0-9]+.x'
66
- '[3-9]+.[3-9]+.x'
77
pull_request:
88
branches:
9-
- master
9+
- '[4-9]+.[0-9]+.x'
1010
- '[3-9]+.[3-9]+.x'
11+
workflow_dispatch:
12+
permissions:
13+
contents: read # to fetch code (actions/checkout)
1114
jobs:
1215
build:
16+
permissions:
17+
contents: read # to fetch code (actions/checkout)
1318
runs-on: ubuntu-latest
14-
strategy:
15-
matrix:
16-
java: ['8']
17-
env:
18-
WORKSPACE: ${{ github.workspace }}
19-
GRADLE_OPTS: -Xmx1500m -Dfile.encoding=UTF-8
2019
steps:
21-
- uses: actions/checkout@v2
22-
- name: Cache Gradle packages
23-
uses: actions/cache@v2
24-
with:
25-
path: |
26-
~/.gradle/caches
27-
~/.gradle/wrapper
28-
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
29-
restore-keys: |
30-
${{ runner.os }}-gradle-
20+
- uses: actions/checkout@v3
3121
- name: Set up JDK
32-
uses: actions/setup-java@v1
22+
uses: actions/setup-java@v3
23+
with:
24+
distribution: 'adopt'
25+
java-version: '8'
26+
- name: Run Build
27+
id: build
28+
uses: gradle/gradle-build-action@v2
29+
env:
30+
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
31+
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }}
32+
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }}
3333
with:
34-
java-version: ${{ matrix.java }}
35-
- name: Optional setup step
36-
run: |
37-
[ -f ./setup.sh ] && ./setup.sh || true
38-
- name: Run Tests
39-
run: |
40-
(set -x; ./gradlew clean classes --no-daemon)
41-
(set -x; ./gradlew testClasses --no-daemon)
42-
./gradlew --stop
43-
(set -x; ./gradlew grails-test-suite-persistence:test grails-test-suite-uber:test grails-test-suite-web:test --no-daemon)
44-
./gradlew --stop
45-
(set -x; ./gradlew check -x grails-test-suite-persistence:test -x grails-test-suite-uber:test -x grails-test-suite-web:test --no-daemon)
46-
- name: Publish Test Report
47-
uses: scacap/action-surefire-report@v1
34+
arguments: build
35+
publish:
36+
permissions:
37+
contents: read # to fetch code (actions/checkout)
38+
checks: write
39+
runs-on: ubuntu-latest
40+
if: github.event_name == 'push'
41+
needs: ['build']
42+
steps:
43+
- name: Checkout repository
44+
uses: actions/checkout@v4
4845
with:
49-
github_token: ${{ secrets.GITHUB_TOKEN }}
50-
report_paths: '**/build/test-results/test/TEST-*.xml'
51-
- name: Run Assemble
52-
if: success() && github.event_name == 'push' && matrix.java == '8'
53-
run: ./gradlew assemble
54-
- name: Publish to repo.grails.org
55-
if: success() && github.event_name == 'push' && matrix.java == '8'
46+
token: ${{ secrets.GH_TOKEN }}
47+
- name: Set up JDK
48+
uses: actions/setup-java@v3
49+
with:
50+
distribution: 'adopt'
51+
java-version: '8'
52+
- name: Publish to Artifactory (repo.grails.org)
53+
id: publish
54+
uses: gradle/gradle-build-action@v2
5655
env:
56+
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
57+
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }}
58+
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }}
5759
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
5860
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
59-
run: |
60-
./gradlew publish
61+
with:
62+
arguments: -Dorg.gradle.internal.publish.checksums.insecure=true publish
6163
- name: Extract branch name
62-
if: success() && github.event_name == 'push' && matrix.java == '8'
64+
if: success()
6365
id: extract_branch
64-
run: echo ::set-output name=value::${GITHUB_REF:11}
66+
run: echo "value=${GITHUB_REF:11}" >> $GITHUB_OUTPUT
6567
- name: Create Snapshot Message for the Workflow Dispatch
66-
if: success() && github.event_name == 'push' && matrix.java == '8'
68+
if: success()
6769
id: dispatch_message
68-
run: echo ::set-output name=value::{\"message\":\"New Core Snapshot $(date) - $GITHUB_SHA\"}
70+
run: echo "value={\"message\":\"New Core Snapshot $(date) - $GITHUB_SHA\"}" >> $GITHUB_OUTPUT
6971
- name: Invoke the Java CI workflow in Grails Functional Tests
70-
if: success() && github.event_name == 'push' && matrix.java == '8'
71-
uses: benc-uk/workflow-dispatch@v1.1
72+
if: success()
73+
uses: benc-uk/workflow-dispatch@v1.2
7274
with:
7375
workflow: Java CI
7476
repo: grails/grails-functional-tests
7577
ref: ${{ steps.extract_branch.outputs.value }}
7678
token: ${{ secrets.GH_TOKEN }}
77-
inputs: ${{ steps.dispatch_message.outputs.value }}
78-
- name: Cleanup Gradle Cache
79-
# Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
80-
# Restoring these files from a GitHub Actions cache might cause problems for future builds.
81-
run: |
82-
rm -f ~/.gradle/caches/modules-2/modules-2.lock
83-
rm -f ~/.gradle/caches/modules-2/gc.properties
79+
inputs: ${{ steps.dispatch_message.outputs.value }}

0 commit comments

Comments
 (0)