-
Notifications
You must be signed in to change notification settings - Fork 27
249 lines (213 loc) · 7.62 KB
/
Copy pathbuild.yml
File metadata and controls
249 lines (213 loc) · 7.62 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
name: Build
on:
pull_request:
branches: [main, 'v*']
push:
branches: [main]
schedule:
# Run every week on a Sunday. The time we run at (3:43am) is
# arbitrary, in the spirit of not contributing to the flood of
# GitHub builds that will occur at midnight/on the hour/on the
# half hour.
- cron: "43 3 * * 6"
workflow_dispatch: {}
jobs:
validate:
name: Validate
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
default_maven_version: ${{ steps.determine_default_maven_version.outputs.default_maven_version }}
steps:
- name: Checkout repository
uses: actions/checkout@v6
###
### Lint scripts and configuration files.
###
- name: Validate shell scripts
uses: ludeeus/action-shellcheck@master
if: ${{ ! cancelled() }}
with:
check_together: 'yes'
scandir: ./scripts
- name: Validate codecov.yml
shell: bash
if: ${{ ! cancelled() }}
run: curl -si --fail-with-body --data-binary @codecov.yml https://codecov.io/validate
###
### Lint GitHub Actions for issues.
###
- name: Lint GitHub Actions
shell: bash
if: ${{ ! cancelled() }}
run: >-
docker run
--rm
--user "$(id -u "${USER}"):$(id -g "${USER}")"
--volume "$(pwd):/repo"
--workdir /repo
rhysd/actionlint:latest
-color
-verbose
###
### Lint Java, export information about current environment for
### the next jobs to utilise.
###
- name: Initialize Java
uses: actions/setup-java@v5
if: always()
with:
cache: maven
distribution: zulu
java-version: 25
- name: Validate license headers and code style
shell: bash
if: ${{ ! cancelled() }}
# Purposely compile here so errorprone can run
run: ./mvnw -B validate compile test-compile -DskipTests
- name: Determine default Maven version
id: determine_default_maven_version
shell: bash
if: always()
run: |-
maven_version=$(./mvnw help:evaluate -Dexpression=maven.version -DforceStdout=true --quiet)
echo "Maven Version: ${maven_version}"
echo "default_maven_version=${maven_version}" >> "${GITHUB_OUTPUT}"
test:
name: Test (${{ matrix.title }})
runs-on: ${{ matrix.os-name }}
timeout-minutes: 25
needs:
- validate
strategy:
fail-fast: false
matrix:
include:
###
### Note, if adding or removing from this matrix, make sure to update the
### `after_n_builds` attribute in codecov.yml to reflect the cardinality of this
### matrix. Otherwise, coverage reporting may fail.
###
- title: lnx/x86/mvn3.9.6/jdk17
os-name: ubuntu-24.04
java-version: 17
maven-version: 3.9.6 # Minimum version
# Note: this runner is expensive!
- title: osx/arm/mvn${{ needs.validate.outputs.default_maven_version }}/jdk17
os-name: macos-26
java-version: 17
maven-version: "${{ needs.validate.outputs.default_maven_version }}"
- title: win/x86/mvn${{ needs.validate.outputs.default_maven_version }}/jdk17
os-name: windows-2025
java-version: 17
maven-version: "${{ needs.validate.outputs.default_maven_version }}"
- title: win/arm/mvn${{ needs.validate.outputs.default_maven_version }}/jdk21
os-name: windows-11-arm
java-version: 21 # This is the earliest-supported version on Windows ARM
maven-version: "${{ needs.validate.outputs.default_maven_version }}"
- title: lnx/arm/mvn${{ needs.validate.outputs.default_maven_version }}/jdk17
os-name: ubuntu-24.04-arm
java-version: 17
maven-version: "${{ needs.validate.outputs.default_maven_version }}"
- title: lnx/x86/mvn${{ needs.validate.outputs.default_maven_version }}/jdk17
os-name: ubuntu-24.04
java-version: 17
maven-version: "${{ needs.validate.outputs.default_maven_version }}"
- title: lnx/x86/mvn${{ needs.validate.outputs.default_maven_version }}/jdk21
os-name: ubuntu-24.04
java-version: 21
maven-version: "${{ needs.validate.outputs.default_maven_version }}"
- title: lnx/x86/mvn${{ needs.validate.outputs.default_maven_version }}/jdk25
os-name: ubuntu-24.04
java-version: 25
maven-version: "${{ needs.validate.outputs.default_maven_version }}"
- title: lnx/x86/mvn4.0.0/jdk17
os-name: ubuntu-24.04
java-version: 17
maven-version: 4.0.0-rc-5
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Initialize Java
uses: actions/setup-java@v5
with:
cache: maven
java-version: ${{ matrix.java-version }}
distribution: zulu
- name: Install dependencies
shell: bash
run: |-
scripts/prepare-runner.sh
scripts/install-protoc-to-github-runner.sh
scripts/install-grpc-java-to-github-runner.sh
- name: Override Maven version in project
shell: bash
run: |-
./mvnw -B -T1 -q wrapper:wrapper "-Dmaven=${{ matrix.maven-version }}"
./mvnw --version
- name: Build and test
shell: bash
run: time ./mvnw -B -e -Dcheckstyle.skip -Dlicense.skip clean verify
- name: Publish coverage to Codecov
uses: codecov/codecov-action@v5
continue-on-error: true
if: ${{ ! cancelled() }}
with:
flags: maven-${{ matrix.maven-version }}-java-${{ matrix.java-version }}-${{ matrix.os-name }}
report_type: coverage
token: ${{ secrets.CODECOV_TOKEN }}
- name: Publish test results to Codecov
uses: codecov/codecov-action@v5
continue-on-error: true
if: ${{ ! cancelled() }}
with:
flags: maven-${{ matrix.maven-version }}-java-${{ matrix.java-version }}-${{ matrix.os-name }}
report_type: test_results
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload build logs as artifacts
uses: actions/upload-artifact@v7
if: always()
with:
name: jdk-${{ matrix.java-version }}-${{ matrix.os-name }}-${{ matrix.maven-version }}
path: |-
**/build.log
**/maven-status/**
**/*-reports/**.txt
**/*-reports/**.xml
**/*.dumpstream
compression-level: 9
retention-days: 7
include-hidden-files: true
if-no-files-found: warn
documentation:
name: Documentation
runs-on: ubuntu-latest
timeout-minutes: 10
needs:
- validate
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Initialize Java
uses: actions/setup-java@v5
with:
cache: maven
distribution: zulu
java-version: 25
- name: Build site
shell: bash
run: |-
./mvnw -B -e site \
-Dmaven.test.skip \
-Dinvoker.skip \
-Dcheckstyle.skip \
-Dlicense.skip
- name: Upload generated site as artifact
uses: actions/upload-artifact@v7
with:
name: site
path: protobuf-maven-plugin/target/site/**
compression-level: 9
retention-days: 7
include-hidden-files: true
if-no-files-found: error