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 | |
Jiayu Liu | 6a61c4e | 2022-04-29 01:25:39 +0800 | [diff] [blame] | 12 | jobs: |
| 13 | # TODO windows and macos |
Jiayu Liu | c77d91a | 2022-05-03 20:55:50 +0800 | [diff] [blame] | 14 | compiler: |
Jiayu Liu | 6a61c4e | 2022-04-29 01:25:39 +0800 | [diff] [blame] | 15 | strategy: |
Jiayu Liu | c77d91a | 2022-05-03 20:55:50 +0800 | [diff] [blame] | 16 | matrix: |
| 17 | os: [ubuntu-18.04, ubuntu-20.04] |
Jiayu Liu | 6a61c4e | 2022-04-29 01:25:39 +0800 | [diff] [blame] | 18 | runs-on: ${{ matrix.os }} |
| 19 | steps: |
| 20 | - uses: actions/checkout@v3 |
| 21 | |
| 22 | - name: Install dependencies |
| 23 | run: | |
Jiayu Liu | 6a61c4e | 2022-04-29 01:25:39 +0800 | [diff] [blame] | 24 | sudo apt-get update -yq |
Jiayu Liu | ab83ffc | 2022-05-10 01:56:30 +0800 | [diff] [blame] | 25 | sudo apt-get install -y --no-install-recommends g++ $BUILD_DEPS |
Jiayu Liu | 6a61c4e | 2022-04-29 01:25:39 +0800 | [diff] [blame] | 26 | |
| 27 | - name: Run bootstrap |
| 28 | run: ./bootstrap.sh |
| 29 | |
| 30 | - name: Run configure |
| 31 | run: ./configure --disable-debug --disable-tests --disable-libs |
| 32 | |
| 33 | - name: Run make |
| 34 | run: make -j$(nproc) |
| 35 | |
| 36 | - name: Run install |
| 37 | run: make install |
| 38 | |
| 39 | - name: Run thrift version |
| 40 | run: /usr/local/bin/thrift -version |
Jiayu Liu | c77d91a | 2022-05-03 20:55:50 +0800 | [diff] [blame] | 41 | |
| 42 | # only upload while building ubuntu-20.04 |
| 43 | - name: Archive built thrift compiler |
| 44 | if: matrix.os == 'ubuntu-20.04' |
| 45 | uses: actions/upload-artifact@v3 |
| 46 | with: |
| 47 | name: thrift-compiler |
| 48 | path: compiler/cpp/thrift |
| 49 | retention-days: 3 |
| 50 | |
| 51 | lib-java-kotlin: |
| 52 | needs: compiler |
| 53 | runs-on: ubuntu-20.04 |
| 54 | env: |
| 55 | GRADLE_VERSION: 6.9.2 |
| 56 | steps: |
| 57 | - uses: actions/checkout@v3 |
| 58 | |
| 59 | - uses: actions/setup-java@v3 |
| 60 | with: |
| 61 | distribution: temurin |
| 62 | java-version: 11 |
Jiayu Liu | bcac978 | 2022-05-07 08:35:09 +0800 | [diff] [blame] | 63 | cache: "gradle" |
Jiayu Liu | c77d91a | 2022-05-03 20:55:50 +0800 | [diff] [blame] | 64 | |
| 65 | - name: Install dependencies |
| 66 | run: | |
| 67 | sudo apt-get update -yq |
| 68 | sudo apt-get install -y --no-install-recommends $BUILD_DEPS |
| 69 | sudo apt-get install -y wget unzip ant maven |
| 70 | |
| 71 | - name: Setup gradle |
| 72 | run: | |
| 73 | wget https://services.gradle.org/distributions/gradle-$GRADLE_VERSION-bin.zip -q -O /tmp/gradle-$GRADLE_VERSION-bin.zip |
| 74 | (echo "8b356fd8702d5ffa2e066ed0be45a023a779bba4dd1a68fd11bc2a6bdc981e8f /tmp/gradle-$GRADLE_VERSION-bin.zip" | sha256sum -c -) |
| 75 | unzip -d /tmp /tmp/gradle-$GRADLE_VERSION-bin.zip |
| 76 | sudo mv /tmp/gradle-$GRADLE_VERSION /usr/local/gradle |
| 77 | sudo ln -s /usr/local/gradle/bin/gradle /usr/local/bin |
| 78 | gradle --version |
| 79 | |
Jiayu Liu | bcac978 | 2022-05-07 08:35:09 +0800 | [diff] [blame] | 80 | - name: Run spotlessCheck for Java |
Jiayu Liu | 53ec082 | 2022-05-06 12:56:42 +0800 | [diff] [blame] | 81 | run: | |
| 82 | cd lib/java |
| 83 | gradle spotlessCheck |
| 84 | |
Jiayu Liu | bcac978 | 2022-05-07 08:35:09 +0800 | [diff] [blame] | 85 | - name: Run ktfmtCheck for Kotlin |
| 86 | run: | |
| 87 | cd lib/kotlin |
| 88 | gradle ktfmtCheck |
| 89 | |
Jiayu Liu | c77d91a | 2022-05-03 20:55:50 +0800 | [diff] [blame] | 90 | - name: Run bootstrap |
| 91 | run: ./bootstrap.sh |
| 92 | |
| 93 | - name: Run configure |
| 94 | run: | |
| 95 | ./configure \ |
| 96 | --disable-debug \ |
| 97 | --disable-tests \ |
| 98 | --disable-dependency-tracking \ |
| 99 | --without-cpp \ |
| 100 | --without-c_glib \ |
| 101 | --with-java \ |
| 102 | --with-kotlin \ |
| 103 | --without-python \ |
| 104 | --without-py3 \ |
| 105 | --without-ruby \ |
| 106 | --without-haxe \ |
| 107 | --without-netstd \ |
| 108 | --without-perl \ |
| 109 | --without-php \ |
| 110 | --without-php_extension \ |
| 111 | --without-dart \ |
| 112 | --without-erlang \ |
| 113 | --without-go \ |
| 114 | --without-d \ |
| 115 | --without-nodejs \ |
| 116 | --without-nodets \ |
| 117 | --without-lua \ |
| 118 | --without-rs \ |
| 119 | --without-swift |
| 120 | |
| 121 | - uses: actions/download-artifact@v3 |
| 122 | with: |
| 123 | name: thrift-compiler |
| 124 | path: compiler/cpp |
| 125 | |
| 126 | - name: Run thrift-compiler |
| 127 | run: | |
| 128 | chmod a+x compiler/cpp/thrift |
| 129 | compiler/cpp/thrift -version |
| 130 | |
Jiayu Liu | bcac978 | 2022-05-07 08:35:09 +0800 | [diff] [blame] | 131 | - name: Run make for java |
Jiayu Liu | c77d91a | 2022-05-03 20:55:50 +0800 | [diff] [blame] | 132 | run: make -C lib/java |
| 133 | |
Jiayu Liu | ab83ffc | 2022-05-10 01:56:30 +0800 | [diff] [blame] | 134 | - name: Run make install for java |
| 135 | run: make -C lib/java install |
| 136 | |
| 137 | - name: Upload java libthrift artifacts |
| 138 | uses: actions/upload-artifact@v3 |
| 139 | with: |
| 140 | name: libthrift |
| 141 | if-no-files-found: error |
| 142 | path: ~/.m2/repository/org/apache/thrift |
| 143 | |
Jiayu Liu | bcac978 | 2022-05-07 08:35:09 +0800 | [diff] [blame] | 144 | - name: Run make check for java |
| 145 | run: make -C lib/java check |
| 146 | |
Jiayu Liu | ab83ffc | 2022-05-10 01:56:30 +0800 | [diff] [blame] | 147 | - name: Run make precross for java |
| 148 | run: make -C lib/java precross |
| 149 | |
| 150 | - name: Upload java precross artifacts |
| 151 | uses: actions/upload-artifact@v3 |
| 152 | with: |
| 153 | name: java-precross |
| 154 | if-no-files-found: error |
| 155 | path: | |
| 156 | lib/java/build/functionalTestJar/ |
| 157 | lib/java/build/runclient |
| 158 | lib/java/build/runnonblockingserver |
| 159 | lib/java/build/runserver |
| 160 | lib/java/build/runservletserver |
| 161 | retention-days: 3 |
| 162 | |
Jiayu Liu | bcac978 | 2022-05-07 08:35:09 +0800 | [diff] [blame] | 163 | - name: Run make for kotlin |
Jiayu Liu | c77d91a | 2022-05-03 20:55:50 +0800 | [diff] [blame] | 164 | run: make -C lib/kotlin |
Jiayu Liu | bcac978 | 2022-05-07 08:35:09 +0800 | [diff] [blame] | 165 | |
| 166 | - name: Run make check for kotlin |
| 167 | run: make -C lib/kotlin check |
Jiayu Liu | ab83ffc | 2022-05-10 01:56:30 +0800 | [diff] [blame] | 168 | |
| 169 | - name: Run make precross for kotlin |
| 170 | run: make -C lib/kotlin precross |
| 171 | |
| 172 | - name: Upload kotlin precross artifacts |
| 173 | uses: actions/upload-artifact@v3 |
| 174 | with: |
| 175 | name: kotlin-precross |
| 176 | if-no-files-found: error |
| 177 | path: | |
| 178 | lib/kotlin/cross-test-client/build/install/TestClient/ |
| 179 | lib/kotlin/cross-test-server/build/install/TestServer/ |
| 180 | retention-days: 3 |
| 181 | |
| 182 | cross-test: |
| 183 | needs: |
| 184 | - lib-java-kotlin |
| 185 | runs-on: ubuntu-20.04 |
| 186 | steps: |
| 187 | - uses: actions/checkout@v3 |
| 188 | - uses: actions/setup-python@v3 |
| 189 | with: |
| 190 | python-version: "3.x" |
| 191 | - uses: actions/setup-java@v3 |
| 192 | with: |
| 193 | distribution: temurin |
| 194 | # here we intentionally use java 8 so that we also verify java 11 compiles to version 8 |
| 195 | java-version: 8 |
| 196 | cache: "gradle" |
| 197 | |
| 198 | - name: Download java precross artifacts |
| 199 | uses: actions/download-artifact@v3 |
| 200 | with: |
| 201 | name: java-precross |
| 202 | path: lib/java/build |
| 203 | |
| 204 | - name: Download kotlin precross artifacts |
| 205 | uses: actions/download-artifact@v3 |
| 206 | with: |
| 207 | name: kotlin-precross |
| 208 | path: lib/kotlin |
| 209 | |
| 210 | - name: Set back executable flags |
| 211 | run: | |
| 212 | chmod a+x \ |
| 213 | lib/java/build/run* \ |
| 214 | lib/kotlin/cross-test-client/build/install/TestClient/bin/* \ |
| 215 | lib/kotlin/cross-test-server/build/install/TestServer/bin/* |
| 216 | |
| 217 | - name: Run cross test |
| 218 | env: |
| 219 | THRIFT_CROSSTEST_CONCURRENCY: 4 |
| 220 | PRECROSS_LANGS: java,kotlin |
| 221 | run: | |
| 222 | python test/test.py \ |
| 223 | --retry-count 5 \ |
| 224 | --skip-known-failures \ |
| 225 | --server $PRECROSS_LANGS \ |
| 226 | --client $PRECROSS_LANGS |
| 227 | |
| 228 | - name: Upload log files from failed cross test runs |
| 229 | uses: actions/upload-artifact@v3 |
| 230 | if: failure() |
| 231 | with: |
| 232 | name: cross-test-log |
| 233 | path: test/log/ |
| 234 | retention-days: 3 |