blob: caeaf16c55c536c0c86c8fb2168357bc69da13ab [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:
Yuxuan 'fishy' Wang19c13b42022-10-12 14:13:15 -070060 - '1.19'
Yuxuan 'fishy' Wangb94eac72023-02-02 09:41:31 -080061 - '1.20'
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 \
Jiayu Liud21e95a2022-10-09 08:49:29 +080081 --disable-dependency-tracking \
82 --without-cpp \
83 --without-c_glib \
84 --without-java \
85 --without-kotlin \
86 --without-python \
87 --without-py3 \
88 --without-ruby \
89 --without-haxe \
90 --without-netstd \
91 --without-perl \
92 --without-php \
93 --without-php_extension \
94 --without-dart \
95 --without-erlang \
96 --with-go \
97 --without-d \
98 --without-nodejs \
99 --without-nodets \
100 --without-lua \
101 --without-rs \
102 --without-swift
103
104 - uses: actions/download-artifact@v3
105 with:
106 name: thrift-compiler
107 path: compiler/cpp
108
109 - name: Run thrift-compiler
110 run: |
111 chmod a+x compiler/cpp/thrift
112 compiler/cpp/thrift -version
113
114 - name: Run make for go
115 run: make -C lib/go
116
Yuxuan 'fishy' Wang19c13b42022-10-12 14:13:15 -0700117 - name: Run make check for lib/go
Jiayu Liud21e95a2022-10-09 08:49:29 +0800118 run: make -C lib/go check
119
Yuxuan 'fishy' Wang19c13b42022-10-12 14:13:15 -0700120 - name: Run make check for test/go
121 run: make -C test/go check
122
Jiayu Liud21e95a2022-10-09 08:49:29 +0800123 - name: Run make precross for go test
124 run: make -C test/go precross
125
126 - name: Upload go precross artifacts
Yuxuan 'fishy' Wangb94eac72023-02-02 09:41:31 -0800127 if: matrix.go == '1.20'
Jiayu Liud21e95a2022-10-09 08:49:29 +0800128 uses: actions/upload-artifact@v3
129 with:
130 name: go-precross
131 if-no-files-found: error
132 path: |
133 test/go/bin/*
134 retention-days: 3
135
Jiayu Liuc77d91a2022-05-03 20:55:50 +0800136 lib-java-kotlin:
137 needs: compiler
138 runs-on: ubuntu-20.04
139 env:
Jiayu Liube73a572023-04-14 11:02:43 +0800140 GRADLE_VERSION: "8.0.2"
Jiayu Liuc77d91a2022-05-03 20:55:50 +0800141 steps:
142 - uses: actions/checkout@v3
143
144 - uses: actions/setup-java@v3
145 with:
146 distribution: temurin
Jiayu Liu92b007f2022-10-14 13:16:18 +0800147 java-version: 17
Jiayu Liubcac9782022-05-07 08:35:09 +0800148 cache: "gradle"
Jiayu Liuc77d91a2022-05-03 20:55:50 +0800149
150 - name: Install dependencies
151 run: |
152 sudo apt-get update -yq
153 sudo apt-get install -y --no-install-recommends $BUILD_DEPS
154 sudo apt-get install -y wget unzip ant maven
155
156 - name: Setup gradle
157 run: |
158 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 +0800159 (echo "ff7bf6a86f09b9b2c40bb8f48b25fc19cf2b2664fd1d220cd7ab833ec758d0d7 /tmp/gradle-$GRADLE_VERSION-bin.zip" | sha256sum -c -)
Jiayu Liuc77d91a2022-05-03 20:55:50 +0800160 unzip -d /tmp /tmp/gradle-$GRADLE_VERSION-bin.zip
161 sudo mv /tmp/gradle-$GRADLE_VERSION /usr/local/gradle
162 sudo ln -s /usr/local/gradle/bin/gradle /usr/local/bin
163 gradle --version
164
Jiayu Liubcac9782022-05-07 08:35:09 +0800165 - name: Run spotlessCheck for Java
Jiayu Liu53ec0822022-05-06 12:56:42 +0800166 run: |
167 cd lib/java
168 gradle spotlessCheck
169
Jiayu Liubcac9782022-05-07 08:35:09 +0800170 - name: Run ktfmtCheck for Kotlin
171 run: |
172 cd lib/kotlin
173 gradle ktfmtCheck
174
Jiayu Liuc77d91a2022-05-03 20:55:50 +0800175 - name: Run bootstrap
176 run: ./bootstrap.sh
177
178 - name: Run configure
179 run: |
180 ./configure \
181 --disable-debug \
182 --disable-tests \
183 --disable-dependency-tracking \
184 --without-cpp \
185 --without-c_glib \
186 --with-java \
187 --with-kotlin \
188 --without-python \
189 --without-py3 \
190 --without-ruby \
191 --without-haxe \
192 --without-netstd \
193 --without-perl \
194 --without-php \
195 --without-php_extension \
196 --without-dart \
197 --without-erlang \
198 --without-go \
199 --without-d \
200 --without-nodejs \
201 --without-nodets \
202 --without-lua \
203 --without-rs \
204 --without-swift
205
206 - uses: actions/download-artifact@v3
207 with:
208 name: thrift-compiler
209 path: compiler/cpp
210
211 - name: Run thrift-compiler
212 run: |
213 chmod a+x compiler/cpp/thrift
214 compiler/cpp/thrift -version
215
Jiayu Liubcac9782022-05-07 08:35:09 +0800216 - name: Run make for java
Jiayu Liuc77d91a2022-05-03 20:55:50 +0800217 run: make -C lib/java
218
Jiayu Liu5b158382022-05-12 00:20:37 +0800219 # this will invoke publishToMavenLocal and install locally
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800220 - name: Run make install for java
221 run: make -C lib/java install
222
223 - name: Upload java libthrift artifacts
224 uses: actions/upload-artifact@v3
225 with:
226 name: libthrift
227 if-no-files-found: error
228 path: ~/.m2/repository/org/apache/thrift
229
Jiayu Liubcac9782022-05-07 08:35:09 +0800230 - name: Run make check for java
231 run: make -C lib/java check
232
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800233 - name: Run make precross for java
234 run: make -C lib/java precross
235
236 - name: Upload java precross artifacts
237 uses: actions/upload-artifact@v3
238 with:
239 name: java-precross
240 if-no-files-found: error
241 path: |
242 lib/java/build/functionalTestJar/
243 lib/java/build/runclient
244 lib/java/build/runnonblockingserver
245 lib/java/build/runserver
246 lib/java/build/runservletserver
247 retention-days: 3
248
Jiayu Liubcac9782022-05-07 08:35:09 +0800249 - name: Run make for kotlin
Jiayu Liuc77d91a2022-05-03 20:55:50 +0800250 run: make -C lib/kotlin
Jiayu Liubcac9782022-05-07 08:35:09 +0800251
252 - name: Run make check for kotlin
253 run: make -C lib/kotlin check
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800254
255 - name: Run make precross for kotlin
256 run: make -C lib/kotlin precross
257
258 - name: Upload kotlin precross artifacts
259 uses: actions/upload-artifact@v3
260 with:
261 name: kotlin-precross
262 if-no-files-found: error
263 path: |
264 lib/kotlin/cross-test-client/build/install/TestClient/
265 lib/kotlin/cross-test-server/build/install/TestServer/
266 retention-days: 3
267
Kino Roya9da9eb2022-10-07 23:13:01 -0700268 lib-swift:
269 needs: compiler
270 runs-on: ubuntu-20.04
271 steps:
272 - uses: actions/checkout@v3
Jiayu Liud21e95a2022-10-09 08:49:29 +0800273
Kino Roya9da9eb2022-10-07 23:13:01 -0700274 - name: Run bootstrap
275 run: ./bootstrap.sh
276
277 - name: Run configure
278 run: |
279 ./configure \
280 --disable-debug \
281 --disable-tests \
282 --disable-dependency-tracking \
283 --without-cpp \
284 --without-c_glib \
285 --without-java \
286 --without-kotlin \
287 --without-python \
288 --without-py3 \
289 --without-ruby \
290 --without-haxe \
291 --without-netstd \
292 --without-perl \
293 --without-php \
294 --without-php_extension \
295 --without-dart \
296 --without-erlang \
297 --without-go \
298 --without-d \
299 --without-nodejs \
300 --without-nodets \
301 --without-lua \
302 --without-rs \
303 --with-swift
Jiayu Liud21e95a2022-10-09 08:49:29 +0800304
Kino Roya9da9eb2022-10-07 23:13:01 -0700305 - uses: actions/download-artifact@v3
306 with:
307 name: thrift-compiler
308 path: compiler/cpp
309
310 - name: Run thrift-compiler
311 run: |
312 chmod a+x compiler/cpp/thrift
313 compiler/cpp/thrift -version
Jiayu Liud21e95a2022-10-09 08:49:29 +0800314
Kino Roya9da9eb2022-10-07 23:13:01 -0700315 - name: Run make precross for swift
316 run: make -C test/swift precross
317
318 - name: Upload swift precross artifacts
319 uses: actions/upload-artifact@v3
320 with:
321 name: swift-precross
322 if-no-files-found: error
323 path: |
324 test/swift/CrossTests/.build/x86_64-unknown-linux-gnu/debug/TestServer
325 test/swift/CrossTests/.build/x86_64-unknown-linux-gnu/debug/TestClient
326 retention-days: 3
327
Jiayu Liu0aad2ae2022-10-08 13:22:24 +0800328 lib-rust:
329 needs: compiler
330 runs-on: ubuntu-20.04
331 env:
332 TOOLCHAIN_VERSION: 1.61.0
333 steps:
334 - uses: actions/checkout@v3
335
336 - name: Install dependencies
337 run: |
338 sudo apt-get update -yq
339 sudo apt-get install -y --no-install-recommends curl $BUILD_DEPS
340
341 - name: Setup cargo
342 run: |
343 curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
344 rustup update
345 rustup install $TOOLCHAIN_VERSION
346 rustup default $TOOLCHAIN_VERSION
347 rustup --version
348 cargo --version
349 rustc --version
350
351 - name: Run bootstrap
352 run: ./bootstrap.sh
353
354 - name: Run configure
355 run: |
356 ./configure \
357 --disable-debug \
358 --disable-tests \
359 --disable-dependency-tracking \
360 --without-cpp \
361 --without-c_glib \
362 --without-java \
363 --without-kotlin \
364 --without-python \
365 --without-py3 \
366 --without-ruby \
367 --without-haxe \
368 --without-netstd \
369 --without-perl \
370 --without-php \
371 --without-php_extension \
372 --without-dart \
373 --without-erlang \
374 --without-go \
375 --without-d \
376 --without-nodejs \
377 --without-nodets \
378 --without-lua \
379 --with-rs \
380 --without-swift
381
382 - uses: actions/download-artifact@v3
383 with:
384 name: thrift-compiler
385 path: compiler/cpp
386
387 - name: Run thrift-compiler
388 run: |
389 chmod a+x compiler/cpp/thrift
390 compiler/cpp/thrift -version
391
392 - name: Run make for rust
393 run: make -C lib/rs
394
395 - name: Run make check for rust
396 run: make -C lib/rs check
397
398 - name: Run make test for rust
399 run: make -C lib/rs/test check
400
401 - name: Run make precross for test rust
402 run: make -C test/rs precross
403
404 - name: Upload rust precross artifacts
405 uses: actions/upload-artifact@v3
406 with:
407 name: rs-precross
408 if-no-files-found: error
409 path: |
410 test/rs/bin/test_server
411 test/rs/bin/test_client
412 retention-days: 3
413
414 - name: Run make test_recursive for rust
415 run: make -C lib/rs/test_recursive check
416
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800417 cross-test:
418 needs:
419 - lib-java-kotlin
Kino Roya9da9eb2022-10-07 23:13:01 -0700420 - lib-swift
Jiayu Liu0aad2ae2022-10-08 13:22:24 +0800421 - lib-rust
Jiayu Liud21e95a2022-10-09 08:49:29 +0800422 - lib-go
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800423 runs-on: ubuntu-20.04
424 steps:
425 - uses: actions/checkout@v3
Jiayu Liud21e95a2022-10-09 08:49:29 +0800426
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800427 - uses: actions/setup-python@v3
428 with:
429 python-version: "3.x"
Jiayu Liud21e95a2022-10-09 08:49:29 +0800430
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800431 - uses: actions/setup-java@v3
432 with:
433 distribution: temurin
Jiayu Liube73a572023-04-14 11:02:43 +0800434 # here we intentionally use an older version so that we also verify Java 17 compiles to it
Jiayu Liu92b007f2022-10-14 13:16:18 +0800435 java-version: 11
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800436 cache: "gradle"
437
Jiayu Liud21e95a2022-10-09 08:49:29 +0800438 - name: Install openssl and certificates (for SSL tests)
439 run: |
440 sudo apt-get update -yq
441 sudo apt-get install -y --no-install-recommends openssl ca-certificates
442
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800443 - name: Download java precross artifacts
444 uses: actions/download-artifact@v3
445 with:
446 name: java-precross
447 path: lib/java/build
448
449 - name: Download kotlin precross artifacts
450 uses: actions/download-artifact@v3
451 with:
452 name: kotlin-precross
453 path: lib/kotlin
454
Kino Roya9da9eb2022-10-07 23:13:01 -0700455 - name: Download swift precross artifacts
456 uses: actions/download-artifact@v3
457 with:
458 name: swift-precross
459 path: test/swift/CrossTests/.build/x86_64-unknown-linux-gnu/debug
460
Jiayu Liu0aad2ae2022-10-08 13:22:24 +0800461 - name: Download rust precross artifacts
462 uses: actions/download-artifact@v3
463 with:
464 name: rs-precross
465 path: test/rs/bin
466
Jiayu Liud21e95a2022-10-09 08:49:29 +0800467 - name: Download go precross artifacts
468 uses: actions/download-artifact@v3
469 with:
470 name: go-precross
471 path: test/go/bin
472
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800473 - name: Set back executable flags
474 run: |
475 chmod a+x \
476 lib/java/build/run* \
477 lib/kotlin/cross-test-client/build/install/TestClient/bin/* \
Jiayu Liu0aad2ae2022-10-08 13:22:24 +0800478 lib/kotlin/cross-test-server/build/install/TestServer/bin/* \
Kino Roya9da9eb2022-10-07 23:13:01 -0700479 test/swift/CrossTests/.build/x86_64-unknown-linux-gnu/debug/* \
Jiayu Liud21e95a2022-10-09 08:49:29 +0800480 test/rs/bin/* \
481 test/go/bin/*
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800482
483 - name: Run cross test
484 env:
485 THRIFT_CROSSTEST_CONCURRENCY: 4
Jiayu Liud21e95a2022-10-09 08:49:29 +0800486 PRECROSS_LANGS: java,kotlin,go,rs,swift
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800487 run: |
488 python test/test.py \
489 --retry-count 5 \
490 --skip-known-failures \
491 --server $PRECROSS_LANGS \
492 --client $PRECROSS_LANGS
493
494 - name: Upload log files from failed cross test runs
495 uses: actions/upload-artifact@v3
496 if: failure()
497 with:
498 name: cross-test-log
499 path: test/log/
500 retention-days: 3