-
Notifications
You must be signed in to change notification settings - Fork 69
180 lines (171 loc) · 6.16 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
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:
# From https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/evaluate-expressions-in-workflows-and-actions#example-returning-a-json-object
build-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- id: set-matrix
run: |
echo "matrix={ \"os\": [\"windows-2022\", \"macOS-latest\", \"ubuntu-latest\"], \"java_version\": [17] }" >> $GITHUB_OUTPUT
build:
name: Build / JDK ${{ matrix.java_version }} / ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs: build-matrix
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.build-matrix.outputs.matrix) }}
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'
- 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
test-gradle-plugin:
name: Test / Gradle / JDK ${{ matrix.java_version }} / ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs:
- build-matrix
- build
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.build-matrix.outputs.matrix) }}
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'
- uses: ./.github/gradle-cache
with:
key: "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 -DskipTests=true
- 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/**/*
- uses: ./.github/prepare-cache-action
test-graal:
name: Test / Graal / JDK ${{ matrix.java_version }} / ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs:
- build-matrix
- build
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.build-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v4
- uses: graalvm/setup-graalvm@v1
with:
distribution: 'graalvm'
java-version: ${{ matrix.java_version }}
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
cache: 'maven'
- uses: ./.github/gradle-cache
with:
key: "gradle-graalvm"
- 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 -DskipTests=true
- name: Build Gradle Plugin
run: cd jte-gradle-plugin && ./gradlew publishToMavenLocal
- name: Test Gradle Plugin Generate with conventions
run: cd test/jte-runtime-cp-test-gradle-convention && ./gradlew check nativeTest
- name: Stop Gradle Daemon
if: ${{ always() }}
run: cd test/jte-runtime-cp-test-gradle-convention && ./gradlew --stop
- uses: ./.github/prepare-cache-action
test-kotlin:
name: Test / Kotlin / ${{ matrix.kotlin-profile }}
runs-on: ubuntu-latest
needs:
- build
strategy:
fail-fast: false
matrix:
kotlin-profile: ["kotlin-1.9", "kotlin-2.0"]
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'temurin'
cache: 'maven'
- name: Make Maven Wrapper executable
run: chmod +x ./mvnw
- name: Build with Maven
run: ./mvnw install --file pom.xml -DskipTests=true
- name: Test Kotlin Profile ${{ matrix.kotlin-profile }}
run: ./mvnw test --file pom.xml --projects jte-kotlin --also-make --activate-profiles ${{ matrix.kotlin-profile }}
- uses: ./.github/prepare-cache-action
coverage:
name: Test / 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
needs:
- test-gradle-plugin
- test-kotlin
- test-graal
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,kotlin-1.9
- 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