-
Notifications
You must be signed in to change notification settings - Fork 10
155 lines (134 loc) · 3.83 KB
/
build.yml
File metadata and controls
155 lines (134 loc) · 3.83 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
name: Build
on:
pull_request:
branches:
- main
- v*
push:
branches:
- main
- v*
workflow_call: {}
workflow_dispatch: {}
jobs:
validate:
name: Validate
runs-on: ubuntu-latest
timeout-minutes: 5
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 when we turn it on
run: ./mvnw -B validate compile test-compile -DskipTests
build:
name: Build on JDK ${{ matrix.java-version }} (${{ matrix.os-name }})
runs-on: ${{ matrix.os-name }}
needs:
- validate
strategy:
fail-fast: false
matrix:
os-name: [ubuntu-latest]
java-version:
- 17 # LTS
- 21 # LTS
- 25 # LTS
include:
- os-name: windows-11-arm
java-version: 23 # Latest Temurin for ARM
- os-name: macos-latest
java-version: 25 # LTS
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 2
- name: Initialize JDK
uses: actions/setup-java@v5
with:
check-latest: true
distribution: temurin
java-version: ${{ matrix.java-version }}
- name: Maven cache
uses: actions/cache@v5
env:
cache-name: maven-cache
with:
path:
~/.m2
key: build-${{ env.cache-name }}
- name: Compile and run tests
shell: bash
run: ./mvnw -B -U clean verify
- name: Publish code coverage to Codecov
uses: codecov/codecov-action@v5
continue-on-error: true
if: ${{ ! cancelled() }}
with:
flags: 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
if: ${{ ! cancelled() }}
with:
flags: 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 }}
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