-
Notifications
You must be signed in to change notification settings - Fork 62
102 lines (93 loc) · 3.52 KB
/
maven.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
name: Test all JDKs on all OSes
# No need to run when only the docs are changing. There is
# a workflow to validate the docs.
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onpushpull_requestpull_request_targetpathspaths-ignore
on:
pull_request:
paths-ignore:
- 'docs/**'
- 'mkdocs.yml'
push:
branches:
- main
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
java_version: [17]
os: [windows-2022, macOS-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.java_version }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java_version }}
distribution: 'temurin'
cache: 'maven'
# Adapted from https://github.com/actions/cache/blob/v3/examples.md#java---gradle
- name: Cache local Gradle
id: gradleCache
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Make Maven Wrapper executable
if: contains(matrix.os, 'win') == false
run: chmod +x ./mvnw
- name: Build with Maven
run: ./mvnw install --file pom.xml
- name: Build Gradle Plugin
run: cd jte-gradle-plugin && ./gradlew publishToMavenLocal
- name: Run all the Gradle Plugin tests
id: gradlePluginTests
run: cd test/gradle-test-wrapper && ./gradlew --info check
- name: Stop Gradle Daemon
if: ${{ always() }}
run: cd test/gradle-test-wrapper && ./gradlew --stop
- name: Store Gradle plugin test reports
if: failure() && steps.gradlePluginTests.outcome == 'failure'
uses: actions/upload-artifact@v4
with:
name: failing-test-report
path: test/gradle-test-wrapper/build/reports/tests/test/**/*
# This prevents local published artifacts from be added to GH Actions cache
- name: Clean local artifacts
if: contains(matrix.os, 'win') == false
run: rm -rvf ~/.m2/repository/gg/jte
# `rm` syntax for Windows is different. Needs to use `-Force` since `-f`
# is ambiguous (possible matches include: -Filter -Force).
- name: "[Windows]: Clean local artifacts"
if: contains(matrix.os, 'win')
run: rm -r -Force ~/.m2/repository/gg/jte
coverage:
# Do not run coverage for forks since they cannot upload
# the results to codecov. For reference, see:
# https://docs.github.com/en/actions/using-jobs/using-conditions-to-control-job-execution#example-only-run-job-for-specific-repository
if: github.repository == 'casid/jte'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'temurin'
cache: 'maven'
- name: Make Maven Wrapper executable
if: contains(matrix.os, 'win') == false
run: chmod +x ./mvnw
- name: Build with Maven
run: ./mvnw verify --file pom.xml -Pcoverage
- name: Upload coverage report
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
file: ./test/jte-test-report/target/site/jacoco-aggregate/jacoco.xml
fail_ci_if_error: true