blob: 1e93113a6facea042ba47f560ec95751ff821b65 [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 Liu1e3d90d2023-04-14 23:57:33 +080011 CONFIG_ARGS_FOR_LIBS: >
12 --disable-debug
13 --disable-tests
14 --disable-dependency-tracking
15 --without-cpp
16 --without-c_glib
17 --without-java
18 --without-kotlin
19 --without-python
20 --without-py3
21 --without-ruby
22 --without-haxe
23 --without-netstd
24 --without-perl
25 --without-php
26 --without-php_extension
27 --without-dart
28 --without-erlang
29 --without-go
30 --without-d
31 --without-nodejs
32 --without-nodets
33 --without-lua
34 --without-rs
35 --without-swift
Jiayu Liuc77d91a2022-05-03 20:55:50 +080036
Varun Sharmabd1e5db2022-09-14 07:31:30 -070037permissions:
38 contents: read
39
Jiayu Liu6a61c4e2022-04-29 01:25:39 +080040jobs:
41 # TODO windows and macos
Jiayu Liuc77d91a2022-05-03 20:55:50 +080042 compiler:
Jiayu Liu6a61c4e2022-04-29 01:25:39 +080043 strategy:
Jiayu Liuc77d91a2022-05-03 20:55:50 +080044 matrix:
Jiayu Liu564b2872022-10-12 11:42:38 +080045 os: [ubuntu-20.04, ubuntu-22.04]
Jiayu Liu6a61c4e2022-04-29 01:25:39 +080046 runs-on: ${{ matrix.os }}
47 steps:
48 - uses: actions/checkout@v3
49
50 - name: Install dependencies
51 run: |
Jiayu Liu6a61c4e2022-04-29 01:25:39 +080052 sudo apt-get update -yq
Jiayu Liuab83ffc2022-05-10 01:56:30 +080053 sudo apt-get install -y --no-install-recommends g++ $BUILD_DEPS
Jiayu Liu6a61c4e2022-04-29 01:25:39 +080054
55 - name: Run bootstrap
56 run: ./bootstrap.sh
57
58 - name: Run configure
59 run: ./configure --disable-debug --disable-tests --disable-libs
60
61 - name: Run make
62 run: make -j$(nproc)
63
64 - name: Run install
65 run: make install
66
67 - name: Run thrift version
68 run: /usr/local/bin/thrift -version
Jiayu Liuc77d91a2022-05-03 20:55:50 +080069
70 # only upload while building ubuntu-20.04
71 - name: Archive built thrift compiler
72 if: matrix.os == 'ubuntu-20.04'
73 uses: actions/upload-artifact@v3
74 with:
75 name: thrift-compiler
76 path: compiler/cpp/thrift
77 retention-days: 3
78
Jiayu Liud21e95a2022-10-09 08:49:29 +080079 lib-go:
80 needs: compiler
81 runs-on: ubuntu-20.04
Yuxuan 'fishy' Wang19c13b42022-10-12 14:13:15 -070082 strategy:
83 matrix:
84 go:
Yuxuan 'fishy' Wang19c13b42022-10-12 14:13:15 -070085 - '1.19'
Yuxuan 'fishy' Wangb94eac72023-02-02 09:41:31 -080086 - '1.20'
Jiayu Liud21e95a2022-10-09 08:49:29 +080087 steps:
88 - uses: actions/checkout@v3
89
90 - uses: actions/setup-go@v3
91 with:
Yuxuan 'fishy' Wang19c13b42022-10-12 14:13:15 -070092 go-version: ${{ matrix.go }}
Jiayu Liud21e95a2022-10-09 08:49:29 +080093
94 - name: Install dependencies
95 run: |
96 sudo apt-get update -yq
97 sudo apt-get install -y --no-install-recommends $BUILD_DEPS
98
99 - name: Run bootstrap
100 run: ./bootstrap.sh
101
102 - name: Run configure
103 run: |
Jiayu Liu1e3d90d2023-04-14 23:57:33 +0800104 ./configure $(echo $CONFIG_ARGS_FOR_LIBS | sed 's/without-go/with-go/')
Jiayu Liud21e95a2022-10-09 08:49:29 +0800105
106 - uses: actions/download-artifact@v3
107 with:
108 name: thrift-compiler
109 path: compiler/cpp
110
111 - name: Run thrift-compiler
112 run: |
113 chmod a+x compiler/cpp/thrift
114 compiler/cpp/thrift -version
115
116 - name: Run make for go
117 run: make -C lib/go
118
Yuxuan 'fishy' Wang19c13b42022-10-12 14:13:15 -0700119 - name: Run make check for lib/go
Jiayu Liud21e95a2022-10-09 08:49:29 +0800120 run: make -C lib/go check
121
Yuxuan 'fishy' Wang19c13b42022-10-12 14:13:15 -0700122 - name: Run make check for test/go
123 run: make -C test/go check
124
Jiayu Liud21e95a2022-10-09 08:49:29 +0800125 - name: Run make precross for go test
126 run: make -C test/go precross
127
128 - name: Upload go precross artifacts
Yuxuan 'fishy' Wangb94eac72023-02-02 09:41:31 -0800129 if: matrix.go == '1.20'
Jiayu Liud21e95a2022-10-09 08:49:29 +0800130 uses: actions/upload-artifact@v3
131 with:
132 name: go-precross
133 if-no-files-found: error
134 path: |
135 test/go/bin/*
136 retention-days: 3
137
Jiayu Liuc77d91a2022-05-03 20:55:50 +0800138 lib-java-kotlin:
139 needs: compiler
140 runs-on: ubuntu-20.04
141 env:
Jiayu Liube73a572023-04-14 11:02:43 +0800142 GRADLE_VERSION: "8.0.2"
Jiayu Liuc77d91a2022-05-03 20:55:50 +0800143 steps:
144 - uses: actions/checkout@v3
145
146 - uses: actions/setup-java@v3
147 with:
148 distribution: temurin
Jiayu Liu92b007f2022-10-14 13:16:18 +0800149 java-version: 17
Jiayu Liubcac9782022-05-07 08:35:09 +0800150 cache: "gradle"
Jiayu Liuc77d91a2022-05-03 20:55:50 +0800151
152 - name: Install dependencies
153 run: |
154 sudo apt-get update -yq
155 sudo apt-get install -y --no-install-recommends $BUILD_DEPS
156 sudo apt-get install -y wget unzip ant maven
157
158 - name: Setup gradle
159 run: |
160 wget https://services.gradle.org/distributions/gradle-$GRADLE_VERSION-bin.zip -q -O /tmp/gradle-$GRADLE_VERSION-bin.zip
Jiayu Liube73a572023-04-14 11:02:43 +0800161 (echo "ff7bf6a86f09b9b2c40bb8f48b25fc19cf2b2664fd1d220cd7ab833ec758d0d7 /tmp/gradle-$GRADLE_VERSION-bin.zip" | sha256sum -c -)
Jiayu Liuc77d91a2022-05-03 20:55:50 +0800162 unzip -d /tmp /tmp/gradle-$GRADLE_VERSION-bin.zip
163 sudo mv /tmp/gradle-$GRADLE_VERSION /usr/local/gradle
164 sudo ln -s /usr/local/gradle/bin/gradle /usr/local/bin
165 gradle --version
166
Jiayu Liubcac9782022-05-07 08:35:09 +0800167 - name: Run spotlessCheck for Java
Jiayu Liu53ec0822022-05-06 12:56:42 +0800168 run: |
169 cd lib/java
170 gradle spotlessCheck
171
Jiayu Liubcac9782022-05-07 08:35:09 +0800172 - name: Run ktfmtCheck for Kotlin
173 run: |
174 cd lib/kotlin
175 gradle ktfmtCheck
176
Jiayu Liuc77d91a2022-05-03 20:55:50 +0800177 - name: Run bootstrap
178 run: ./bootstrap.sh
179
180 - name: Run configure
181 run: |
Jiayu Liu1e3d90d2023-04-14 23:57:33 +0800182 ./configure $(echo $CONFIG_ARGS_FOR_LIBS | sed 's/without-java/with-java/' | sed 's/without-kotlin/with-kotlin/')
Jiayu Liuc77d91a2022-05-03 20:55:50 +0800183
184 - uses: actions/download-artifact@v3
185 with:
186 name: thrift-compiler
187 path: compiler/cpp
188
189 - name: Run thrift-compiler
190 run: |
191 chmod a+x compiler/cpp/thrift
192 compiler/cpp/thrift -version
193
Jiayu Liubcac9782022-05-07 08:35:09 +0800194 - name: Run make for java
Jiayu Liuc77d91a2022-05-03 20:55:50 +0800195 run: make -C lib/java
196
Jiayu Liu5b158382022-05-12 00:20:37 +0800197 # this will invoke publishToMavenLocal and install locally
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800198 - name: Run make install for java
199 run: make -C lib/java install
200
201 - name: Upload java libthrift artifacts
202 uses: actions/upload-artifact@v3
203 with:
204 name: libthrift
205 if-no-files-found: error
206 path: ~/.m2/repository/org/apache/thrift
207
Jiayu Liubcac9782022-05-07 08:35:09 +0800208 - name: Run make check for java
209 run: make -C lib/java check
210
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800211 - name: Run make precross for java
212 run: make -C lib/java precross
213
214 - name: Upload java precross artifacts
215 uses: actions/upload-artifact@v3
216 with:
217 name: java-precross
218 if-no-files-found: error
219 path: |
220 lib/java/build/functionalTestJar/
221 lib/java/build/runclient
222 lib/java/build/runnonblockingserver
223 lib/java/build/runserver
224 lib/java/build/runservletserver
225 retention-days: 3
226
Jiayu Liubcac9782022-05-07 08:35:09 +0800227 - name: Run make for kotlin
Jiayu Liuc77d91a2022-05-03 20:55:50 +0800228 run: make -C lib/kotlin
Jiayu Liubcac9782022-05-07 08:35:09 +0800229
230 - name: Run make check for kotlin
231 run: make -C lib/kotlin check
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800232
233 - name: Run make precross for kotlin
234 run: make -C lib/kotlin precross
235
236 - name: Upload kotlin precross artifacts
237 uses: actions/upload-artifact@v3
238 with:
239 name: kotlin-precross
240 if-no-files-found: error
241 path: |
242 lib/kotlin/cross-test-client/build/install/TestClient/
243 lib/kotlin/cross-test-server/build/install/TestServer/
244 retention-days: 3
245
Kino Roya9da9eb2022-10-07 23:13:01 -0700246 lib-swift:
247 needs: compiler
248 runs-on: ubuntu-20.04
249 steps:
250 - uses: actions/checkout@v3
Jiayu Liud21e95a2022-10-09 08:49:29 +0800251
Kino Roya9da9eb2022-10-07 23:13:01 -0700252 - name: Run bootstrap
253 run: ./bootstrap.sh
254
255 - name: Run configure
256 run: |
Jiayu Liu1e3d90d2023-04-14 23:57:33 +0800257 ./configure $(echo $CONFIG_ARGS_FOR_LIBS | sed 's/without-swift/with-swift/')
Jiayu Liud21e95a2022-10-09 08:49:29 +0800258
Kino Roya9da9eb2022-10-07 23:13:01 -0700259 - uses: actions/download-artifact@v3
260 with:
261 name: thrift-compiler
262 path: compiler/cpp
263
264 - name: Run thrift-compiler
265 run: |
266 chmod a+x compiler/cpp/thrift
267 compiler/cpp/thrift -version
Jiayu Liud21e95a2022-10-09 08:49:29 +0800268
Kino Roya9da9eb2022-10-07 23:13:01 -0700269 - name: Run make precross for swift
270 run: make -C test/swift precross
271
272 - name: Upload swift precross artifacts
273 uses: actions/upload-artifact@v3
274 with:
275 name: swift-precross
276 if-no-files-found: error
277 path: |
278 test/swift/CrossTests/.build/x86_64-unknown-linux-gnu/debug/TestServer
279 test/swift/CrossTests/.build/x86_64-unknown-linux-gnu/debug/TestClient
280 retention-days: 3
281
Jiayu Liu0aad2ae2022-10-08 13:22:24 +0800282 lib-rust:
283 needs: compiler
284 runs-on: ubuntu-20.04
285 env:
286 TOOLCHAIN_VERSION: 1.61.0
287 steps:
288 - uses: actions/checkout@v3
289
290 - name: Install dependencies
291 run: |
292 sudo apt-get update -yq
293 sudo apt-get install -y --no-install-recommends curl $BUILD_DEPS
294
295 - name: Setup cargo
296 run: |
297 curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
298 rustup update
299 rustup install $TOOLCHAIN_VERSION
300 rustup default $TOOLCHAIN_VERSION
301 rustup --version
302 cargo --version
303 rustc --version
304
305 - name: Run bootstrap
306 run: ./bootstrap.sh
307
308 - name: Run configure
309 run: |
Jiayu Liu1e3d90d2023-04-14 23:57:33 +0800310 ./configure $(echo $CONFIG_ARGS_FOR_LIBS | sed 's/without-rs/with-rs/')
Jiayu Liu0aad2ae2022-10-08 13:22:24 +0800311
312 - uses: actions/download-artifact@v3
313 with:
314 name: thrift-compiler
315 path: compiler/cpp
316
317 - name: Run thrift-compiler
318 run: |
319 chmod a+x compiler/cpp/thrift
320 compiler/cpp/thrift -version
321
322 - name: Run make for rust
323 run: make -C lib/rs
324
325 - name: Run make check for rust
326 run: make -C lib/rs check
327
328 - name: Run make test for rust
329 run: make -C lib/rs/test check
330
331 - name: Run make precross for test rust
332 run: make -C test/rs precross
333
334 - name: Upload rust precross artifacts
335 uses: actions/upload-artifact@v3
336 with:
337 name: rs-precross
338 if-no-files-found: error
339 path: |
340 test/rs/bin/test_server
341 test/rs/bin/test_client
342 retention-days: 3
343
344 - name: Run make test_recursive for rust
345 run: make -C lib/rs/test_recursive check
346
Jiayu Liu6f339002023-04-20 07:39:35 +0800347 lib-python:
348 needs: compiler
349 runs-on: ubuntu-20.04
350 strategy:
351 matrix:
352 python-version: ["2.x", "3.x"]
353 steps:
354 - uses: actions/checkout@v3
355
356 - name: Install dependencies
357 run: |
358 sudo apt-get update -yq
359 sudo apt-get install -y --no-install-recommends $BUILD_DEPS
360 sudo apt-get install -y --no-install-recommends curl openssl ca-certificates
361
362 - name: Set up Python
363 uses: actions/setup-python@v3
364 with:
365 python-version: ${{ matrix.python-version }}
366
367 - name: Python setup
368 run: |
369 python -m pip install --upgrade pip setuptools wheel flake8 tornado twisted zope.interface
370 python --version
371 pip --version
372
373 - name: Python 2.x backport setup
374 if: matrix.python-version == '2.x'
375 run: |
376 python -m pip install --upgrade ipaddress backports.ssl_match_hostname
377
378 - name: Run bootstrap
379 run: ./bootstrap.sh
380
381 - name: Run configure 2.x
382 if: matrix.python-version == '2.x'
383 run: |
384 ./configure $(echo $CONFIG_ARGS_FOR_LIBS | sed 's/without-python/with-python/')
385
386 - name: Run configure 3.x
387 if: matrix.python-version != '2.x'
388 run: |
389 ./configure $(echo $CONFIG_ARGS_FOR_LIBS | sed 's/without-py3/with-py3/')
390
391 - uses: actions/download-artifact@v3
392 with:
393 name: thrift-compiler
394 path: compiler/cpp
395
396 - name: Run thrift-compiler
397 run: |
398 chmod a+x compiler/cpp/thrift
399 compiler/cpp/thrift -version
400
401 - name: Run make for python
402 run: make -C lib/py
403
404 - name: Run make install for python
405 run: sudo make -C lib/py install
406
407 # - name: Run make install-exec-hook for python
408 # run: sudo make -C lib/py install-exec-hook
409
410 - name: Run make check for python
411 run: make -C lib/py check
412
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800413 cross-test:
414 needs:
415 - lib-java-kotlin
Kino Roya9da9eb2022-10-07 23:13:01 -0700416 - lib-swift
Jiayu Liu0aad2ae2022-10-08 13:22:24 +0800417 - lib-rust
Jiayu Liud21e95a2022-10-09 08:49:29 +0800418 - lib-go
Jiayu Liu6f339002023-04-20 07:39:35 +0800419 - lib-python
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800420 runs-on: ubuntu-20.04
421 steps:
422 - uses: actions/checkout@v3
Jiayu Liud21e95a2022-10-09 08:49:29 +0800423
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800424 - uses: actions/setup-python@v3
425 with:
426 python-version: "3.x"
Jiayu Liud21e95a2022-10-09 08:49:29 +0800427
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800428 - uses: actions/setup-java@v3
429 with:
430 distribution: temurin
Jiayu Liube73a572023-04-14 11:02:43 +0800431 # here we intentionally use an older version so that we also verify Java 17 compiles to it
Jiayu Liu92b007f2022-10-14 13:16:18 +0800432 java-version: 11
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800433 cache: "gradle"
434
Jiayu Liud21e95a2022-10-09 08:49:29 +0800435 - name: Install openssl and certificates (for SSL tests)
436 run: |
437 sudo apt-get update -yq
438 sudo apt-get install -y --no-install-recommends openssl ca-certificates
439
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800440 - name: Download java precross artifacts
441 uses: actions/download-artifact@v3
442 with:
443 name: java-precross
444 path: lib/java/build
445
446 - name: Download kotlin precross artifacts
447 uses: actions/download-artifact@v3
448 with:
449 name: kotlin-precross
450 path: lib/kotlin
451
Kino Roya9da9eb2022-10-07 23:13:01 -0700452 - name: Download swift precross artifacts
453 uses: actions/download-artifact@v3
454 with:
455 name: swift-precross
456 path: test/swift/CrossTests/.build/x86_64-unknown-linux-gnu/debug
457
Jiayu Liu0aad2ae2022-10-08 13:22:24 +0800458 - name: Download rust precross artifacts
459 uses: actions/download-artifact@v3
460 with:
461 name: rs-precross
462 path: test/rs/bin
463
Jiayu Liud21e95a2022-10-09 08:49:29 +0800464 - name: Download go precross artifacts
465 uses: actions/download-artifact@v3
466 with:
467 name: go-precross
468 path: test/go/bin
469
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800470 - name: Set back executable flags
471 run: |
472 chmod a+x \
473 lib/java/build/run* \
474 lib/kotlin/cross-test-client/build/install/TestClient/bin/* \
Jiayu Liu0aad2ae2022-10-08 13:22:24 +0800475 lib/kotlin/cross-test-server/build/install/TestServer/bin/* \
Kino Roya9da9eb2022-10-07 23:13:01 -0700476 test/swift/CrossTests/.build/x86_64-unknown-linux-gnu/debug/* \
Jiayu Liud21e95a2022-10-09 08:49:29 +0800477 test/rs/bin/* \
478 test/go/bin/*
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800479
480 - name: Run cross test
481 env:
482 THRIFT_CROSSTEST_CONCURRENCY: 4
Jiayu Liud21e95a2022-10-09 08:49:29 +0800483 PRECROSS_LANGS: java,kotlin,go,rs,swift
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800484 run: |
485 python test/test.py \
486 --retry-count 5 \
487 --skip-known-failures \
488 --server $PRECROSS_LANGS \
489 --client $PRECROSS_LANGS
490
491 - name: Upload log files from failed cross test runs
492 uses: actions/upload-artifact@v3
493 if: failure()
494 with:
495 name: cross-test-log
496 path: test/log/
497 retention-days: 3
Jiayu Liu6f339002023-04-20 07:39:35 +0800498