forked from line/armeria
-
Notifications
You must be signed in to change notification settings - Fork 0
243 lines (211 loc) · 8.41 KB
/
actions_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
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
name: CI
on:
push:
branches:
- main
tags-ignore:
# The release versions will be verified by 'publish-release.yml'
- armeria-*
pull_request:
merge_group:
concurrency:
# Cancel the previous builds in the same PR.
# Allow running concurrently for all non-PR commits.
group: ci-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
env:
LC_ALL: "en_US.UTF-8"
BUILD_JDK_VERSION: "19"
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
GRADLE_ENTERPRISE_CACHE_USERNAME: ${{ secrets.GRADLE_ENTERPRISE_CACHE_USERNAME }}
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
jobs:
build:
if: github.repository == 'jrhee17/armeria'
runs-on: ${{ matrix.on }}
timeout-minutes: 120
strategy:
fail-fast: false
matrix:
on: [ ubuntu-latest, macos-12, windows-latest ]
java: [ 19 ]
include:
- java: 8
on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- id: setup-jdk
if: ${{ matrix.java != env.BUILD_JDK_VERSION }}
name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
- id: setup-build-jdk
name: Set up build JDK ${{ env.BUILD_JDK_VERSION }}
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: ${{ env.BUILD_JDK_VERSION }}
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Build with Gradle
run: |
./gradlew --no-daemon --stacktrace clean build \
${{ (matrix.on == 'self-hosted') && '--max-workers=8' || '--max-workers=2' }} --parallel \
${{ matrix.coverage && '-Pcoverage' || '' }} \
${{ matrix.leak && '-Pleak' || '' }} \
${{ matrix.blockhound && '-Pblockhound' || '' }} \
-Dscan.tag.exp5 \
-Pretry=true \
-PbuildJdkVersion=${{ env.BUILD_JDK_VERSION }} \
-PtestJavaVersion=${{ matrix.java }} \
${{ matrix.min-java && format('-PminimumJavaVersion={0}', matrix.min-java) || '' }} \
-Porg.gradle.java.installations.paths=${{ steps.setup-build-jdk.outputs.path }},${{ steps.setup-jdk.outputs.path }}
shell: bash
- if: ${{ matrix.snapshot && github.ref_name == 'main' }}
name: Publish snapshots
run: |
./gradlew --no-daemon --stacktrace --max-workers=1 publish
env:
# Should not use '-P' option with 'secrets' that can cause unexpected results
# if secret values contains white spaces or new lines.
ORG_GRADLE_PROJECT_ossrhUsername: ${{ secrets.OSSRH_USER_NAME }}
ORG_GRADLE_PROJECT_ossrhPassword: ${{ secrets.OSSRH_PASSWORD }}
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.GPG_KEY_ID }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_PRIVATE_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_PASSWORD }}
shell: bash
- name: Summarize the failed tests
if: failure()
run: |
./gradlew --no-daemon --stacktrace --max-workers=1 reportFailedTests \
-PnoLint \
-PflakyTests=false \
-PbuildJdkVersion=${{ env.BUILD_JDK_VERSION }} \
-PtestJavaVersion=${{ matrix.java }} \
${{ matrix.min-java && format('-PminimumJavaVersion={0}', matrix.min-java) || '' }} \
-Porg.gradle.java.installations.paths=${{ steps.setup-build-jdk.outputs.path }},${{ steps.setup-jdk.outputs.path }}
SUMMARY_FILE="build/failed-tests-result.txt"
if test -f "$SUMMARY_FILE"; then
echo '### 🔴 Failed tests' >> $GITHUB_STEP_SUMMARY
cat $SUMMARY_FILE >> $GITHUB_STEP_SUMMARY
fi
shell: bash
- name: Dump stuck threads
if: always()
run: jps | grep -iv "jps" | grep -v 'Daemon' | awk '{ print $1 }' | xargs -I'{}' jstack -l {} || true
shell: bash
- name: Upload the coverage report to Codecov
if: ${{ matrix.coverage }}
uses: codecov/codecov-action@v3
- name: Fail the run if any threads were blocked
if: ${{ matrix.blockhound }}
run: |
blockhound_logs=$(find . -name 'blockhound.log' -size +0); \
if [[ -z ${blockhound_logs} ]]; then \
exit 0; \
else \
while IFS= read -r log; do \
echo "- Detected file: ${log}"; \
head --lines=1000 "${log}"; \
echo; \
done <<< "${blockhound_logs}"; \
exit 1; \
fi
shell: bash
- name: Collect the test reports
if: failure()
run: |
find . '(' \
-name 'java_pid*.hprof' -or \
-name 'hs_err_*.log' -or \
-path '*/build/reports/tests' -or \
-path '*/build/test-results' -or \
-path '*/javadoc.options' -or \
-name 'blockhound.log' ')' \
-exec tar rf "reports-JVM-${{ matrix.on }}-${{ matrix.java }}${{ matrix.min-java && format('-{0}', matrix.min-java) || '' }}.tar" {} ';'
shell: bash
- name: Upload the artifacts
if: failure()
uses: actions/upload-artifact@v2
with:
name: reports-JVM-${{ matrix.on }}-${{ matrix.java }}${{ matrix.min-java && format('-{0}', matrix.min-java) || '' }}
path: reports-JVM-${{ matrix.on }}-${{ matrix.java }}${{ matrix.min-java && format('-{0}', matrix.min-java) || '' }}.tar
retention-days: 3
lint:
if: github.repository == 'line/armeria'
runs-on: self-hosted
timeout-minutes: 60
steps:
- uses: actions/checkout@v2
- id: setup-build-jdk
name: Set up JDK ${{ env.BUILD_JDK_VERSION }}
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: ${{ env.BUILD_JDK_VERSION }}
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Run the linters
run: |
./gradlew --no-daemon --stacktrace --max-workers=8 --parallel lint
site:
if: github.repository == 'line/armeria'
# ubuntu-latest is preferred for site job.
# node_modules need complicated dependencies that are difficult to install on self-hosted runners.
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v2
- name: Install svgbob_cli
run: |
sudo apt-get -y install cargo && cargo install svgbob_cli
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- id: setup-build-jdk
name: Set up JDK ${{ env.BUILD_JDK_VERSION }}
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: ${{ env.BUILD_JDK_VERSION }}
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Build the site
run: |
./gradlew --no-daemon --stacktrace --max-workers=2 --parallel -PgithubToken=${{ secrets.GITHUB_TOKEN }} site
shell: bash
flaky-tests:
if: github.repository == 'line/armeria'
runs-on: self-hosted
timeout-minutes: 60
steps:
- uses: actions/checkout@v2
- id: setup-build-jdk
name: Set up JDK ${{ env.BUILD_JDK_VERSION }}
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: ${{ env.BUILD_JDK_VERSION }}
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Run flaky tests
run: |
./gradlew --no-daemon --stacktrace --max-workers=2 --parallel check \
-PnoLint -PflakyTests=true -Pretry=true \
-PbuildJdkVersion=${{ env.BUILD_JDK_VERSION }} \
-PtestJavaVersion=${{ env.BUILD_JDK_VERSION }} \
-Porg.gradle.java.installations.paths=${{ steps.setup-build-jdk.outputs.path }}
- name: Summarize the failed tests
if: failure()
run: |
./gradlew --no-daemon --stacktrace --max-workers=1 -PnoWeb -PnoLint reportFailedTests
SUMMARY_FILE="build/failed-tests-result.txt"
if test -f "$SUMMARY_FILE"; then
echo '#### 🔴 Failed tests' >> $GITHUB_STEP_SUMMARY
cat $SUMMARY_FILE >> $GITHUB_STEP_SUMMARY
fi
shell: bash
- name: Dump stuck threads
if: always()
run: jps | grep -iv "jps" | grep -v 'Daemon' | awk '{ print $1 }' | xargs -I'{}' jstack -l {} || true
shell: bash