blob: 84b0042dd67f979198547ce50f318bf9f458d3e7 [file] [log] [blame]
Jiayu Liubcac9782022-05-07 08:35:09 +08001name: "Build"
Jiayu Liuc77d91a2022-05-03 20:55:50 +08002
Jiayu Liu6a61c4e2022-04-29 01:25:39 +08003on:
4 push:
Jiayu Liubcac9782022-05-07 08:35:09 +08005 branches: ["*"]
Jiayu Liu6a61c4e2022-04-29 01:25:39 +08006 pull_request:
Jiayu Liubcac9782022-05-07 08:35:09 +08007 branches: ["*"]
Jiayu Liuc77d91a2022-05-03 20:55:50 +08008
9env:
Jiayu Liuab83ffc2022-05-10 01:56:30 +080010 BUILD_DEPS: automake bison flex git libboost-all-dev libevent-dev libssl-dev libtool make pkg-config
Jiayu Liuc77d91a2022-05-03 20:55:50 +080011
Varun Sharmabd1e5db2022-09-14 07:31:30 -070012permissions:
13 contents: read
14
Jiayu Liu6a61c4e2022-04-29 01:25:39 +080015jobs:
16 # TODO windows and macos
Jiayu Liuc77d91a2022-05-03 20:55:50 +080017 compiler:
Jiayu Liu6a61c4e2022-04-29 01:25:39 +080018 strategy:
Jiayu Liuc77d91a2022-05-03 20:55:50 +080019 matrix:
20 os: [ubuntu-18.04, ubuntu-20.04]
Jiayu Liu6a61c4e2022-04-29 01:25:39 +080021 runs-on: ${{ matrix.os }}
22 steps:
23 - uses: actions/checkout@v3
24
25 - name: Install dependencies
26 run: |
Jiayu Liu6a61c4e2022-04-29 01:25:39 +080027 sudo apt-get update -yq
Jiayu Liuab83ffc2022-05-10 01:56:30 +080028 sudo apt-get install -y --no-install-recommends g++ $BUILD_DEPS
Jiayu Liu6a61c4e2022-04-29 01:25:39 +080029
30 - name: Run bootstrap
31 run: ./bootstrap.sh
32
33 - name: Run configure
34 run: ./configure --disable-debug --disable-tests --disable-libs
35
36 - name: Run make
37 run: make -j$(nproc)
38
39 - name: Run install
40 run: make install
41
42 - name: Run thrift version
43 run: /usr/local/bin/thrift -version
Jiayu Liuc77d91a2022-05-03 20:55:50 +080044
45 # only upload while building ubuntu-20.04
46 - name: Archive built thrift compiler
47 if: matrix.os == 'ubuntu-20.04'
48 uses: actions/upload-artifact@v3
49 with:
50 name: thrift-compiler
51 path: compiler/cpp/thrift
52 retention-days: 3
53
Jiayu Liud21e95a2022-10-09 08:49:29 +080054 lib-go:
55 needs: compiler
56 runs-on: ubuntu-20.04
57 steps:
58 - uses: actions/checkout@v3
59
60 - uses: actions/setup-go@v3
61 with:
62 go-version: '>=1.17.0'
63
64 - name: Install dependencies
65 run: |
66 sudo apt-get update -yq
67 sudo apt-get install -y --no-install-recommends $BUILD_DEPS
68
69 - name: Run bootstrap
70 run: ./bootstrap.sh
71
72 - name: Run configure
73 run: |
74 ./configure \
75 --disable-debug \
76 --disable-tests \
77 --disable-dependency-tracking \
78 --without-cpp \
79 --without-c_glib \
80 --without-java \
81 --without-kotlin \
82 --without-python \
83 --without-py3 \
84 --without-ruby \
85 --without-haxe \
86 --without-netstd \
87 --without-perl \
88 --without-php \
89 --without-php_extension \
90 --without-dart \
91 --without-erlang \
92 --with-go \
93 --without-d \
94 --without-nodejs \
95 --without-nodets \
96 --without-lua \
97 --without-rs \
98 --without-swift
99
100 - uses: actions/download-artifact@v3
101 with:
102 name: thrift-compiler
103 path: compiler/cpp
104
105 - name: Run thrift-compiler
106 run: |
107 chmod a+x compiler/cpp/thrift
108 compiler/cpp/thrift -version
109
110 - name: Run make for go
111 run: make -C lib/go
112
113 - name: Run make check for go
114 run: make -C lib/go check
115
116 - name: Run make precross for go test
117 run: make -C test/go precross
118
119 - name: Upload go precross artifacts
120 uses: actions/upload-artifact@v3
121 with:
122 name: go-precross
123 if-no-files-found: error
124 path: |
125 test/go/bin/*
126 retention-days: 3
127
Jiayu Liuc77d91a2022-05-03 20:55:50 +0800128 lib-java-kotlin:
129 needs: compiler
130 runs-on: ubuntu-20.04
131 env:
Jiayu Liu8a321562022-09-06 08:57:19 +0800132 GRADLE_VERSION: 7.5.1
Jiayu Liuc77d91a2022-05-03 20:55:50 +0800133 steps:
134 - uses: actions/checkout@v3
135
136 - uses: actions/setup-java@v3
137 with:
138 distribution: temurin
139 java-version: 11
Jiayu Liubcac9782022-05-07 08:35:09 +0800140 cache: "gradle"
Jiayu Liuc77d91a2022-05-03 20:55:50 +0800141
142 - name: Install dependencies
143 run: |
144 sudo apt-get update -yq
145 sudo apt-get install -y --no-install-recommends $BUILD_DEPS
146 sudo apt-get install -y wget unzip ant maven
147
148 - name: Setup gradle
149 run: |
150 wget https://services.gradle.org/distributions/gradle-$GRADLE_VERSION-bin.zip -q -O /tmp/gradle-$GRADLE_VERSION-bin.zip
Jiayu Liu8a321562022-09-06 08:57:19 +0800151 (echo "f6b8596b10cce501591e92f229816aa4046424f3b24d771751b06779d58c8ec4 /tmp/gradle-$GRADLE_VERSION-bin.zip" | sha256sum -c -)
Jiayu Liuc77d91a2022-05-03 20:55:50 +0800152 unzip -d /tmp /tmp/gradle-$GRADLE_VERSION-bin.zip
153 sudo mv /tmp/gradle-$GRADLE_VERSION /usr/local/gradle
154 sudo ln -s /usr/local/gradle/bin/gradle /usr/local/bin
155 gradle --version
156
Jiayu Liubcac9782022-05-07 08:35:09 +0800157 - name: Run spotlessCheck for Java
Jiayu Liu53ec0822022-05-06 12:56:42 +0800158 run: |
159 cd lib/java
160 gradle spotlessCheck
161
Jiayu Liubcac9782022-05-07 08:35:09 +0800162 - name: Run ktfmtCheck for Kotlin
163 run: |
164 cd lib/kotlin
165 gradle ktfmtCheck
166
Jiayu Liuc77d91a2022-05-03 20:55:50 +0800167 - name: Run bootstrap
168 run: ./bootstrap.sh
169
170 - name: Run configure
171 run: |
172 ./configure \
173 --disable-debug \
174 --disable-tests \
175 --disable-dependency-tracking \
176 --without-cpp \
177 --without-c_glib \
178 --with-java \
179 --with-kotlin \
180 --without-python \
181 --without-py3 \
182 --without-ruby \
183 --without-haxe \
184 --without-netstd \
185 --without-perl \
186 --without-php \
187 --without-php_extension \
188 --without-dart \
189 --without-erlang \
190 --without-go \
191 --without-d \
192 --without-nodejs \
193 --without-nodets \
194 --without-lua \
195 --without-rs \
196 --without-swift
197
198 - uses: actions/download-artifact@v3
199 with:
200 name: thrift-compiler
201 path: compiler/cpp
202
203 - name: Run thrift-compiler
204 run: |
205 chmod a+x compiler/cpp/thrift
206 compiler/cpp/thrift -version
207
Jiayu Liubcac9782022-05-07 08:35:09 +0800208 - name: Run make for java
Jiayu Liuc77d91a2022-05-03 20:55:50 +0800209 run: make -C lib/java
210
Jiayu Liu5b158382022-05-12 00:20:37 +0800211 # this will invoke publishToMavenLocal and install locally
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800212 - name: Run make install for java
213 run: make -C lib/java install
214
215 - name: Upload java libthrift artifacts
216 uses: actions/upload-artifact@v3
217 with:
218 name: libthrift
219 if-no-files-found: error
220 path: ~/.m2/repository/org/apache/thrift
221
Jiayu Liubcac9782022-05-07 08:35:09 +0800222 - name: Run make check for java
223 run: make -C lib/java check
224
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800225 - name: Run make precross for java
226 run: make -C lib/java precross
227
228 - name: Upload java precross artifacts
229 uses: actions/upload-artifact@v3
230 with:
231 name: java-precross
232 if-no-files-found: error
233 path: |
234 lib/java/build/functionalTestJar/
235 lib/java/build/runclient
236 lib/java/build/runnonblockingserver
237 lib/java/build/runserver
238 lib/java/build/runservletserver
239 retention-days: 3
240
Jiayu Liubcac9782022-05-07 08:35:09 +0800241 - name: Run make for kotlin
Jiayu Liuc77d91a2022-05-03 20:55:50 +0800242 run: make -C lib/kotlin
Jiayu Liubcac9782022-05-07 08:35:09 +0800243
244 - name: Run make check for kotlin
245 run: make -C lib/kotlin check
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800246
247 - name: Run make precross for kotlin
248 run: make -C lib/kotlin precross
249
250 - name: Upload kotlin precross artifacts
251 uses: actions/upload-artifact@v3
252 with:
253 name: kotlin-precross
254 if-no-files-found: error
255 path: |
256 lib/kotlin/cross-test-client/build/install/TestClient/
257 lib/kotlin/cross-test-server/build/install/TestServer/
258 retention-days: 3
259
Kino Roya9da9eb2022-10-07 23:13:01 -0700260 lib-swift:
261 needs: compiler
262 runs-on: ubuntu-20.04
263 steps:
264 - uses: actions/checkout@v3
Jiayu Liud21e95a2022-10-09 08:49:29 +0800265
Kino Roya9da9eb2022-10-07 23:13:01 -0700266 - name: Run bootstrap
267 run: ./bootstrap.sh
268
269 - name: Run configure
270 run: |
271 ./configure \
272 --disable-debug \
273 --disable-tests \
274 --disable-dependency-tracking \
275 --without-cpp \
276 --without-c_glib \
277 --without-java \
278 --without-kotlin \
279 --without-python \
280 --without-py3 \
281 --without-ruby \
282 --without-haxe \
283 --without-netstd \
284 --without-perl \
285 --without-php \
286 --without-php_extension \
287 --without-dart \
288 --without-erlang \
289 --without-go \
290 --without-d \
291 --without-nodejs \
292 --without-nodets \
293 --without-lua \
294 --without-rs \
295 --with-swift
Jiayu Liud21e95a2022-10-09 08:49:29 +0800296
Kino Roya9da9eb2022-10-07 23:13:01 -0700297 - uses: actions/download-artifact@v3
298 with:
299 name: thrift-compiler
300 path: compiler/cpp
301
302 - name: Run thrift-compiler
303 run: |
304 chmod a+x compiler/cpp/thrift
305 compiler/cpp/thrift -version
Jiayu Liud21e95a2022-10-09 08:49:29 +0800306
Kino Roya9da9eb2022-10-07 23:13:01 -0700307 - name: Run make precross for swift
308 run: make -C test/swift precross
309
310 - name: Upload swift precross artifacts
311 uses: actions/upload-artifact@v3
312 with:
313 name: swift-precross
314 if-no-files-found: error
315 path: |
316 test/swift/CrossTests/.build/x86_64-unknown-linux-gnu/debug/TestServer
317 test/swift/CrossTests/.build/x86_64-unknown-linux-gnu/debug/TestClient
318 retention-days: 3
319
Jiayu Liu0aad2ae2022-10-08 13:22:24 +0800320 lib-rust:
321 needs: compiler
322 runs-on: ubuntu-20.04
323 env:
324 TOOLCHAIN_VERSION: 1.61.0
325 steps:
326 - uses: actions/checkout@v3
327
328 - name: Install dependencies
329 run: |
330 sudo apt-get update -yq
331 sudo apt-get install -y --no-install-recommends curl $BUILD_DEPS
332
333 - name: Setup cargo
334 run: |
335 curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
336 rustup update
337 rustup install $TOOLCHAIN_VERSION
338 rustup default $TOOLCHAIN_VERSION
339 rustup --version
340 cargo --version
341 rustc --version
342
343 - name: Run bootstrap
344 run: ./bootstrap.sh
345
346 - name: Run configure
347 run: |
348 ./configure \
349 --disable-debug \
350 --disable-tests \
351 --disable-dependency-tracking \
352 --without-cpp \
353 --without-c_glib \
354 --without-java \
355 --without-kotlin \
356 --without-python \
357 --without-py3 \
358 --without-ruby \
359 --without-haxe \
360 --without-netstd \
361 --without-perl \
362 --without-php \
363 --without-php_extension \
364 --without-dart \
365 --without-erlang \
366 --without-go \
367 --without-d \
368 --without-nodejs \
369 --without-nodets \
370 --without-lua \
371 --with-rs \
372 --without-swift
373
374 - uses: actions/download-artifact@v3
375 with:
376 name: thrift-compiler
377 path: compiler/cpp
378
379 - name: Run thrift-compiler
380 run: |
381 chmod a+x compiler/cpp/thrift
382 compiler/cpp/thrift -version
383
384 - name: Run make for rust
385 run: make -C lib/rs
386
387 - name: Run make check for rust
388 run: make -C lib/rs check
389
390 - name: Run make test for rust
391 run: make -C lib/rs/test check
392
393 - name: Run make precross for test rust
394 run: make -C test/rs precross
395
396 - name: Upload rust precross artifacts
397 uses: actions/upload-artifact@v3
398 with:
399 name: rs-precross
400 if-no-files-found: error
401 path: |
402 test/rs/bin/test_server
403 test/rs/bin/test_client
404 retention-days: 3
405
406 - name: Run make test_recursive for rust
407 run: make -C lib/rs/test_recursive check
408
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800409 cross-test:
410 needs:
411 - lib-java-kotlin
Kino Roya9da9eb2022-10-07 23:13:01 -0700412 - lib-swift
Jiayu Liu0aad2ae2022-10-08 13:22:24 +0800413 - lib-rust
Jiayu Liud21e95a2022-10-09 08:49:29 +0800414 - lib-go
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800415 runs-on: ubuntu-20.04
416 steps:
417 - uses: actions/checkout@v3
Jiayu Liud21e95a2022-10-09 08:49:29 +0800418
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800419 - uses: actions/setup-python@v3
420 with:
421 python-version: "3.x"
Jiayu Liud21e95a2022-10-09 08:49:29 +0800422
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800423 - uses: actions/setup-java@v3
424 with:
425 distribution: temurin
426 # here we intentionally use java 8 so that we also verify java 11 compiles to version 8
427 java-version: 8
428 cache: "gradle"
429
Jiayu Liud21e95a2022-10-09 08:49:29 +0800430 - name: Install openssl and certificates (for SSL tests)
431 run: |
432 sudo apt-get update -yq
433 sudo apt-get install -y --no-install-recommends openssl ca-certificates
434
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800435 - name: Download java precross artifacts
436 uses: actions/download-artifact@v3
437 with:
438 name: java-precross
439 path: lib/java/build
440
441 - name: Download kotlin precross artifacts
442 uses: actions/download-artifact@v3
443 with:
444 name: kotlin-precross
445 path: lib/kotlin
446
Kino Roya9da9eb2022-10-07 23:13:01 -0700447 - name: Download swift precross artifacts
448 uses: actions/download-artifact@v3
449 with:
450 name: swift-precross
451 path: test/swift/CrossTests/.build/x86_64-unknown-linux-gnu/debug
452
Jiayu Liu0aad2ae2022-10-08 13:22:24 +0800453 - name: Download rust precross artifacts
454 uses: actions/download-artifact@v3
455 with:
456 name: rs-precross
457 path: test/rs/bin
458
Jiayu Liud21e95a2022-10-09 08:49:29 +0800459 - name: Download go precross artifacts
460 uses: actions/download-artifact@v3
461 with:
462 name: go-precross
463 path: test/go/bin
464
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800465 - name: Set back executable flags
466 run: |
467 chmod a+x \
468 lib/java/build/run* \
469 lib/kotlin/cross-test-client/build/install/TestClient/bin/* \
Jiayu Liu0aad2ae2022-10-08 13:22:24 +0800470 lib/kotlin/cross-test-server/build/install/TestServer/bin/* \
Kino Roya9da9eb2022-10-07 23:13:01 -0700471 test/swift/CrossTests/.build/x86_64-unknown-linux-gnu/debug/* \
Jiayu Liud21e95a2022-10-09 08:49:29 +0800472 test/rs/bin/* \
473 test/go/bin/*
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800474
475 - name: Run cross test
476 env:
477 THRIFT_CROSSTEST_CONCURRENCY: 4
Jiayu Liud21e95a2022-10-09 08:49:29 +0800478 PRECROSS_LANGS: java,kotlin,go,rs,swift
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800479 run: |
480 python test/test.py \
481 --retry-count 5 \
482 --skip-known-failures \
483 --server $PRECROSS_LANGS \
484 --client $PRECROSS_LANGS
485
486 - name: Upload log files from failed cross test runs
487 uses: actions/upload-artifact@v3
488 if: failure()
489 with:
490 name: cross-test-log
491 path: test/log/
492 retention-days: 3