Jiayu Liu | bcac978 | 2022-05-07 08:35:09 +0800 | [diff] [blame] | 1 | name: "Build" |
Jiayu Liu | c77d91a | 2022-05-03 20:55:50 +0800 | [diff] [blame] | 2 | |
Jiayu Liu | 6a61c4e | 2022-04-29 01:25:39 +0800 | [diff] [blame] | 3 | on: |
| 4 | push: |
Jiayu Liu | bcac978 | 2022-05-07 08:35:09 +0800 | [diff] [blame] | 5 | branches: ["*"] |
Jiayu Liu | 6a61c4e | 2022-04-29 01:25:39 +0800 | [diff] [blame] | 6 | pull_request: |
Jiayu Liu | bcac978 | 2022-05-07 08:35:09 +0800 | [diff] [blame] | 7 | branches: ["*"] |
Jiayu Liu | c77d91a | 2022-05-03 20:55:50 +0800 | [diff] [blame] | 8 | |
| 9 | env: |
Jiayu Liu | ab83ffc | 2022-05-10 01:56:30 +0800 | [diff] [blame] | 10 | BUILD_DEPS: automake bison flex git libboost-all-dev libevent-dev libssl-dev libtool make pkg-config |
Jiayu Liu | c77d91a | 2022-05-03 20:55:50 +0800 | [diff] [blame] | 11 | |
Varun Sharma | bd1e5db | 2022-09-14 07:31:30 -0700 | [diff] [blame] | 12 | permissions: |
| 13 | contents: read |
| 14 | |
Jiayu Liu | 6a61c4e | 2022-04-29 01:25:39 +0800 | [diff] [blame] | 15 | jobs: |
| 16 | # TODO windows and macos |
Jiayu Liu | c77d91a | 2022-05-03 20:55:50 +0800 | [diff] [blame] | 17 | compiler: |
Jiayu Liu | 6a61c4e | 2022-04-29 01:25:39 +0800 | [diff] [blame] | 18 | strategy: |
Jiayu Liu | c77d91a | 2022-05-03 20:55:50 +0800 | [diff] [blame] | 19 | matrix: |
| 20 | os: [ubuntu-18.04, ubuntu-20.04] |
Jiayu Liu | 6a61c4e | 2022-04-29 01:25:39 +0800 | [diff] [blame] | 21 | runs-on: ${{ matrix.os }} |
| 22 | steps: |
| 23 | - uses: actions/checkout@v3 |
| 24 | |
| 25 | - name: Install dependencies |
| 26 | run: | |
Jiayu Liu | 6a61c4e | 2022-04-29 01:25:39 +0800 | [diff] [blame] | 27 | sudo apt-get update -yq |
Jiayu Liu | ab83ffc | 2022-05-10 01:56:30 +0800 | [diff] [blame] | 28 | sudo apt-get install -y --no-install-recommends g++ $BUILD_DEPS |
Jiayu Liu | 6a61c4e | 2022-04-29 01:25:39 +0800 | [diff] [blame] | 29 | |
| 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 Liu | c77d91a | 2022-05-03 20:55:50 +0800 | [diff] [blame] | 44 | |
| 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 Liu | 8a32156 | 2022-09-06 08:57:19 +0800 | [diff] [blame] | 58 | GRADLE_VERSION: 7.5.1 |
Jiayu Liu | c77d91a | 2022-05-03 20:55:50 +0800 | [diff] [blame] | 59 | steps: |
| 60 | - uses: actions/checkout@v3 |
| 61 | |
| 62 | - uses: actions/setup-java@v3 |
| 63 | with: |
| 64 | distribution: temurin |
| 65 | java-version: 11 |
Jiayu Liu | bcac978 | 2022-05-07 08:35:09 +0800 | [diff] [blame] | 66 | cache: "gradle" |
Jiayu Liu | c77d91a | 2022-05-03 20:55:50 +0800 | [diff] [blame] | 67 | |
| 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 Liu | 8a32156 | 2022-09-06 08:57:19 +0800 | [diff] [blame] | 77 | (echo "f6b8596b10cce501591e92f229816aa4046424f3b24d771751b06779d58c8ec4 /tmp/gradle-$GRADLE_VERSION-bin.zip" | sha256sum -c -) |
Jiayu Liu | c77d91a | 2022-05-03 20:55:50 +0800 | [diff] [blame] | 78 | 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 Liu | bcac978 | 2022-05-07 08:35:09 +0800 | [diff] [blame] | 83 | - name: Run spotlessCheck for Java |
Jiayu Liu | 53ec082 | 2022-05-06 12:56:42 +0800 | [diff] [blame] | 84 | run: | |
| 85 | cd lib/java |
| 86 | gradle spotlessCheck |
| 87 | |
Jiayu Liu | bcac978 | 2022-05-07 08:35:09 +0800 | [diff] [blame] | 88 | - name: Run ktfmtCheck for Kotlin |
| 89 | run: | |
| 90 | cd lib/kotlin |
| 91 | gradle ktfmtCheck |
| 92 | |
Jiayu Liu | c77d91a | 2022-05-03 20:55:50 +0800 | [diff] [blame] | 93 | - 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 Liu | bcac978 | 2022-05-07 08:35:09 +0800 | [diff] [blame] | 134 | - name: Run make for java |
Jiayu Liu | c77d91a | 2022-05-03 20:55:50 +0800 | [diff] [blame] | 135 | run: make -C lib/java |
| 136 | |
Jiayu Liu | 5b15838 | 2022-05-12 00:20:37 +0800 | [diff] [blame] | 137 | # this will invoke publishToMavenLocal and install locally |
Jiayu Liu | ab83ffc | 2022-05-10 01:56:30 +0800 | [diff] [blame] | 138 | - 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 Liu | bcac978 | 2022-05-07 08:35:09 +0800 | [diff] [blame] | 148 | - name: Run make check for java |
| 149 | run: make -C lib/java check |
| 150 | |
Jiayu Liu | ab83ffc | 2022-05-10 01:56:30 +0800 | [diff] [blame] | 151 | - 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 Liu | bcac978 | 2022-05-07 08:35:09 +0800 | [diff] [blame] | 167 | - name: Run make for kotlin |
Jiayu Liu | c77d91a | 2022-05-03 20:55:50 +0800 | [diff] [blame] | 168 | run: make -C lib/kotlin |
Jiayu Liu | bcac978 | 2022-05-07 08:35:09 +0800 | [diff] [blame] | 169 | |
| 170 | - name: Run make check for kotlin |
| 171 | run: make -C lib/kotlin check |
Jiayu Liu | ab83ffc | 2022-05-10 01:56:30 +0800 | [diff] [blame] | 172 | |
| 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 | |
Kino Roy | a9da9eb | 2022-10-07 23:13:01 -0700 | [diff] [blame] | 186 | lib-swift: |
| 187 | needs: compiler |
| 188 | runs-on: ubuntu-20.04 |
| 189 | steps: |
| 190 | - uses: actions/checkout@v3 |
| 191 | |
| 192 | - name: Run bootstrap |
| 193 | run: ./bootstrap.sh |
| 194 | |
| 195 | - name: Run configure |
| 196 | run: | |
| 197 | ./configure \ |
| 198 | --disable-debug \ |
| 199 | --disable-tests \ |
| 200 | --disable-dependency-tracking \ |
| 201 | --without-cpp \ |
| 202 | --without-c_glib \ |
| 203 | --without-java \ |
| 204 | --without-kotlin \ |
| 205 | --without-python \ |
| 206 | --without-py3 \ |
| 207 | --without-ruby \ |
| 208 | --without-haxe \ |
| 209 | --without-netstd \ |
| 210 | --without-perl \ |
| 211 | --without-php \ |
| 212 | --without-php_extension \ |
| 213 | --without-dart \ |
| 214 | --without-erlang \ |
| 215 | --without-go \ |
| 216 | --without-d \ |
| 217 | --without-nodejs \ |
| 218 | --without-nodets \ |
| 219 | --without-lua \ |
| 220 | --without-rs \ |
| 221 | --with-swift |
| 222 | |
| 223 | - uses: actions/download-artifact@v3 |
| 224 | with: |
| 225 | name: thrift-compiler |
| 226 | path: compiler/cpp |
| 227 | |
| 228 | - name: Run thrift-compiler |
| 229 | run: | |
| 230 | chmod a+x compiler/cpp/thrift |
| 231 | compiler/cpp/thrift -version |
| 232 | |
| 233 | - name: Run make precross for swift |
| 234 | run: make -C test/swift precross |
| 235 | |
| 236 | - name: Upload swift precross artifacts |
| 237 | uses: actions/upload-artifact@v3 |
| 238 | with: |
| 239 | name: swift-precross |
| 240 | if-no-files-found: error |
| 241 | path: | |
| 242 | test/swift/CrossTests/.build/x86_64-unknown-linux-gnu/debug/TestServer |
| 243 | test/swift/CrossTests/.build/x86_64-unknown-linux-gnu/debug/TestClient |
| 244 | retention-days: 3 |
| 245 | |
Jiayu Liu | 0aad2ae | 2022-10-08 13:22:24 +0800 | [diff] [blame] | 246 | lib-rust: |
| 247 | needs: compiler |
| 248 | runs-on: ubuntu-20.04 |
| 249 | env: |
| 250 | TOOLCHAIN_VERSION: 1.61.0 |
| 251 | steps: |
| 252 | - uses: actions/checkout@v3 |
| 253 | |
| 254 | - name: Install dependencies |
| 255 | run: | |
| 256 | sudo apt-get update -yq |
| 257 | sudo apt-get install -y --no-install-recommends curl $BUILD_DEPS |
| 258 | |
| 259 | - name: Setup cargo |
| 260 | run: | |
| 261 | curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y |
| 262 | rustup update |
| 263 | rustup install $TOOLCHAIN_VERSION |
| 264 | rustup default $TOOLCHAIN_VERSION |
| 265 | rustup --version |
| 266 | cargo --version |
| 267 | rustc --version |
| 268 | |
| 269 | - name: Run bootstrap |
| 270 | run: ./bootstrap.sh |
| 271 | |
| 272 | - name: Run configure |
| 273 | run: | |
| 274 | ./configure \ |
| 275 | --disable-debug \ |
| 276 | --disable-tests \ |
| 277 | --disable-dependency-tracking \ |
| 278 | --without-cpp \ |
| 279 | --without-c_glib \ |
| 280 | --without-java \ |
| 281 | --without-kotlin \ |
| 282 | --without-python \ |
| 283 | --without-py3 \ |
| 284 | --without-ruby \ |
| 285 | --without-haxe \ |
| 286 | --without-netstd \ |
| 287 | --without-perl \ |
| 288 | --without-php \ |
| 289 | --without-php_extension \ |
| 290 | --without-dart \ |
| 291 | --without-erlang \ |
| 292 | --without-go \ |
| 293 | --without-d \ |
| 294 | --without-nodejs \ |
| 295 | --without-nodets \ |
| 296 | --without-lua \ |
| 297 | --with-rs \ |
| 298 | --without-swift |
| 299 | |
| 300 | - uses: actions/download-artifact@v3 |
| 301 | with: |
| 302 | name: thrift-compiler |
| 303 | path: compiler/cpp |
| 304 | |
| 305 | - name: Run thrift-compiler |
| 306 | run: | |
| 307 | chmod a+x compiler/cpp/thrift |
| 308 | compiler/cpp/thrift -version |
| 309 | |
| 310 | - name: Run make for rust |
| 311 | run: make -C lib/rs |
| 312 | |
| 313 | - name: Run make check for rust |
| 314 | run: make -C lib/rs check |
| 315 | |
| 316 | - name: Run make test for rust |
| 317 | run: make -C lib/rs/test check |
| 318 | |
| 319 | - name: Run make precross for test rust |
| 320 | run: make -C test/rs precross |
| 321 | |
| 322 | - name: Upload rust precross artifacts |
| 323 | uses: actions/upload-artifact@v3 |
| 324 | with: |
| 325 | name: rs-precross |
| 326 | if-no-files-found: error |
| 327 | path: | |
| 328 | test/rs/bin/test_server |
| 329 | test/rs/bin/test_client |
| 330 | retention-days: 3 |
| 331 | |
| 332 | - name: Run make test_recursive for rust |
| 333 | run: make -C lib/rs/test_recursive check |
| 334 | |
Jiayu Liu | ab83ffc | 2022-05-10 01:56:30 +0800 | [diff] [blame] | 335 | cross-test: |
| 336 | needs: |
| 337 | - lib-java-kotlin |
Kino Roy | a9da9eb | 2022-10-07 23:13:01 -0700 | [diff] [blame] | 338 | - lib-swift |
Jiayu Liu | 0aad2ae | 2022-10-08 13:22:24 +0800 | [diff] [blame] | 339 | - lib-rust |
Jiayu Liu | ab83ffc | 2022-05-10 01:56:30 +0800 | [diff] [blame] | 340 | runs-on: ubuntu-20.04 |
| 341 | steps: |
| 342 | - uses: actions/checkout@v3 |
| 343 | - uses: actions/setup-python@v3 |
| 344 | with: |
| 345 | python-version: "3.x" |
| 346 | - uses: actions/setup-java@v3 |
| 347 | with: |
| 348 | distribution: temurin |
| 349 | # here we intentionally use java 8 so that we also verify java 11 compiles to version 8 |
| 350 | java-version: 8 |
| 351 | cache: "gradle" |
| 352 | |
| 353 | - name: Download java precross artifacts |
| 354 | uses: actions/download-artifact@v3 |
| 355 | with: |
| 356 | name: java-precross |
| 357 | path: lib/java/build |
| 358 | |
| 359 | - name: Download kotlin precross artifacts |
| 360 | uses: actions/download-artifact@v3 |
| 361 | with: |
| 362 | name: kotlin-precross |
| 363 | path: lib/kotlin |
| 364 | |
Kino Roy | a9da9eb | 2022-10-07 23:13:01 -0700 | [diff] [blame] | 365 | - name: Download swift precross artifacts |
| 366 | uses: actions/download-artifact@v3 |
| 367 | with: |
| 368 | name: swift-precross |
| 369 | path: test/swift/CrossTests/.build/x86_64-unknown-linux-gnu/debug |
| 370 | |
Jiayu Liu | 0aad2ae | 2022-10-08 13:22:24 +0800 | [diff] [blame] | 371 | - name: Download rust precross artifacts |
| 372 | uses: actions/download-artifact@v3 |
| 373 | with: |
| 374 | name: rs-precross |
| 375 | path: test/rs/bin |
| 376 | |
Jiayu Liu | ab83ffc | 2022-05-10 01:56:30 +0800 | [diff] [blame] | 377 | - name: Set back executable flags |
| 378 | run: | |
| 379 | chmod a+x \ |
| 380 | lib/java/build/run* \ |
| 381 | lib/kotlin/cross-test-client/build/install/TestClient/bin/* \ |
Jiayu Liu | 0aad2ae | 2022-10-08 13:22:24 +0800 | [diff] [blame] | 382 | lib/kotlin/cross-test-server/build/install/TestServer/bin/* \ |
Kino Roy | a9da9eb | 2022-10-07 23:13:01 -0700 | [diff] [blame] | 383 | test/swift/CrossTests/.build/x86_64-unknown-linux-gnu/debug/* \ |
Jiayu Liu | 0aad2ae | 2022-10-08 13:22:24 +0800 | [diff] [blame] | 384 | test/rs/bin/* |
Jiayu Liu | ab83ffc | 2022-05-10 01:56:30 +0800 | [diff] [blame] | 385 | |
| 386 | - name: Run cross test |
| 387 | env: |
| 388 | THRIFT_CROSSTEST_CONCURRENCY: 4 |
Kino Roy | a9da9eb | 2022-10-07 23:13:01 -0700 | [diff] [blame] | 389 | PRECROSS_LANGS: java,kotlin,rs,swift |
Jiayu Liu | ab83ffc | 2022-05-10 01:56:30 +0800 | [diff] [blame] | 390 | run: | |
| 391 | python test/test.py \ |
| 392 | --retry-count 5 \ |
| 393 | --skip-known-failures \ |
| 394 | --server $PRECROSS_LANGS \ |
| 395 | --client $PRECROSS_LANGS |
| 396 | |
| 397 | - name: Upload log files from failed cross test runs |
| 398 | uses: actions/upload-artifact@v3 |
| 399 | if: failure() |
| 400 | with: |
| 401 | name: cross-test-log |
| 402 | path: test/log/ |
| 403 | retention-days: 3 |