blob: d3dc5d03129acb7e54a9b8a1c64b12bdb74c4eaf [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
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