blob: b3ecd1ecaffc72f32b3fe01792b6c88a5ada569d [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:
Jiayu Liu564b2872022-10-12 11:42:38 +080020 os: [ubuntu-20.04, ubuntu-22.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
Yuxuan 'fishy' Wang19c13b42022-10-12 14:13:15 -070057 strategy:
58 matrix:
59 go:
60 - '1.18'
61 - '1.19'
Jiayu Liud21e95a2022-10-09 08:49:29 +080062 steps:
63 - uses: actions/checkout@v3
64
65 - uses: actions/setup-go@v3
66 with:
Yuxuan 'fishy' Wang19c13b42022-10-12 14:13:15 -070067 go-version: ${{ matrix.go }}
Jiayu Liud21e95a2022-10-09 08:49:29 +080068
69 - name: Install dependencies
70 run: |
71 sudo apt-get update -yq
72 sudo apt-get install -y --no-install-recommends $BUILD_DEPS
73
74 - name: Run bootstrap
75 run: ./bootstrap.sh
76
77 - name: Run configure
78 run: |
79 ./configure \
80 --disable-debug \
81 --disable-tests \
82 --disable-dependency-tracking \
83 --without-cpp \
84 --without-c_glib \
85 --without-java \
86 --without-kotlin \
87 --without-python \
88 --without-py3 \
89 --without-ruby \
90 --without-haxe \
91 --without-netstd \
92 --without-perl \
93 --without-php \
94 --without-php_extension \
95 --without-dart \
96 --without-erlang \
97 --with-go \
98 --without-d \
99 --without-nodejs \
100 --without-nodets \
101 --without-lua \
102 --without-rs \
103 --without-swift
104
105 - uses: actions/download-artifact@v3
106 with:
107 name: thrift-compiler
108 path: compiler/cpp
109
110 - name: Run thrift-compiler
111 run: |
112 chmod a+x compiler/cpp/thrift
113 compiler/cpp/thrift -version
114
115 - name: Run make for go
116 run: make -C lib/go
117
Yuxuan 'fishy' Wang19c13b42022-10-12 14:13:15 -0700118 - name: Run make check for lib/go
Jiayu Liud21e95a2022-10-09 08:49:29 +0800119 run: make -C lib/go check
120
Yuxuan 'fishy' Wang19c13b42022-10-12 14:13:15 -0700121 - name: Run make check for lib/go/test
122 run: make -C lib/go/test check
123
124 - name: Run make check for test/go
125 run: make -C test/go check
126
Jiayu Liud21e95a2022-10-09 08:49:29 +0800127 - name: Run make precross for go test
128 run: make -C test/go precross
129
130 - name: Upload go precross artifacts
Yuxuan 'fishy' Wang19c13b42022-10-12 14:13:15 -0700131 if: matrix.go == '1.19'
Jiayu Liud21e95a2022-10-09 08:49:29 +0800132 uses: actions/upload-artifact@v3
133 with:
134 name: go-precross
135 if-no-files-found: error
136 path: |
137 test/go/bin/*
138 retention-days: 3
139
Jiayu Liuc77d91a2022-05-03 20:55:50 +0800140 lib-java-kotlin:
141 needs: compiler
142 runs-on: ubuntu-20.04
143 env:
Jiayu Liu8a321562022-09-06 08:57:19 +0800144 GRADLE_VERSION: 7.5.1
Jiayu Liuc77d91a2022-05-03 20:55:50 +0800145 steps:
146 - uses: actions/checkout@v3
147
148 - uses: actions/setup-java@v3
149 with:
150 distribution: temurin
Jiayu Liu92b007f2022-10-14 13:16:18 +0800151 java-version: 17
Jiayu Liubcac9782022-05-07 08:35:09 +0800152 cache: "gradle"
Jiayu Liuc77d91a2022-05-03 20:55:50 +0800153
154 - name: Install dependencies
155 run: |
156 sudo apt-get update -yq
157 sudo apt-get install -y --no-install-recommends $BUILD_DEPS
158 sudo apt-get install -y wget unzip ant maven
159
160 - name: Setup gradle
161 run: |
162 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 +0800163 (echo "f6b8596b10cce501591e92f229816aa4046424f3b24d771751b06779d58c8ec4 /tmp/gradle-$GRADLE_VERSION-bin.zip" | sha256sum -c -)
Jiayu Liuc77d91a2022-05-03 20:55:50 +0800164 unzip -d /tmp /tmp/gradle-$GRADLE_VERSION-bin.zip
165 sudo mv /tmp/gradle-$GRADLE_VERSION /usr/local/gradle
166 sudo ln -s /usr/local/gradle/bin/gradle /usr/local/bin
167 gradle --version
168
Jiayu Liubcac9782022-05-07 08:35:09 +0800169 - name: Run spotlessCheck for Java
Jiayu Liu53ec0822022-05-06 12:56:42 +0800170 run: |
171 cd lib/java
172 gradle spotlessCheck
173
Jiayu Liubcac9782022-05-07 08:35:09 +0800174 - name: Run ktfmtCheck for Kotlin
175 run: |
176 cd lib/kotlin
177 gradle ktfmtCheck
178
Jiayu Liuc77d91a2022-05-03 20:55:50 +0800179 - name: Run bootstrap
180 run: ./bootstrap.sh
181
182 - name: Run configure
183 run: |
184 ./configure \
185 --disable-debug \
186 --disable-tests \
187 --disable-dependency-tracking \
188 --without-cpp \
189 --without-c_glib \
190 --with-java \
191 --with-kotlin \
192 --without-python \
193 --without-py3 \
194 --without-ruby \
195 --without-haxe \
196 --without-netstd \
197 --without-perl \
198 --without-php \
199 --without-php_extension \
200 --without-dart \
201 --without-erlang \
202 --without-go \
203 --without-d \
204 --without-nodejs \
205 --without-nodets \
206 --without-lua \
207 --without-rs \
208 --without-swift
209
210 - uses: actions/download-artifact@v3
211 with:
212 name: thrift-compiler
213 path: compiler/cpp
214
215 - name: Run thrift-compiler
216 run: |
217 chmod a+x compiler/cpp/thrift
218 compiler/cpp/thrift -version
219
Jiayu Liubcac9782022-05-07 08:35:09 +0800220 - name: Run make for java
Jiayu Liuc77d91a2022-05-03 20:55:50 +0800221 run: make -C lib/java
222
Jiayu Liu5b158382022-05-12 00:20:37 +0800223 # this will invoke publishToMavenLocal and install locally
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800224 - name: Run make install for java
225 run: make -C lib/java install
226
227 - name: Upload java libthrift artifacts
228 uses: actions/upload-artifact@v3
229 with:
230 name: libthrift
231 if-no-files-found: error
232 path: ~/.m2/repository/org/apache/thrift
233
Jiayu Liubcac9782022-05-07 08:35:09 +0800234 - name: Run make check for java
235 run: make -C lib/java check
236
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800237 - name: Run make precross for java
238 run: make -C lib/java precross
239
240 - name: Upload java precross artifacts
241 uses: actions/upload-artifact@v3
242 with:
243 name: java-precross
244 if-no-files-found: error
245 path: |
246 lib/java/build/functionalTestJar/
247 lib/java/build/runclient
248 lib/java/build/runnonblockingserver
249 lib/java/build/runserver
250 lib/java/build/runservletserver
251 retention-days: 3
252
Jiayu Liubcac9782022-05-07 08:35:09 +0800253 - name: Run make for kotlin
Jiayu Liuc77d91a2022-05-03 20:55:50 +0800254 run: make -C lib/kotlin
Jiayu Liubcac9782022-05-07 08:35:09 +0800255
256 - name: Run make check for kotlin
257 run: make -C lib/kotlin check
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800258
259 - name: Run make precross for kotlin
260 run: make -C lib/kotlin precross
261
262 - name: Upload kotlin precross artifacts
263 uses: actions/upload-artifact@v3
264 with:
265 name: kotlin-precross
266 if-no-files-found: error
267 path: |
268 lib/kotlin/cross-test-client/build/install/TestClient/
269 lib/kotlin/cross-test-server/build/install/TestServer/
270 retention-days: 3
271
Kino Roya9da9eb2022-10-07 23:13:01 -0700272 lib-swift:
273 needs: compiler
274 runs-on: ubuntu-20.04
275 steps:
276 - uses: actions/checkout@v3
Jiayu Liud21e95a2022-10-09 08:49:29 +0800277
Kino Roya9da9eb2022-10-07 23:13:01 -0700278 - name: Run bootstrap
279 run: ./bootstrap.sh
280
281 - name: Run configure
282 run: |
283 ./configure \
284 --disable-debug \
285 --disable-tests \
286 --disable-dependency-tracking \
287 --without-cpp \
288 --without-c_glib \
289 --without-java \
290 --without-kotlin \
291 --without-python \
292 --without-py3 \
293 --without-ruby \
294 --without-haxe \
295 --without-netstd \
296 --without-perl \
297 --without-php \
298 --without-php_extension \
299 --without-dart \
300 --without-erlang \
301 --without-go \
302 --without-d \
303 --without-nodejs \
304 --without-nodets \
305 --without-lua \
306 --without-rs \
307 --with-swift
Jiayu Liud21e95a2022-10-09 08:49:29 +0800308
Kino Roya9da9eb2022-10-07 23:13:01 -0700309 - uses: actions/download-artifact@v3
310 with:
311 name: thrift-compiler
312 path: compiler/cpp
313
314 - name: Run thrift-compiler
315 run: |
316 chmod a+x compiler/cpp/thrift
317 compiler/cpp/thrift -version
Jiayu Liud21e95a2022-10-09 08:49:29 +0800318
Kino Roya9da9eb2022-10-07 23:13:01 -0700319 - name: Run make precross for swift
320 run: make -C test/swift precross
321
322 - name: Upload swift precross artifacts
323 uses: actions/upload-artifact@v3
324 with:
325 name: swift-precross
326 if-no-files-found: error
327 path: |
328 test/swift/CrossTests/.build/x86_64-unknown-linux-gnu/debug/TestServer
329 test/swift/CrossTests/.build/x86_64-unknown-linux-gnu/debug/TestClient
330 retention-days: 3
331
Jiayu Liu0aad2ae2022-10-08 13:22:24 +0800332 lib-rust:
333 needs: compiler
334 runs-on: ubuntu-20.04
335 env:
336 TOOLCHAIN_VERSION: 1.61.0
337 steps:
338 - uses: actions/checkout@v3
339
340 - name: Install dependencies
341 run: |
342 sudo apt-get update -yq
343 sudo apt-get install -y --no-install-recommends curl $BUILD_DEPS
344
345 - name: Setup cargo
346 run: |
347 curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
348 rustup update
349 rustup install $TOOLCHAIN_VERSION
350 rustup default $TOOLCHAIN_VERSION
351 rustup --version
352 cargo --version
353 rustc --version
354
355 - name: Run bootstrap
356 run: ./bootstrap.sh
357
358 - name: Run configure
359 run: |
360 ./configure \
361 --disable-debug \
362 --disable-tests \
363 --disable-dependency-tracking \
364 --without-cpp \
365 --without-c_glib \
366 --without-java \
367 --without-kotlin \
368 --without-python \
369 --without-py3 \
370 --without-ruby \
371 --without-haxe \
372 --without-netstd \
373 --without-perl \
374 --without-php \
375 --without-php_extension \
376 --without-dart \
377 --without-erlang \
378 --without-go \
379 --without-d \
380 --without-nodejs \
381 --without-nodets \
382 --without-lua \
383 --with-rs \
384 --without-swift
385
386 - uses: actions/download-artifact@v3
387 with:
388 name: thrift-compiler
389 path: compiler/cpp
390
391 - name: Run thrift-compiler
392 run: |
393 chmod a+x compiler/cpp/thrift
394 compiler/cpp/thrift -version
395
396 - name: Run make for rust
397 run: make -C lib/rs
398
399 - name: Run make check for rust
400 run: make -C lib/rs check
401
402 - name: Run make test for rust
403 run: make -C lib/rs/test check
404
405 - name: Run make precross for test rust
406 run: make -C test/rs precross
407
408 - name: Upload rust precross artifacts
409 uses: actions/upload-artifact@v3
410 with:
411 name: rs-precross
412 if-no-files-found: error
413 path: |
414 test/rs/bin/test_server
415 test/rs/bin/test_client
416 retention-days: 3
417
418 - name: Run make test_recursive for rust
419 run: make -C lib/rs/test_recursive check
420
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800421 cross-test:
422 needs:
423 - lib-java-kotlin
Kino Roya9da9eb2022-10-07 23:13:01 -0700424 - lib-swift
Jiayu Liu0aad2ae2022-10-08 13:22:24 +0800425 - lib-rust
Jiayu Liud21e95a2022-10-09 08:49:29 +0800426 - lib-go
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800427 runs-on: ubuntu-20.04
428 steps:
429 - uses: actions/checkout@v3
Jiayu Liud21e95a2022-10-09 08:49:29 +0800430
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800431 - uses: actions/setup-python@v3
432 with:
433 python-version: "3.x"
Jiayu Liud21e95a2022-10-09 08:49:29 +0800434
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800435 - uses: actions/setup-java@v3
436 with:
437 distribution: temurin
Jiayu Liu92b007f2022-10-14 13:16:18 +0800438 # here we intentionally use an older version so that we also verify java 17 compiles to it
439 java-version: 11
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800440 cache: "gradle"
441
Jiayu Liud21e95a2022-10-09 08:49:29 +0800442 - name: Install openssl and certificates (for SSL tests)
443 run: |
444 sudo apt-get update -yq
445 sudo apt-get install -y --no-install-recommends openssl ca-certificates
446
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800447 - name: Download java precross artifacts
448 uses: actions/download-artifact@v3
449 with:
450 name: java-precross
451 path: lib/java/build
452
453 - name: Download kotlin precross artifacts
454 uses: actions/download-artifact@v3
455 with:
456 name: kotlin-precross
457 path: lib/kotlin
458
Kino Roya9da9eb2022-10-07 23:13:01 -0700459 - name: Download swift precross artifacts
460 uses: actions/download-artifact@v3
461 with:
462 name: swift-precross
463 path: test/swift/CrossTests/.build/x86_64-unknown-linux-gnu/debug
464
Jiayu Liu0aad2ae2022-10-08 13:22:24 +0800465 - name: Download rust precross artifacts
466 uses: actions/download-artifact@v3
467 with:
468 name: rs-precross
469 path: test/rs/bin
470
Jiayu Liud21e95a2022-10-09 08:49:29 +0800471 - name: Download go precross artifacts
472 uses: actions/download-artifact@v3
473 with:
474 name: go-precross
475 path: test/go/bin
476
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800477 - name: Set back executable flags
478 run: |
479 chmod a+x \
480 lib/java/build/run* \
481 lib/kotlin/cross-test-client/build/install/TestClient/bin/* \
Jiayu Liu0aad2ae2022-10-08 13:22:24 +0800482 lib/kotlin/cross-test-server/build/install/TestServer/bin/* \
Kino Roya9da9eb2022-10-07 23:13:01 -0700483 test/swift/CrossTests/.build/x86_64-unknown-linux-gnu/debug/* \
Jiayu Liud21e95a2022-10-09 08:49:29 +0800484 test/rs/bin/* \
485 test/go/bin/*
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800486
487 - name: Run cross test
488 env:
489 THRIFT_CROSSTEST_CONCURRENCY: 4
Jiayu Liud21e95a2022-10-09 08:49:29 +0800490 PRECROSS_LANGS: java,kotlin,go,rs,swift
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800491 run: |
492 python test/test.py \
493 --retry-count 5 \
494 --skip-known-failures \
495 --server $PRECROSS_LANGS \
496 --client $PRECROSS_LANGS
497
498 - name: Upload log files from failed cross test runs
499 uses: actions/upload-artifact@v3
500 if: failure()
501 with:
502 name: cross-test-log
503 path: test/log/
504 retention-days: 3