51 lines (50 loc) · 1.51 KB
/
maven-build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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