Skip to content

Commit

Permalink
Refactored to reuse workflows
Browse files Browse the repository at this point in the history
To remove duplicate workflow config.
  • Loading branch information
freemanjp committed Aug 1, 2022
1 parent c8f2a2c commit d2d090a
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 41 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/maven-build.yml
@@ -0,0 +1,51 @@
name: Maven build
on:
workflow_call:
env:
JAVA_TOOL_OPTIONS: >-
-XX:TieredStopAtLevel=1
-XX:+UseParallelGC
-Dstyle.color=always
-Djansi.force=true
jobs:
build:
name: Maven build
runs-on: ubuntu-20.04
strategy:
matrix:
maven-version:
- '3.3.9'
- '3.6.1'
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: 8
distribution: 'temurin'
# Since code changes to this project are infrequent, and most commits
# change the pom.xml, we cache by date interval rather than file hash.
- name: Calculate cache interval
run: |
leveler="$(wc -c <<< "$GITHUB_REPOSITORY")"
echo "::set-output name=CACHE_INTERVAL::$(date +%Y)-$(($(($leveler + $(date +%-j))) / 30))"
id: cache-interval
- name: Cache local Maven repository
uses: actions/cache@v3
with:
path: |
~/.m2/repository
!~/.m2/repository/com/github/gantsign/maven
key: ${{ runner.os }}-maven-${{ steps.cache-interval.outputs.CACHE_INTERVAL }}
- name: Build with Maven
run: .github/scripts/build.sh
env:
MAVEN_VERSION: ${{ matrix.maven-version }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Code coverage report
if: matrix.maven-version == '3.6.1'
uses: codecov/codecov-action@v3.1.0
44 changes: 3 additions & 41 deletions .github/workflows/verify.yml
Expand Up @@ -11,52 +11,14 @@ env:
-Djansi.force=true
jobs:
build:
name: Maven build
runs-on: ubuntu-20.04
strategy:
matrix:
maven-version:
- '3.3.9'
- '3.6.1'
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: 8
distribution: 'temurin'
# Since code changes to this project are infrequent, and most commits
# change the pom.xml, we cache by date interval rather than file hash.
- name: Calculate cache interval
run: |
leveler="$(wc -c <<< "$GITHUB_REPOSITORY")"
echo "::set-output name=CACHE_INTERVAL::$(date +%Y)-$(($(($leveler + $(date +%-j))) / 30))"
id: cache-interval
- name: Cache local Maven repository
uses: actions/cache@v3
with:
path: |
~/.m2/repository
!~/.m2/repository/com/github/gantsign/maven
key: ${{ runner.os }}-maven-${{ steps.cache-interval.outputs.CACHE_INTERVAL }}
- name: Build with Maven
run: .github/scripts/build.sh
env:
MAVEN_VERSION: ${{ matrix.maven-version }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Code coverage report
if: matrix.maven-version == '3.6.1'
uses: codecov/codecov-action@v3.1.0
call-maven-build:
uses: './.github/workflows/maven-build.yml'

build-all:
if: ${{ always() }}
name: Build (matrix)
runs-on: ubuntu-20.04
needs: build
needs: call-maven-build
steps:
- name: Check build matrix status
run: "[[ '${{ needs.build.result }}' == 'success' ]] || exit 1"

0 comments on commit d2d090a

Please sign in to comment.