-
Notifications
You must be signed in to change notification settings - Fork 51
175 lines (171 loc) · 7.07 KB
/
gradle.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
# This workflow will build a Java project with Gradle
# For more information see: https://docs.github.com/en/free-pro-team@latest/actions/guides/building-and-testing-java-with-gradle
name: Java CI with Gradle
on:
push:
branches: '**'
pull_request:
branches: [ main ]
jobs:
# UNIX BUILDS
build-unix:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# test against latest update of each major Java version, as well as specific updates of LTS versions:
RUNTIME: [ol, wlp]
RUNTIME_VERSION: [23.0.0.10]
java: [21, 17, 11, 8]
exclude:
- java: 8
RUNTIME: wlp
- java: 11
RUNTIME: ol
name: ${{ matrix.RUNTIME }} ${{ matrix.RUNTIME_VERSION }}, Java ${{ matrix.java }}, Linux
steps:
# Checkout repos
- name: Checkout ci.gradle
uses: actions/checkout@v3
- name: Setup Java ${{ matrix.java }}
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: ${{ matrix.java }}
cache: 'gradle'
- name: Checkout ci.common
uses: actions/checkout@v3
with:
repository: OpenLiberty/ci.common
path: ci.common
- name: Checkout ci.ant
uses: actions/checkout@v3
with:
repository: OpenLiberty/ci.ant
path: ci.ant
# Cache mvn/gradle packages
- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
# Install dependencies
- name: Install ci.ant and ci.common
run: |
mvn -V clean install -f ci.ant --batch-mode --no-transfer-progress --errors -DtrimStackTrace=false -DskipTests
mvn -V clean install -f ci.common --batch-mode --no-transfer-progress --errors -DtrimStackTrace=false -DskipTests
# Run tests that require a minimum of Java 17 or later
- name: Run tests that require a minimum of Java 17 or later
if: ${{ matrix.java == '17' || matrix.java == '21' }}
run:
./gradlew clean install check -P"test.include"="**/TestSpringBootApplication30*" -Druntime=${{ matrix.RUNTIME }} -DruntimeVersion="${{ matrix.RUNTIME_VERSION }}" --stacktrace --info
# Run tests
- name: Run tests with Gradle on Ubuntu
run:
./gradlew clean install check -P"test.exclude"="**/TestSpringBootApplication30*,**/DevContainerTest*" -Druntime=${{ matrix.RUNTIME }} -DruntimeVersion="${{ matrix.RUNTIME_VERSION }}" --stacktrace --info
# Copy build reports and upload artifact if build failed
- name: Copy build/report/tests/test for upload
if: ${{ failure() }}
run: |
mkdir -p ${BUILD_REPORTS_PATH}
cp -r test ${BUILD_REPORTS_PATH}
working-directory: build/reports/tests
env:
BUILD_REPORTS_PATH: /buildReports/${{runner.os}}/java${{matrix.java}}/${{matrix.RUNTIME}}-${{matrix.RUNTIME_VERSION}}/
- uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: buildReportsArtifactLinux
path: /buildReports
retention-days: 3
# WINDOWS BUILDS
build-windows:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
# test against latest update of each major Java version, as well as specific updates of LTS versions:
RUNTIME: [ol, wlp]
RUNTIME_VERSION: [23.0.0.10]
java: [21, 17, 11, 8]
exclude:
- java: 8
RUNTIME: ol
- java: 11
RUNTIME: wlp
name: ${{ matrix.RUNTIME }} ${{ matrix.RUNTIME_VERSION }}, Java ${{ matrix.java }}, Windows
steps:
# Checkout repos
- name: Checkout ci.gradle
uses: actions/checkout@v3
- name: Setup Java ${{ matrix.java }}
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: ${{ matrix.java }}
cache: 'gradle'
# Moving and cloning to C: drive for Windows for more disk space
- name: Clone ci.ant, ci.common, ci.gradle repos to C drive
run: |
cp -r D:/a/ci.gradle/ci.gradle C:/ci.gradle
git clone https://github.com/OpenLiberty/ci.common.git C:/ci.common
git clone https://github.com/OpenLiberty/ci.ant.git C:/ci.ant
# Cache mvn/gradle packages
- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
# Install ci.ant
- name: Install ci.ant
working-directory: C:/ci.ant
run: mvn -V clean install --batch-mode --no-transfer-progress --errors -DtrimStackTrace=false -DskipTests
# Install ci.common
- name: Install ci.common
working-directory: C:/ci.common
run: mvn -V clean install --batch-mode --no-transfer-progress --errors -DtrimStackTrace=false -DskipTests
# Run tests that require a minimum of Java 17 or later
- name: Run tests that require a minimum of Java 17 or later
if: ${{ matrix.java == '17' || matrix.java == '21' }}
run:
./gradlew clean install check -P"test.include"="**/TestSpringBootApplication30*" -Druntime=${{ matrix.RUNTIME }} -DruntimeVersion="${{ matrix.RUNTIME_VERSION }}" --stacktrace --info --no-daemon
# Run tests
- name: Run tests with Gradle on Windows
working-directory: C:/ci.gradle
# LibertyTest is excluded because test0_run hangs
# For Java 8, TestCreateWithConfigDir is excluded because test_micro_clean_liberty_plugin_variable_config runs out of memory
env:
TEST_EXCLUDE: ${{ ((matrix.java == '8') && '"**/TestCreateWithConfigDir*,**/Polling*,**/LibertyTest*,**/GenerateFeaturesTest*,**/TestSpringBootApplication30*,**/DevContainerTest*"') || '"**/Polling*,**/LibertyTest*,**/GenerateFeaturesTest*,**/TestSpringBootApplication30*,**/DevContainerTest*"' }}
run: ./gradlew clean install check -P"test.exclude"=$TEST_EXCLUDE -Druntime=${{ matrix.RUNTIME }} -DruntimeVersion="${{ matrix.RUNTIME_VERSION }}" --stacktrace --info --no-daemon
timeout-minutes: 75
# Copy build reports and upload artifact if build failed
- name: Copy build/report/tests/test for upload
if: ${{ failure() }}
working-directory: C:/ci.gradle
run: cp -r build/reports/tests/test D:/buildReports/${{runner.os}}/java${{matrix.java}}/${{matrix.RUNTIME}}-${{matrix.RUNTIME_VERSION}}/
- uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: buildReportsArtifactWindows
path: D:/buildReports
retention-days: 3