Skip to content

Commit ea2f4de

Browse files
committed
Configure Java CI workflow
1 parent 1286fea commit ea2f4de

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed

.github/workflows/gradle.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Java CI
2+
on:
3+
push:
4+
branches:
5+
- '[2-9]+.[0-9]+.x'
6+
pull_request:
7+
branches:
8+
- '[2-9]+.[0-9]+.x'
9+
workflow_dispatch:
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
java: ['8']
16+
env:
17+
WORKSPACE: ${{ github.workspace }}
18+
GRADLE_OPTS: -Xmx1500m -Dfile.encoding=UTF-8
19+
steps:
20+
- name: Print Dispatch Information
21+
if: github.event_name == 'workflow_dispatch'
22+
env:
23+
DISPATCH_INFORMATION: ${{ github.event.inputs.message }}
24+
run: echo $DISPATCH_INFORMATION
25+
- uses: actions/checkout@v3
26+
- name: Set up JDK
27+
uses: actions/setup-java@v3
28+
with:
29+
distribution: 'adopt'
30+
java-version: ${{ matrix.java }}
31+
- name: Run Tests
32+
if: github.event_name == 'pull_request'
33+
id: tests
34+
uses: gradle/gradle-build-action@v2
35+
with:
36+
arguments: check
37+
env:
38+
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }}
39+
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }}
40+
- name: Run Build
41+
if: github.event_name == 'push'
42+
id: build
43+
uses: gradle/gradle-build-action@v2
44+
env:
45+
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
46+
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }}
47+
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }}
48+
with:
49+
arguments: build
50+
- name: Publish Test Report
51+
if: steps.build.outcome == 'failure' || steps.tests.outcome == 'failure'
52+
uses: scacap/action-surefire-report@v1
53+
with:
54+
github_token: ${{ secrets.GITHUB_TOKEN }}
55+
report_paths: '**/build/test-results/test/TEST-*.xml'
56+
- name: Publish to repo.grails.org
57+
uses: gradle/gradle-build-action@v2
58+
if: steps.build.outcome == 'success' && github.event_name == 'push' && matrix.java == '8'
59+
env:
60+
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
61+
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
62+
with:
63+
arguments: publish
64+
- name: Generate Documentation
65+
id: docs
66+
uses: gradle/gradle-build-action@v2
67+
if: success() && github.event_name == 'push' && matrix.java == '8'
68+
with:
69+
arguments: docs
70+
- name: Publish to Github Pages
71+
if: steps.publish.outcome == 'success' && github.event_name == 'push' && matrix.java == '8'
72+
uses: micronaut-projects/github-pages-deploy-action@master
73+
env:
74+
TARGET_REPOSITORY: ${{ github.repository }}
75+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
76+
BRANCH: gh-pages
77+
FOLDER: build/docs
78+
DOC_FOLDER: gh-pages
79+
COMMIT_EMAIL: behlp@objectcomputing.com
80+
COMMIT_NAME: Puneet Behl

0 commit comments

Comments
 (0)