Skip to content

Commit

Permalink
Switch to use gradle-build-action
Browse files Browse the repository at this point in the history
This improves the 'testing' GitHub actions workflow in a number of ways:
- Use 'gradle-build-action' to invoke Gradle, to optimize caching of Gradle User Home between jobs
- Run each test build and the codenarc builds in parallel
  • Loading branch information
bigdaz authored and ejona86 committed Nov 3, 2021
1 parent 924c63d commit 5595020
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 25 deletions.
15 changes: 0 additions & 15 deletions .github/workflows/testing.sh

This file was deleted.

56 changes: 46 additions & 10 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,53 @@ on:
permissions:
contents: read

env:
GRADLE_OPTS: "-Xms128m"

jobs:
tests:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'temurin'
- uses: gradle/gradle-build-action@v2
with:
arguments: clean assemble -x signArchives --stacktrace

test:
needs: build
strategy:
matrix:
tests: [ProtobufJavaPluginTest, ProtobufKotlinDslCopySpecTest, ProtobufKotlinDslPluginTest, ProtobufAndroidPluginTest, ProtobufAndroidPluginKotlinTest, AndroidProjectDetectionTest]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'temurin'
cache: 'gradle'
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'temurin'
- uses: gradle/gradle-build-action@v2
with:
arguments: test --tests ${{ matrix.tests }} --stacktrace

- name: Build
run: .github/workflows/testing.sh
codenarc:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'temurin'
- uses: gradle/gradle-build-action@v2
with:
arguments: codenarcMain codenarcTest --continue
- name: echo codenarcMain reports
if: failure()
run: test -f build/reports/codenarc/main.txt && cat build/reports/codenarc/main.txt
- name: echo codenarcTest reports
if: failure()
run: test -f build/reports/codenarc/test.txt && cat build/reports/codenarc/test.txt

0 comments on commit 5595020

Please sign in to comment.