blob: 99c92aad000dedd8df3e4da9e9968f6cabd8d8de [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:
20 os: [ubuntu-18.04, ubuntu-20.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
54 lib-java-kotlin:
55 needs: compiler
56 runs-on: ubuntu-20.04
57 env:
Jiayu Liu8a321562022-09-06 08:57:19 +080058 GRADLE_VERSION: 7.5.1
Jiayu Liuc77d91a2022-05-03 20:55:50 +080059 steps:
60 - uses: actions/checkout@v3
61
62 - uses: actions/setup-java@v3
63 with:
64 distribution: temurin
65 java-version: 11
Jiayu Liubcac9782022-05-07 08:35:09 +080066 cache: "gradle"
Jiayu Liuc77d91a2022-05-03 20:55:50 +080067
68 - name: Install dependencies
69 run: |
70 sudo apt-get update -yq
71 sudo apt-get install -y --no-install-recommends $BUILD_DEPS
72 sudo apt-get install -y wget unzip ant maven
73
74 - name: Setup gradle
75 run: |
76 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 +080077 (echo "f6b8596b10cce501591e92f229816aa4046424f3b24d771751b06779d58c8ec4 /tmp/gradle-$GRADLE_VERSION-bin.zip" | sha256sum -c -)
Jiayu Liuc77d91a2022-05-03 20:55:50 +080078 unzip -d /tmp /tmp/gradle-$GRADLE_VERSION-bin.zip
79 sudo mv /tmp/gradle-$GRADLE_VERSION /usr/local/gradle
80 sudo ln -s /usr/local/gradle/bin/gradle /usr/local/bin
81 gradle --version
82
Jiayu Liubcac9782022-05-07 08:35:09 +080083 - name: Run spotlessCheck for Java
Jiayu Liu53ec0822022-05-06 12:56:42 +080084 run: |
85 cd lib/java
86 gradle spotlessCheck
87
Jiayu Liubcac9782022-05-07 08:35:09 +080088 - name: Run ktfmtCheck for Kotlin
89 run: |
90 cd lib/kotlin
91 gradle ktfmtCheck
92
Jiayu Liuc77d91a2022-05-03 20:55:50 +080093 - name: Run bootstrap
94 run: ./bootstrap.sh
95
96 - name: Run configure
97 run: |
98 ./configure \
99 --disable-debug \
100 --disable-tests \
101 --disable-dependency-tracking \
102 --without-cpp \
103 --without-c_glib \
104 --with-java \
105 --with-kotlin \
106 --without-python \
107 --without-py3 \
108 --without-ruby \
109 --without-haxe \
110 --without-netstd \
111 --without-perl \
112 --without-php \
113 --without-php_extension \
114 --without-dart \
115 --without-erlang \
116 --without-go \
117 --without-d \
118 --without-nodejs \
119 --without-nodets \
120 --without-lua \
121 --without-rs \
122 --without-swift
123
124 - uses: actions/download-artifact@v3
125 with:
126 name: thrift-compiler
127 path: compiler/cpp
128
129 - name: Run thrift-compiler
130 run: |
131 chmod a+x compiler/cpp/thrift
132 compiler/cpp/thrift -version
133
Jiayu Liubcac9782022-05-07 08:35:09 +0800134 - name: Run make for java
Jiayu Liuc77d91a2022-05-03 20:55:50 +0800135 run: make -C lib/java
136
Jiayu Liu5b158382022-05-12 00:20:37 +0800137 # this will invoke publishToMavenLocal and install locally
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800138 - name: Run make install for java
139 run: make -C lib/java install
140
141 - name: Upload java libthrift artifacts
142 uses: actions/upload-artifact@v3
143 with:
144 name: libthrift
145 if-no-files-found: error
146 path: ~/.m2/repository/org/apache/thrift
147
Jiayu Liubcac9782022-05-07 08:35:09 +0800148 - name: Run make check for java
149 run: make -C lib/java check
150
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800151 - name: Run make precross for java
152 run: make -C lib/java precross
153
154 - name: Upload java precross artifacts
155 uses: actions/upload-artifact@v3
156 with:
157 name: java-precross
158 if-no-files-found: error
159 path: |
160 lib/java/build/functionalTestJar/
161 lib/java/build/runclient
162 lib/java/build/runnonblockingserver
163 lib/java/build/runserver
164 lib/java/build/runservletserver
165 retention-days: 3
166
Jiayu Liubcac9782022-05-07 08:35:09 +0800167 - name: Run make for kotlin
Jiayu Liuc77d91a2022-05-03 20:55:50 +0800168 run: make -C lib/kotlin
Jiayu Liubcac9782022-05-07 08:35:09 +0800169
170 - name: Run make check for kotlin
171 run: make -C lib/kotlin check
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800172
173 - name: Run make precross for kotlin
174 run: make -C lib/kotlin precross
175
176 - name: Upload kotlin precross artifacts
177 uses: actions/upload-artifact@v3
178 with:
179 name: kotlin-precross
180 if-no-files-found: error
181 path: |
182 lib/kotlin/cross-test-client/build/install/TestClient/
183 lib/kotlin/cross-test-server/build/install/TestServer/
184 retention-days: 3
185
Jiayu Liu0aad2ae2022-10-08 13:22:24 +0800186 lib-rust:
187 needs: compiler
188 runs-on: ubuntu-20.04
189 env:
190 TOOLCHAIN_VERSION: 1.61.0
191 steps:
192 - uses: actions/checkout@v3
193
194 - name: Install dependencies
195 run: |
196 sudo apt-get update -yq
197 sudo apt-get install -y --no-install-recommends curl $BUILD_DEPS
198
199 - name: Setup cargo
200 run: |
201 curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
202 rustup update
203 rustup install $TOOLCHAIN_VERSION
204 rustup default $TOOLCHAIN_VERSION
205 rustup --version
206 cargo --version
207 rustc --version
208
209 - name: Run bootstrap
210 run: ./bootstrap.sh
211
212 - name: Run configure
213 run: |
214 ./configure \
215 --disable-debug \
216 --disable-tests \
217 --disable-dependency-tracking \
218 --without-cpp \
219 --without-c_glib \
220 --without-java \
221 --without-kotlin \
222 --without-python \
223 --without-py3 \
224 --without-ruby \
225 --without-haxe \
226 --without-netstd \
227 --without-perl \
228 --without-php \
229 --without-php_extension \
230 --without-dart \
231 --without-erlang \
232 --without-go \
233 --without-d \
234 --without-nodejs \
235 --without-nodets \
236 --without-lua \
237 --with-rs \
238 --without-swift
239
240 - uses: actions/download-artifact@v3
241 with:
242 name: thrift-compiler
243 path: compiler/cpp
244
245 - name: Run thrift-compiler
246 run: |
247 chmod a+x compiler/cpp/thrift
248 compiler/cpp/thrift -version
249
250 - name: Run make for rust
251 run: make -C lib/rs
252
253 - name: Run make check for rust
254 run: make -C lib/rs check
255
256 - name: Run make test for rust
257 run: make -C lib/rs/test check
258
259 - name: Run make precross for test rust
260 run: make -C test/rs precross
261
262 - name: Upload rust precross artifacts
263 uses: actions/upload-artifact@v3
264 with:
265 name: rs-precross
266 if-no-files-found: error
267 path: |
268 test/rs/bin/test_server
269 test/rs/bin/test_client
270 retention-days: 3
271
272 - name: Run make test_recursive for rust
273 run: make -C lib/rs/test_recursive check
274
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800275 cross-test:
276 needs:
277 - lib-java-kotlin
Jiayu Liu0aad2ae2022-10-08 13:22:24 +0800278 - lib-rust
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800279 runs-on: ubuntu-20.04
280 steps:
281 - uses: actions/checkout@v3
282 - uses: actions/setup-python@v3
283 with:
284 python-version: "3.x"
285 - uses: actions/setup-java@v3
286 with:
287 distribution: temurin
288 # here we intentionally use java 8 so that we also verify java 11 compiles to version 8
289 java-version: 8
290 cache: "gradle"
291
292 - name: Download java precross artifacts
293 uses: actions/download-artifact@v3
294 with:
295 name: java-precross
296 path: lib/java/build
297
298 - name: Download kotlin precross artifacts
299 uses: actions/download-artifact@v3
300 with:
301 name: kotlin-precross
302 path: lib/kotlin
303
Jiayu Liu0aad2ae2022-10-08 13:22:24 +0800304 - name: Download rust precross artifacts
305 uses: actions/download-artifact@v3
306 with:
307 name: rs-precross
308 path: test/rs/bin
309
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800310 - name: Set back executable flags
311 run: |
312 chmod a+x \
313 lib/java/build/run* \
314 lib/kotlin/cross-test-client/build/install/TestClient/bin/* \
Jiayu Liu0aad2ae2022-10-08 13:22:24 +0800315 lib/kotlin/cross-test-server/build/install/TestServer/bin/* \
316 test/rs/bin/*
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800317
318 - name: Run cross test
319 env:
320 THRIFT_CROSSTEST_CONCURRENCY: 4
Jiayu Liu0aad2ae2022-10-08 13:22:24 +0800321 PRECROSS_LANGS: java,kotlin,rs
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800322 run: |
323 python test/test.py \
324 --retry-count 5 \
325 --skip-known-failures \
326 --server $PRECROSS_LANGS \
327 --client $PRECROSS_LANGS
328
329 - name: Upload log files from failed cross test runs
330 uses: actions/upload-artifact@v3
331 if: failure()
332 with:
333 name: cross-test-log
334 path: test/log/
335 retention-days: 3