blob: 958a308dab1157a3d1baa54e4df24a22ce2452f0 [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]
Yuxuan 'fishy' Wange4970302023-06-27 09:47:58 -070046 fail-fast: false
Jiayu Liu6a61c4e2022-04-29 01:25:39 +080047 runs-on: ${{ matrix.os }}
48 steps:
dependabot[bot]a14231c2023-10-04 18:33:29 -040049 - uses: actions/checkout@v4
Jiayu Liu6a61c4e2022-04-29 01:25:39 +080050
51 - name: Install dependencies
52 run: |
Jiayu Liu6a61c4e2022-04-29 01:25:39 +080053 sudo apt-get update -yq
Jiayu Liuab83ffc2022-05-10 01:56:30 +080054 sudo apt-get install -y --no-install-recommends g++ $BUILD_DEPS
Jiayu Liu6a61c4e2022-04-29 01:25:39 +080055
56 - name: Run bootstrap
57 run: ./bootstrap.sh
58
59 - name: Run configure
60 run: ./configure --disable-debug --disable-tests --disable-libs
61
62 - name: Run make
63 run: make -j$(nproc)
64
65 - name: Run install
66 run: make install
67
68 - name: Run thrift version
69 run: /usr/local/bin/thrift -version
Jiayu Liuc77d91a2022-05-03 20:55:50 +080070
71 # only upload while building ubuntu-20.04
72 - name: Archive built thrift compiler
73 if: matrix.os == 'ubuntu-20.04'
74 uses: actions/upload-artifact@v3
75 with:
76 name: thrift-compiler
77 path: compiler/cpp/thrift
78 retention-days: 3
79
Jiayu Liud21e95a2022-10-09 08:49:29 +080080 lib-go:
81 needs: compiler
82 runs-on: ubuntu-20.04
Yuxuan 'fishy' Wang19c13b42022-10-12 14:13:15 -070083 strategy:
84 matrix:
85 go:
Yuxuan 'fishy' Wangb94eac72023-02-02 09:41:31 -080086 - '1.20'
Yuxuan 'fishy' Wangdc733fa2023-06-23 09:29:25 -070087 - '1.21'
Yuxuan 'fishy' Wange4970302023-06-27 09:47:58 -070088 fail-fast: false
Jiayu Liud21e95a2022-10-09 08:49:29 +080089 steps:
dependabot[bot]a14231c2023-10-04 18:33:29 -040090 - uses: actions/checkout@v4
Jiayu Liud21e95a2022-10-09 08:49:29 +080091
dependabot[bot]ccfb91e2023-04-27 08:46:40 +080092 - uses: actions/setup-go@v4
Jiayu Liud21e95a2022-10-09 08:49:29 +080093 with:
Yuxuan 'fishy' Wang19c13b42022-10-12 14:13:15 -070094 go-version: ${{ matrix.go }}
Jiayu Liud21e95a2022-10-09 08:49:29 +080095
96 - name: Install dependencies
97 run: |
98 sudo apt-get update -yq
99 sudo apt-get install -y --no-install-recommends $BUILD_DEPS
100
101 - name: Run bootstrap
102 run: ./bootstrap.sh
103
104 - name: Run configure
105 run: |
Jiayu Liu1e3d90d2023-04-14 23:57:33 +0800106 ./configure $(echo $CONFIG_ARGS_FOR_LIBS | sed 's/without-go/with-go/')
Jiayu Liud21e95a2022-10-09 08:49:29 +0800107
108 - uses: actions/download-artifact@v3
109 with:
110 name: thrift-compiler
111 path: compiler/cpp
112
113 - name: Run thrift-compiler
114 run: |
115 chmod a+x compiler/cpp/thrift
116 compiler/cpp/thrift -version
117
118 - name: Run make for go
119 run: make -C lib/go
120
Yuxuan 'fishy' Wang19c13b42022-10-12 14:13:15 -0700121 - name: Run make check for lib/go
Jiayu Liud21e95a2022-10-09 08:49:29 +0800122 run: make -C lib/go check
123
Yuxuan 'fishy' Wang19c13b42022-10-12 14:13:15 -0700124 - 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' Wangdc733fa2023-06-23 09:29:25 -0700131 if: matrix.go == '1.21'
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 Liube73a572023-04-14 11:02:43 +0800144 GRADLE_VERSION: "8.0.2"
Jiayu Liuc77d91a2022-05-03 20:55:50 +0800145 steps:
dependabot[bot]a14231c2023-10-04 18:33:29 -0400146 - uses: actions/checkout@v4
Jiayu Liuc77d91a2022-05-03 20:55:50 +0800147
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 Liube73a572023-04-14 11:02:43 +0800163 (echo "ff7bf6a86f09b9b2c40bb8f48b25fc19cf2b2664fd1d220cd7ab833ec758d0d7 /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: |
Jiayu Liu1e3d90d2023-04-14 23:57:33 +0800184 ./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 +0800185
186 - uses: actions/download-artifact@v3
187 with:
188 name: thrift-compiler
189 path: compiler/cpp
190
191 - name: Run thrift-compiler
192 run: |
193 chmod a+x compiler/cpp/thrift
194 compiler/cpp/thrift -version
195
Jiayu Liubcac9782022-05-07 08:35:09 +0800196 - name: Run make for java
Jiayu Liuc77d91a2022-05-03 20:55:50 +0800197 run: make -C lib/java
198
Jiayu Liu5b158382022-05-12 00:20:37 +0800199 # this will invoke publishToMavenLocal and install locally
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800200 - name: Run make install for java
201 run: make -C lib/java install
202
203 - name: Upload java libthrift artifacts
204 uses: actions/upload-artifact@v3
205 with:
206 name: libthrift
207 if-no-files-found: error
208 path: ~/.m2/repository/org/apache/thrift
209
Jiayu Liubcac9782022-05-07 08:35:09 +0800210 - name: Run make check for java
211 run: make -C lib/java check
212
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800213 - name: Run make precross for java
214 run: make -C lib/java precross
215
216 - name: Upload java precross artifacts
217 uses: actions/upload-artifact@v3
218 with:
219 name: java-precross
220 if-no-files-found: error
221 path: |
222 lib/java/build/functionalTestJar/
223 lib/java/build/runclient
224 lib/java/build/runnonblockingserver
225 lib/java/build/runserver
226 lib/java/build/runservletserver
227 retention-days: 3
228
Jiayu Liubcac9782022-05-07 08:35:09 +0800229 - name: Run make for kotlin
Jiayu Liuc77d91a2022-05-03 20:55:50 +0800230 run: make -C lib/kotlin
Jiayu Liubcac9782022-05-07 08:35:09 +0800231
232 - name: Run make check for kotlin
233 run: make -C lib/kotlin check
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800234
235 - name: Run make precross for kotlin
236 run: make -C lib/kotlin precross
237
238 - name: Upload kotlin precross artifacts
239 uses: actions/upload-artifact@v3
240 with:
241 name: kotlin-precross
242 if-no-files-found: error
243 path: |
244 lib/kotlin/cross-test-client/build/install/TestClient/
245 lib/kotlin/cross-test-server/build/install/TestServer/
246 retention-days: 3
247
Kino Roya9da9eb2022-10-07 23:13:01 -0700248 lib-swift:
249 needs: compiler
250 runs-on: ubuntu-20.04
251 steps:
dependabot[bot]a14231c2023-10-04 18:33:29 -0400252 - uses: actions/checkout@v4
Jiayu Liud21e95a2022-10-09 08:49:29 +0800253
Kino Roya9da9eb2022-10-07 23:13:01 -0700254 - name: Run bootstrap
255 run: ./bootstrap.sh
256
257 - name: Run configure
258 run: |
Jiayu Liu1e3d90d2023-04-14 23:57:33 +0800259 ./configure $(echo $CONFIG_ARGS_FOR_LIBS | sed 's/without-swift/with-swift/')
Jiayu Liud21e95a2022-10-09 08:49:29 +0800260
Kino Roya9da9eb2022-10-07 23:13:01 -0700261 - uses: actions/download-artifact@v3
262 with:
263 name: thrift-compiler
264 path: compiler/cpp
265
266 - name: Run thrift-compiler
267 run: |
268 chmod a+x compiler/cpp/thrift
269 compiler/cpp/thrift -version
Jiayu Liud21e95a2022-10-09 08:49:29 +0800270
Kino Roya9da9eb2022-10-07 23:13:01 -0700271 - name: Run make precross for swift
272 run: make -C test/swift precross
273
274 - name: Upload swift precross artifacts
275 uses: actions/upload-artifact@v3
276 with:
277 name: swift-precross
278 if-no-files-found: error
279 path: |
280 test/swift/CrossTests/.build/x86_64-unknown-linux-gnu/debug/TestServer
281 test/swift/CrossTests/.build/x86_64-unknown-linux-gnu/debug/TestClient
282 retention-days: 3
283
Jiayu Liu0aad2ae2022-10-08 13:22:24 +0800284 lib-rust:
285 needs: compiler
286 runs-on: ubuntu-20.04
287 env:
288 TOOLCHAIN_VERSION: 1.61.0
289 steps:
dependabot[bot]a14231c2023-10-04 18:33:29 -0400290 - uses: actions/checkout@v4
Jiayu Liu0aad2ae2022-10-08 13:22:24 +0800291
292 - name: Install dependencies
293 run: |
294 sudo apt-get update -yq
295 sudo apt-get install -y --no-install-recommends curl $BUILD_DEPS
296
297 - name: Setup cargo
298 run: |
299 curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
300 rustup update
301 rustup install $TOOLCHAIN_VERSION
302 rustup default $TOOLCHAIN_VERSION
303 rustup --version
304 cargo --version
305 rustc --version
306
307 - name: Run bootstrap
308 run: ./bootstrap.sh
309
310 - name: Run configure
311 run: |
Jiayu Liu1e3d90d2023-04-14 23:57:33 +0800312 ./configure $(echo $CONFIG_ARGS_FOR_LIBS | sed 's/without-rs/with-rs/')
Jiayu Liu0aad2ae2022-10-08 13:22:24 +0800313
314 - uses: actions/download-artifact@v3
315 with:
316 name: thrift-compiler
317 path: compiler/cpp
318
319 - name: Run thrift-compiler
320 run: |
321 chmod a+x compiler/cpp/thrift
322 compiler/cpp/thrift -version
323
324 - name: Run make for rust
325 run: make -C lib/rs
326
327 - name: Run make check for rust
328 run: make -C lib/rs check
329
330 - name: Run make test for rust
331 run: make -C lib/rs/test check
332
333 - name: Run make precross for test rust
334 run: make -C test/rs precross
335
336 - name: Upload rust precross artifacts
337 uses: actions/upload-artifact@v3
338 with:
339 name: rs-precross
340 if-no-files-found: error
341 path: |
342 test/rs/bin/test_server
343 test/rs/bin/test_client
344 retention-days: 3
345
346 - name: Run make test_recursive for rust
347 run: make -C lib/rs/test_recursive check
348
Jiayu Liu6f339002023-04-20 07:39:35 +0800349 lib-python:
350 needs: compiler
351 runs-on: ubuntu-20.04
352 strategy:
353 matrix:
Yuxuan 'fishy' Wange4970302023-06-27 09:47:58 -0700354 python-version:
355 - "3.x"
356 fail-fast: false
Jiayu Liu6f339002023-04-20 07:39:35 +0800357 steps:
dependabot[bot]a14231c2023-10-04 18:33:29 -0400358 - uses: actions/checkout@v4
Jiayu Liu6f339002023-04-20 07:39:35 +0800359
360 - name: Install dependencies
361 run: |
362 sudo apt-get update -yq
363 sudo apt-get install -y --no-install-recommends $BUILD_DEPS
364 sudo apt-get install -y --no-install-recommends curl openssl ca-certificates
365
366 - name: Set up Python
dependabot[bot]9141c0c2023-04-27 08:45:46 +0800367 uses: actions/setup-python@v4
Jiayu Liu6f339002023-04-20 07:39:35 +0800368 with:
369 python-version: ${{ matrix.python-version }}
370
371 - name: Python setup
372 run: |
373 python -m pip install --upgrade pip setuptools wheel flake8 tornado twisted zope.interface
374 python --version
375 pip --version
376
Jiayu Liu6f339002023-04-20 07:39:35 +0800377 - name: Run bootstrap
378 run: ./bootstrap.sh
379
Jiayu Liu6f339002023-04-20 07:39:35 +0800380 - name: Run configure 3.x
Yuxuan 'fishy' Wange4970302023-06-27 09:47:58 -0700381 if: matrix.python-version == '3.x'
Jiayu Liu6f339002023-04-20 07:39:35 +0800382 run: |
383 ./configure $(echo $CONFIG_ARGS_FOR_LIBS | sed 's/without-py3/with-py3/')
384
385 - uses: actions/download-artifact@v3
386 with:
387 name: thrift-compiler
388 path: compiler/cpp
389
390 - name: Run thrift-compiler
391 run: |
392 chmod a+x compiler/cpp/thrift
393 compiler/cpp/thrift -version
394
395 - name: Run make for python
396 run: make -C lib/py
397
398 - name: Run make install for python
399 run: sudo make -C lib/py install
400
401 # - name: Run make install-exec-hook for python
402 # run: sudo make -C lib/py install-exec-hook
403
404 - name: Run make check for python
405 run: make -C lib/py check
406
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800407 cross-test:
408 needs:
409 - lib-java-kotlin
Kino Roya9da9eb2022-10-07 23:13:01 -0700410 - lib-swift
Jiayu Liu0aad2ae2022-10-08 13:22:24 +0800411 - lib-rust
Jiayu Liud21e95a2022-10-09 08:49:29 +0800412 - lib-go
Jiayu Liu6f339002023-04-20 07:39:35 +0800413 - lib-python
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800414 runs-on: ubuntu-20.04
Jiayu Liu790d4cb2023-04-27 11:35:17 +0800415 strategy:
416 matrix:
417 server_lang: ['java', 'kotlin', 'go', 'rs', 'swift']
418 # we always use comma join as many client langs as possible, to reduce the number of jobs
419 client_lang: ['java,kotlin', 'go,rs', 'swift']
420 fail-fast: false
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800421 steps:
dependabot[bot]a14231c2023-10-04 18:33:29 -0400422 - uses: actions/checkout@v4
Jiayu Liud21e95a2022-10-09 08:49:29 +0800423
dependabot[bot]9141c0c2023-04-27 08:45:46 +0800424 - uses: actions/setup-python@v4
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800425 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
Fokko Driesprong0b14a1b2023-04-14 11:06:15 +0200432 java-version: 8
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 Liuab83ffc2022-05-10 01:56:30 +0800483 run: |
484 python test/test.py \
485 --retry-count 5 \
486 --skip-known-failures \
Jiayu Liu790d4cb2023-04-27 11:35:17 +0800487 --server ${{ matrix.server_lang }} \
488 --client ${{ matrix.client_lang }}
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800489
490 - name: Upload log files from failed cross test runs
491 uses: actions/upload-artifact@v3
492 if: failure()
493 with:
494 name: cross-test-log
495 path: test/log/
496 retention-days: 3
Jiayu Liu6f339002023-04-20 07:39:35 +0800497