forked from dapr/java-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
270 lines (256 loc) · 10 KB
/
build.yml
File metadata and controls
270 lines (256 loc) · 10 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
name: Build
on:
workflow_dispatch:
push:
branches:
- master
- release-*
tags:
- v*
pull_request:
branches:
- master
- release-*
jobs:
test:
name: "Unit tests"
runs-on: ubuntu-latest
timeout-minutes: 30
continue-on-error: false
env:
JDK_VER: 17
steps:
- uses: actions/checkout@v5
- name: Set up OpenJDK ${{ env.JDK_VER }}
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ env.JDK_VER }}
- name: Run tests
run: ./mvnw clean install -B -q -DskipITs=true
- name: Codecov
uses: codecov/codecov-action@v5.5.2
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload test report for sdk
uses: actions/upload-artifact@v7
with:
name: test-dapr-java-sdk-jdk${{ env.JDK_VER }}
path: sdk/target/jacoco-report/
- name: Upload test report for sdk-actors
uses: actions/upload-artifact@v7
with:
name: report-dapr-java-sdk-actors-jdk${{ env.JDK_VER }}
path: sdk-actors/target/jacoco-report/
build-durabletask:
name: "Durable Task build & tests"
runs-on: ubuntu-latest
timeout-minutes: 30
continue-on-error: false
env:
JDK_VER: 17
steps:
- uses: actions/checkout@v5
- name: Set up OpenJDK ${{ env.JDK_VER }}
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ env.JDK_VER }}
- name: Checkout Durable Task Sidecar
uses: actions/checkout@v4
with:
repository: dapr/durabletask-go
path: durabletask-sidecar
# TODO: Move the sidecar into a central image repository
- name: Initialize Durable Task Sidecar
run: docker run -d --name durabletask-sidecar -p 4001:4001 --rm -i $(docker build -q ./durabletask-sidecar)
- name: Display Durable Task Sidecar Logs
run: nohup docker logs --since=0 durabletask-sidecar > durabletask-sidecar.log 2>&1 &
# wait for 10 seconds, so sidecar container can be fully up, this will avoid intermittent failing issues for integration tests causing by failed to connect to sidecar
- name: Wait for 10 seconds
run: sleep 10
- name: Integration Tests For Durable Tasks
run: ./mvnw -B -pl durabletask-client -Pintegration-tests dependency:copy-dependencies verify || echo "TEST_FAILED=true" >> $GITHUB_ENV
continue-on-error: true
- name: Kill Durable Task Sidecar
run: docker kill durabletask-sidecar
- name: Upload Durable Task Sidecar Logs
uses: actions/upload-artifact@v7
with:
name: Durable Task Sidecar Logs
path: durabletask-sidecar.log
- name: Fail the job if tests failed
if: env.TEST_FAILED == 'true'
run: exit 1
build:
name: "Build jdk:${{ matrix.java }} sb:${{ matrix.spring-boot-display-version }} exp:${{ matrix.experimental }}"
runs-on: ubuntu-latest
timeout-minutes: 45
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
matrix:
java: [ 17 ]
spring-boot-version: [ 3.5.4 ]
spring-boot-display-version: [ 3.5.x ]
experimental: [ false ]
include:
- java: 17
spring-boot-version: 4.0.2
spring-boot-display-version: 4.0.x
experimental: false
env:
GOVER: "1.20"
GOOS: linux
GOARCH: amd64
GOPROXY: https://proxy.golang.org
JDK_VER: ${{ matrix.java }}
DAPR_CLI_VER: 1.17.0
DAPR_RUNTIME_VER: 1.17.0
DAPR_INSTALL_URL: https://raw.githubusercontent.com/dapr/cli/v1.17.0/install/install.sh
DAPR_CLI_REF:
DAPR_REF:
TOXIPROXY_URL: https://github.com/Shopify/toxiproxy/releases/download/v2.5.0/toxiproxy-server-linux-amd64
steps:
- uses: actions/checkout@v5
- name: Check Docker version
run: docker version
- name: Set up OpenJDK ${{ env.JDK_VER }}
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: ${{ env.JDK_VER }}
- name: Set up Dapr CLI
run: wget -q ${{ env.DAPR_INSTALL_URL }} -O - | /bin/bash -s ${{ env.DAPR_CLI_VER }}
- name: Set up Go ${{ env.GOVER }}
if: env.DAPR_REF != '' || env.DAPR_CLI_REF != ''
uses: actions/setup-go@v6
with:
go-version: ${{ env.GOVER }}
- name: Checkout Dapr CLI repo to override dapr command.
uses: actions/checkout@v5
if: env.DAPR_CLI_REF != ''
with:
repository: dapr/cli
ref: ${{ env.DAPR_CLI_REF }}
path: cli
- name: Checkout Dapr repo to override daprd.
uses: actions/checkout@v5
if: env.DAPR_REF != ''
with:
repository: dapr/dapr
ref: ${{ env.DAPR_REF }}
path: dapr
- name: Build and override dapr cli with referenced commit.
if: env.DAPR_CLI_REF != ''
run: |
cd cli
make
sudo cp dist/linux_amd64/release/dapr /usr/local/bin/dapr
cd ..
- name: Uninstall Dapr runtime ${{ env.DAPR_RUNTIME_VER }}
run: dapr uninstall --all
- name: Ensure Dapr runtime uninstalled
run: |
while [ "$(docker ps -aq --filter 'name=^/dapr')" ]; do
echo "Waiting for Dapr containers to be deleted..."
sleep 5
done
echo "All dapr containers are deleted."
- name: Initialize Dapr runtime ${{ env.DAPR_RUNTIME_VER }}
run: dapr init --runtime-version ${{ env.DAPR_RUNTIME_VER }}
- name: Build and override daprd with referenced commit.
if: env.DAPR_REF != ''
run: |
cd dapr
make
mkdir -p $HOME/.dapr/bin/
cp dist/linux_amd64/release/daprd $HOME/.dapr/bin/daprd
cd ..
- name: Override placement service.
if: env.DAPR_REF != ''
run: |
docker stop dapr_placement
cd dapr
./dist/linux_amd64/release/placement &
- name: Spin local environment
run: |
docker compose -f ./sdk-tests/deploy/local-test.yml up -d mongo kafka
docker ps
- name: Install local ToxiProxy to simulate connectivity issues to Dapr sidecar
run: |
mkdir -p /home/runner/.local/bin
wget -q ${{ env.TOXIPROXY_URL }} -O /home/runner/.local/bin/toxiproxy-server
chmod +x /home/runner/.local/bin/toxiproxy-server
/home/runner/.local/bin/toxiproxy-server --version
- name: Clean up and install sdk
run: ./mvnw clean install -B -q -DskipTests
- name: Integration tests using spring boot 3.x version ${{ matrix.spring-boot-version }}
id: integration_tests
if: ${{ matrix.spring-boot-display-version == '3.5.x' }}
run: PRODUCT_SPRING_BOOT_VERSION=${{ matrix.spring-boot-version }} ./mvnw -B -pl !durabletask-client -Pintegration-tests dependency:copy-dependencies verify
- name: Integration tests using spring boot 4.x version ${{ matrix.spring-boot-version }}
id: integration_sb4_tests
if: ${{ matrix.spring-boot-display-version == '4.0.x' }}
run: PRODUCT_SPRING_BOOT_VERSION=${{ matrix.spring-boot-version }} ./mvnw -B -pl !durabletask-client -Pintegration-sb4-tests dependency:copy-dependencies verify
- name: Upload failsafe test report for sdk-tests on failure
if: ${{ failure() && steps.integration_tests.conclusion == 'failure' }}
uses: actions/upload-artifact@v7
with:
name: failsafe-report-sdk-tests-jdk${{ matrix.java }}-sb${{ matrix.spring-boot-version }}
path: sdk-tests/target/failsafe-reports
- name: Upload failsafe test report for sb4 sdk-tests on failure
if: ${{ failure() && steps.integration_sb4_tests.conclusion == 'failure' }}
uses: actions/upload-artifact@v7
with:
name: failsafe-report-sdk-tests-jdk${{ matrix.java }}-sb${{ matrix.spring-boot-version }}
path: spring-boot-4-sdk-tests/target/failsafe-reports
- name: Upload surefire test report for sdk-tests on failure
if: ${{ failure() && steps.integration_tests.conclusion == 'failure' }}
uses: actions/upload-artifact@v7
with:
name: surefire-report-sdk-tests-jdk${{ matrix.java }}-sb${{ matrix.spring-boot-version }}
path: sdk-tests/target/surefire-reports
- name: Upload surefire test report for sdk-tests on failure
if: ${{ failure() && steps.integration_sb4_tests.conclusion == 'failure' }}
uses: actions/upload-artifact@v7
with:
name: surefire-report-sdk-tests-jdk${{ matrix.java }}-sb${{ matrix.spring-boot-version }}
path: spring-boot-4-sdk-tests/target/surefire-reports
publish:
runs-on: ubuntu-latest
needs: [ build, test, build-durabletask ]
timeout-minutes: 30
env:
JDK_VER: 17
OSSRH_USER_TOKEN: ${{ secrets.OSSRH_USER_TOKEN }}
OSSRH_PWD_TOKEN: ${{ secrets.OSSRH_PWD_TOKEN }}
GPG_KEY: ${{ secrets.GPG_KEY }}
GPG_PWD: ${{ secrets.GPG_PWD }}
steps:
- uses: actions/checkout@v5
- name: Set up OpenJDK ${{ env.JDK_VER }}
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: ${{ env.JDK_VER }}
- name: Get pom parent version
run: |
PARENT_VERSION=$(./mvnw -B -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
echo "PARENT_VERSION=$PARENT_VERSION" >> $GITHUB_ENV
- name: Is SNAPSHOT release ?
if: contains(github.ref, 'master') && contains(env.PARENT_VERSION, '-SNAPSHOT')
run: |
echo "DEPLOY_OSSRH=true" >> $GITHUB_ENV
- name: Is Release or RC version ?
if: startswith(github.ref, 'refs/tags/v') && !contains(env.PARENT_VERSION, '-SNAPSHOT')
run: |
echo "DEPLOY_OSSRH=true" >> $GITHUB_ENV
- name: Publish to ossrh
if: env.DEPLOY_OSSRH == 'true'
run: |
echo ${{ secrets.GPG_PRIVATE_KEY }} | base64 -d > private-key.gpg
export GPG_TTY=$(tty)
gpg --batch --import private-key.gpg
./mvnw -V -B -Dgpg.skip=false -DskipTests -s settings.xml deploy
curl -X POST https://ossrh-staging-api.central.sonatype.com/manual/upload/defaultRepository/io.dapr