-
Notifications
You must be signed in to change notification settings - Fork 300
117 lines (112 loc) · 3.43 KB
/
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
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
name: CI
on:
push:
branches:
- main
- release-*
pull_request:
env:
build_java_version: 17
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Java
uses: actions/[email protected]
with:
distribution: 'zulu'
java-version: ${{ env.build_java_version }}
- name: Build
uses: gradle/gradle-build-action@v2
with:
arguments: build
- name: Check project files unmodified
run: |
directoryState="$(git status --porcelain)"
if [ -n "$directoryState" ]; then
echo "Some files were modified during build. Please run the build locally before checking in, as it ensures some source file conventions (like copyright header)."
echo "The following files were modified:"
echo "$directoryState"
exit 1
fi
test:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
test_java_version:
- 8
- 11
- 17
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Build JDK
uses: actions/[email protected]
with:
distribution: 'zulu'
java-version: ${{ env.build_java_version }}
- name: Test
uses: gradle/gradle-build-action@v2
with:
arguments: test -PallTests -PtestJavaVersion=${{ matrix.test_java_version }}
cache-disabled: true
integration-test:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
test_java_version:
- 8
- 11
- 17
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Build JDK
uses: actions/[email protected]
with:
distribution: 'zulu'
java-version: ${{ env.build_java_version }}
- name: Set up Test JDK
uses: actions/[email protected]
with:
distribution: 'zulu'
java-version: ${{ matrix.test_java_version }}
- name: Provide installed JDKs
uses: actions/github-script@v7
id: provideJdkPaths
with:
script: |
for ( let envVarName in process.env ) {
if (/JAVA_HOME_\d.*64/.test(envVarName)) {
const version = envVarName.match(/JAVA_HOME_(\d+).*64/)[1];
if (version === "${{ matrix.test_java_version }}") {
core.exportVariable('test_jdk_path', process.env[envVarName]);
} else if (version === "${{ env.build_java_version }}") {
core.exportVariable('build_jdk_path', process.env[envVarName]);
}
}
}
- name: Publish to Maven Local
uses: gradle/gradle-build-action@v2
env:
JAVA_HOME: ${{ env.build_jdk_path }}
with:
arguments: build -xtest -xspotbugsMain -xjavadoc publishToMavenLocal
- name: Integration test
uses: gradle/gradle-build-action@v2
env:
JAVA_HOME: ${{ env.build_jdk_path }}
with:
arguments: runMavenTest -PtestJavaVersion=${{ matrix.test_java_version }} -Porg.gradle.java.installations.paths=${{ env.test_jdk_path }}