blob: 0b35d30887cef8846382d187afc2ff20a1500d92 [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
Jiayu Liu1e3d90d2023-04-14 23:57:33 +080013 --disable-dependency-tracking
14 --without-cpp
15 --without-c_glib
16 --without-java
17 --without-kotlin
18 --without-python
19 --without-py3
20 --without-ruby
21 --without-haxe
22 --without-netstd
23 --without-perl
24 --without-php
25 --without-php_extension
26 --without-dart
27 --without-erlang
28 --without-go
29 --without-d
30 --without-nodejs
31 --without-nodets
32 --without-lua
33 --without-rs
34 --without-swift
Jiayu Liuc77d91a2022-05-03 20:55:50 +080035
Varun Sharmabd1e5db2022-09-14 07:31:30 -070036permissions:
37 contents: read
38
Jiayu Liu6a61c4e2022-04-29 01:25:39 +080039jobs:
40 # TODO windows and macos
Jiayu Liuc77d91a2022-05-03 20:55:50 +080041 compiler:
Jiayu Liu6a61c4e2022-04-29 01:25:39 +080042 strategy:
Jiayu Liuc77d91a2022-05-03 20:55:50 +080043 matrix:
Jiayu Liu564b2872022-10-12 11:42:38 +080044 os: [ubuntu-20.04, ubuntu-22.04]
Yuxuan 'fishy' Wange4970302023-06-27 09:47:58 -070045 fail-fast: false
Jiayu Liu6a61c4e2022-04-29 01:25:39 +080046 runs-on: ${{ matrix.os }}
47 steps:
dependabot[bot]a14231c2023-10-04 18:33:29 -040048 - uses: actions/checkout@v4
Jiayu Liu6a61c4e2022-04-29 01:25:39 +080049
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' Wangb94eac72023-02-02 09:41:31 -080085 - '1.20'
Yuxuan 'fishy' Wangdc733fa2023-06-23 09:29:25 -070086 - '1.21'
Yuxuan 'fishy' Wange4970302023-06-27 09:47:58 -070087 fail-fast: false
Jiayu Liud21e95a2022-10-09 08:49:29 +080088 steps:
dependabot[bot]a14231c2023-10-04 18:33:29 -040089 - uses: actions/checkout@v4
Jiayu Liud21e95a2022-10-09 08:49:29 +080090
dependabot[bot]ccfb91e2023-04-27 08:46:40 +080091 - uses: actions/setup-go@v4
Jiayu Liud21e95a2022-10-09 08:49:29 +080092 with:
Yuxuan 'fishy' Wang19c13b42022-10-12 14:13:15 -070093 go-version: ${{ matrix.go }}
Jiayu Liud21e95a2022-10-09 08:49:29 +080094
95 - name: Install dependencies
96 run: |
97 sudo apt-get update -yq
98 sudo apt-get install -y --no-install-recommends $BUILD_DEPS
99
100 - name: Run bootstrap
101 run: ./bootstrap.sh
102
103 - name: Run configure
104 run: |
Jiayu Liu1e3d90d2023-04-14 23:57:33 +0800105 ./configure $(echo $CONFIG_ARGS_FOR_LIBS | sed 's/without-go/with-go/')
Jiayu Liud21e95a2022-10-09 08:49:29 +0800106
107 - uses: actions/download-artifact@v3
108 with:
109 name: thrift-compiler
110 path: compiler/cpp
111
112 - name: Run thrift-compiler
113 run: |
114 chmod a+x compiler/cpp/thrift
115 compiler/cpp/thrift -version
116
117 - name: Run make for go
118 run: make -C lib/go
119
Yuxuan 'fishy' Wang19c13b42022-10-12 14:13:15 -0700120 - name: Run make check for lib/go
Jiayu Liud21e95a2022-10-09 08:49:29 +0800121 run: make -C lib/go check
122
Yuxuan 'fishy' Wang19c13b42022-10-12 14:13:15 -0700123 - name: Run make check for test/go
124 run: make -C test/go check
125
Jiayu Liud21e95a2022-10-09 08:49:29 +0800126 - name: Run make precross for go test
127 run: make -C test/go precross
128
129 - name: Upload go precross artifacts
Yuxuan 'fishy' Wangdc733fa2023-06-23 09:29:25 -0700130 if: matrix.go == '1.21'
Jiayu Liud21e95a2022-10-09 08:49:29 +0800131 uses: actions/upload-artifact@v3
132 with:
133 name: go-precross
134 if-no-files-found: error
135 path: |
136 test/go/bin/*
137 retention-days: 3
138
Jiayu Liuc77d91a2022-05-03 20:55:50 +0800139 lib-java-kotlin:
140 needs: compiler
141 runs-on: ubuntu-20.04
142 env:
Jiayu Liud40dd722023-10-19 08:37:49 +0800143 GRADLE_VERSION: "8.4"
Jiayu Liuc77d91a2022-05-03 20:55:50 +0800144 steps:
dependabot[bot]a14231c2023-10-04 18:33:29 -0400145 - uses: actions/checkout@v4
Jiayu Liuc77d91a2022-05-03 20:55:50 +0800146
dependabot[bot]f4b6d962023-12-01 06:30:44 +0000147 - uses: actions/setup-java@v4
Jiayu Liuc77d91a2022-05-03 20:55:50 +0800148 with:
149 distribution: temurin
Jiayu Liu92b007f2022-10-14 13:16:18 +0800150 java-version: 17
Jiayu Liubcac9782022-05-07 08:35:09 +0800151 cache: "gradle"
Jiayu Liuc77d91a2022-05-03 20:55:50 +0800152
153 - name: Install dependencies
154 run: |
155 sudo apt-get update -yq
156 sudo apt-get install -y --no-install-recommends $BUILD_DEPS
157 sudo apt-get install -y wget unzip ant maven
158
159 - name: Setup gradle
160 run: |
161 wget https://services.gradle.org/distributions/gradle-$GRADLE_VERSION-bin.zip -q -O /tmp/gradle-$GRADLE_VERSION-bin.zip
Jiayu Liud40dd722023-10-19 08:37:49 +0800162 (echo "3e1af3ae886920c3ac87f7a91f816c0c7c436f276a6eefdb3da152100fef72ae /tmp/gradle-$GRADLE_VERSION-bin.zip" | sha256sum -c -)
Jiayu Liuc77d91a2022-05-03 20:55:50 +0800163 unzip -d /tmp /tmp/gradle-$GRADLE_VERSION-bin.zip
164 sudo mv /tmp/gradle-$GRADLE_VERSION /usr/local/gradle
165 sudo ln -s /usr/local/gradle/bin/gradle /usr/local/bin
166 gradle --version
167
Jiayu Liubcac9782022-05-07 08:35:09 +0800168 - name: Run spotlessCheck for Java
Jiayu Liu53ec0822022-05-06 12:56:42 +0800169 run: |
170 cd lib/java
171 gradle spotlessCheck
Yuxuan 'fishy' Wang0b11cec2023-12-04 16:42:07 -0500172 continue-on-error: true
Jiayu Liu53ec0822022-05-06 12:56:42 +0800173
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:
Jiayu Liufbfa52c2023-11-07 13:47:24 +0800288 TOOLCHAIN_VERSION: 1.65.0
Jiayu Liu0aad2ae2022-10-08 13:22:24 +0800289 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
dependabot[bot]f4b6d962023-12-01 06:30:44 +0000428 - uses: actions/setup-java@v4
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800429 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