-
Notifications
You must be signed in to change notification settings - Fork 1.1k
317 lines (316 loc) · 9.55 KB
/
ci.yaml
File metadata and controls
317 lines (316 loc) · 9.55 KB
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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Github action job to test core java library features on
# downstream client libraries before they are released.
on:
push:
branches:
- main
pull_request:
name: ci
jobs:
# detect whether or note we should run "bulk" (non-handwritten) unit tests
bulk-filter:
runs-on: ubuntu-latest
permissions:
pull-requests: read
# Set job outputs to values from filter step
outputs:
src: ${{ steps.filter.outputs.src }}
ci: ${{ steps.filter.outputs.ci }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
# we want to run tests if source code is changed or the scripts
# used to run the unit tests
filters: |
src:
- '**/*.java'
- '**/pom.xml'
ci:
- '.github/workflows/ci.yaml'
- '.kokoro/**'
# these unit tests are "bulk" (non-handwritten) libraries
units:
runs-on: ubuntu-latest
needs: bulk-filter
strategy:
fail-fast: false
matrix:
java: [11, 17, 21, 25]
steps:
- name: Get current week within the year
id: date
run: echo "::set-output name=week_of_year::$(date +'%W' --utc)"
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: ${{matrix.java}}
- run: java -version
- uses: actions/cache@v4
id: mvn-cache
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-unified-${{ steps.date.outputs.week_of_year }}
- run: .kokoro/build.sh
if: ${{ needs.bulk-filter.outputs.src == 'true' || needs.bulk-filter.outputs.ci == 'true' }}
env:
JOB_TYPE: test
JOB_NAME: units-${{matrix.java}}
units-8-runtime:
runs-on: ubuntu-latest
needs: bulk-filter
name: "units (8)"
steps:
- name: Get current week within the year
id: date
run: echo "::set-output name=week_of_year::$(date +'%W' --utc)"
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: 8
distribution: temurin
- name: "Set jvm system property environment variable for surefire plugin (unit tests)"
# Maven surefire plugin (unit tests) allows us to specify JVM to run the tests.
# https://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#jvm
run: echo "SUREFIRE_JVM_OPT=-Djvm=${JAVA_HOME}/bin/java" >> $GITHUB_ENV
shell: bash
- uses: actions/setup-java@v4
with:
java-version: 11
distribution: temurin
cache: maven
- uses: actions/cache@v4
id: mvn-cache
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-unified-${{ steps.date.outputs.week_of_year }}
- run: .kokoro/build.sh
if: ${{ needs.bulk-filter.outputs.src == 'true' || needs.bulk-filter.outputs.ci == 'true' }}
shell: bash
env:
JOB_TYPE: test
JOB_NAME: units-8-runtime-${{matrix.java}}
# detect which libraries have changed
changes:
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
packages: ${{ steps.filter.outputs.changes }}
steps:
- uses: dorny/paths-filter@v4
id: filter
with:
filters: |
java-bigquery: java-bigquery/**
java-bigquerystorage: java-bigquerystorage/**
java-datastore: java-datastore/**
java-logging-logback: java-logging-logback/**
java-logging: java-logging/**
java-spanner: java-spanner/**
java-storage: java-storage/**
sdk-platform-java: sdk-platform-java/**
split-units:
runs-on: ubuntu-latest
needs: changes
strategy:
fail-fast: false
matrix:
package: ${{ fromJSON(needs.changes.outputs.packages) }}
java: [11, 17, 21, 25]
steps:
- name: Get current week within the year
id: date
run: echo "::set-output name=week_of_year::$(date +'%W' --utc)"
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: ${{matrix.java}}
- run: .kokoro/build.sh
env:
BUILD_SUBDIR: ${{matrix.package}}
JOB_TYPE: test
JOB_NAME: units-${{matrix.package}}-${{matrix.java}}
split-units-8:
runs-on: ubuntu-latest
name: "split-units"
needs: changes
strategy:
fail-fast: false
matrix:
package: ${{ fromJSON(needs.changes.outputs.packages) }}
java: [8]
steps:
- name: Get current week within the year
id: date
run: echo "::set-output name=week_of_year::$(date +'%W' --utc)"
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: 11
distribution: temurin
cache: maven
- run: java -version
- uses: actions/cache@v4
id: mvn-cache
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-unified-${{ steps.date.outputs.week_of_year }}
- name: Install all modules using Java 11
shell: bash
run: .kokoro/build.sh
env:
BUILD_SUBDIR: ${{matrix.package}}
JOB_TYPE: install
- uses: actions/setup-java@v4
with:
java-version: ${{matrix.java}}
distribution: temurin
- run: java -version
- name: Run tests in Java ${{matrix.java}} with the source compiled in Java 11
run: |
mvn test \
-B -ntp \
-Dorg.slf4j.simpleLogger.showDateTime=true \
-Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss:SSS \
-Dclirr.skip=true \
-Denforcer.skip=true \
-Dcheckstyle.skip=true \
-Dflatten.skip=true \
-Danimal.sniffer.skip=true \
-Dmaven.wagon.http.retryHandler.count=5 \
--also-make \
-T 1C
env:
BUILD_SUBDIR: ${{matrix.package}}
JOB_TYPE: test
JOB_NAME: units-8-runtime-${{matrix.java}}
working-directory: ${{matrix.package}}
windows:
runs-on: windows-latest
steps:
- name: Support longpaths
run: git config --system core.longpaths true
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 11
cache: 'maven'
- run: java -version
- run: .kokoro/build.sh
env:
JOB_TYPE: test
JOB_NAME: windows-units
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- run: java -version
- run: .kokoro/build.sh
env:
JOB_TYPE: lint
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
BASE_SHA: ${{ github.event.pull_request.base.sha }}
enforcer:
runs-on: ubuntu-latest
steps:
- name: Get current week within the year
id: date
run: echo "::set-output name=week_of_year::$(date +'%W' --utc)"
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 11
cache: maven
- run: java -version
- name: Install Maven modules to local Maven repository
run: .kokoro/build.sh
env:
JOB_TYPE: install
- run: java -version
- run: mvn -B -ntp enforcer:enforce@enforce -T 1C
gapic-libraries-bom:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: 11
distribution: temurin
cache: maven
- name: Install Maven modules to local Maven repository
run: .kokoro/build.sh
env:
JOB_TYPE: install
- name: Validate gapic-libraries-bom
uses: googleapis/java-cloud-bom/tests/validate-bom@v26.79.0
with:
bom-path: gapic-libraries-bom/pom.xml
generation-config-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: validate generation configuration
shell: bash
run: |
docker run \
--rm \
--quiet \
-u "$(id -u):$(id -g)" \
-v "$(pwd):${workspace_name}" \
--entrypoint python \
gcr.io/cloud-devrel-public-resources/java-library-generation:"${library_generation_image_tag}" \
/src/library_generation/cli/entry_point.py validate-generation-config
env:
library_generation_image_tag: 2.68.0
workspace_name: /workspace
# TODO: Uncomment the needed Github Actions
# dependencies:
# runs-on: ubuntu-latest
# strategy:
# matrix:
# java: [8, 11, 17]
# steps:
# - uses: actions/checkout@v3
# - uses: actions/setup-java@v3
# with:
# distribution: zulu
# java-version: ${{matrix.java}}
# - run: java -version
# - run: .kokoro/dependencies.sh
# clirr:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - uses: actions/setup-java@v3
# with:
# distribution: zulu
# java-version: 8
# - run: java -version
# - run: .kokoro/build.sh
# env:
# JOB_TYPE: clirr