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 | |
| 186 | cross-test: |
| 187 | needs: |
| 188 | - lib-java-kotlin |
| 189 | runs-on: ubuntu-20.04 |
| 190 | steps: |
| 191 | - uses: actions/checkout@v3 |
| 192 | - uses: actions/setup-python@v3 |
| 193 | with: |
| 194 | python-version: "3.x" |
| 195 | - uses: actions/setup-java@v3 |
| 196 | with: |
| 197 | distribution: temurin |
| 198 | # here we intentionally use java 8 so that we also verify java 11 compiles to version 8 |
| 199 | java-version: 8 |
| 200 | cache: "gradle" |
| 201 | |
| 202 | - name: Download java precross artifacts |
| 203 | uses: actions/download-artifact@v3 |
| 204 | with: |
| 205 | name: java-precross |
| 206 | path: lib/java/build |
| 207 | |
| 208 | - name: Download kotlin precross artifacts |
| 209 | uses: actions/download-artifact@v3 |
| 210 | with: |
| 211 | name: kotlin-precross |
| 212 | path: lib/kotlin |
| 213 | |
| 214 | - name: Set back executable flags |
| 215 | run: | |
| 216 | chmod a+x \ |
| 217 | lib/java/build/run* \ |
| 218 | lib/kotlin/cross-test-client/build/install/TestClient/bin/* \ |
| 219 | lib/kotlin/cross-test-server/build/install/TestServer/bin/* |
| 220 | |
| 221 | - name: Run cross test |
| 222 | env: |
| 223 | THRIFT_CROSSTEST_CONCURRENCY: 4 |
| 224 | PRECROSS_LANGS: java,kotlin |
| 225 | run: | |
| 226 | python test/test.py \ |
| 227 | --retry-count 5 \ |
| 228 | --skip-known-failures \ |
| 229 | --server $PRECROSS_LANGS \ |
| 230 | --client $PRECROSS_LANGS |
| 231 | |
| 232 | - name: Upload log files from failed cross test runs |
| 233 | uses: actions/upload-artifact@v3 |
| 234 | if: failure() |
| 235 | with: |
| 236 | name: cross-test-log |
| 237 | path: test/log/ |
| 238 | retention-days: 3 |