Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Java CI workflow to use gradle-build-action #1558

Merged
merged 1 commit into from
Nov 29, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Update Java CI workflow to use gradle-build-action
The gradle-build-action is maintained by Gradle Inc. It automatically manages caching and many other improvements.
  • Loading branch information
puneetbehl committed Nov 29, 2021
commit c35644947e9bdfc1fe803a578516dd78f5eb6160
39 changes: 20 additions & 19 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,41 +19,42 @@ jobs:
GRADLE_OPTS: -Xmx1500m -Dfile.encoding=UTF-8
steps:
- 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: Run Tests
run: |
./gradlew --no-daemon --refresh-dependencies clean check
if: github.event_name == 'pull_request'
id: tests
uses: gradle/gradle-build-action@v2
with:
arguments: clean check
- 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: clean build
- name: Publish Test Report
if: failure()
if: steps.build.outcome == 'success' && github.event_name == 'push' && matrix.java == '8'
uses: scacap/action-surefire-report@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
report_paths: '**/build/test-results/test/TEST-*.xml'
- name: Run Assemble
if: success() && github.event_name == 'push' && matrix.java == '8'
run: ./gradlew assemble
- 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
with:
arguments: -Dorg.gradle.internal.publish.checksums.insecure=true publish
- name: Extract branch name
if: success() && github.event_name == 'push' && matrix.java == '8'
if: steps.publish.outcome == 'success' && github.event_name == 'push' && matrix.java == '8'
id: extract_branch
run: echo ::set-output name=value::${GITHUB_REF:11}
- name: Create Snapshot Message for the Workflow Dispatch
Expand Down