blob: b615060a8aa8387151afd5f808f304d15f24aea8 [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
Jiayu Liu6a61c4e2022-04-29 01:25:39 +080012jobs:
13 # TODO windows and macos
Jiayu Liuc77d91a2022-05-03 20:55:50 +080014 compiler:
Jiayu Liu6a61c4e2022-04-29 01:25:39 +080015 strategy:
Jiayu Liuc77d91a2022-05-03 20:55:50 +080016 matrix:
17 os: [ubuntu-18.04, ubuntu-20.04]
Jiayu Liu6a61c4e2022-04-29 01:25:39 +080018 runs-on: ${{ matrix.os }}
19 steps:
20 - uses: actions/checkout@v3
21
22 - name: Install dependencies
23 run: |
Jiayu Liu6a61c4e2022-04-29 01:25:39 +080024 sudo apt-get update -yq
Jiayu Liuab83ffc2022-05-10 01:56:30 +080025 sudo apt-get install -y --no-install-recommends g++ $BUILD_DEPS
Jiayu Liu6a61c4e2022-04-29 01:25:39 +080026
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 Liuc77d91a2022-05-03 20:55:50 +080041
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:
Jiayu Liu8a321562022-09-06 08:57:19 +080055 GRADLE_VERSION: 7.5.1
Jiayu Liuc77d91a2022-05-03 20:55:50 +080056 steps:
57 - uses: actions/checkout@v3
58
59 - uses: actions/setup-java@v3
60 with:
61 distribution: temurin
62 java-version: 11
Jiayu Liubcac9782022-05-07 08:35:09 +080063 cache: "gradle"
Jiayu Liuc77d91a2022-05-03 20:55:50 +080064
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
Jiayu Liu8a321562022-09-06 08:57:19 +080074 (echo "f6b8596b10cce501591e92f229816aa4046424f3b24d771751b06779d58c8ec4 /tmp/gradle-$GRADLE_VERSION-bin.zip" | sha256sum -c -)
Jiayu Liuc77d91a2022-05-03 20:55:50 +080075 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 Liubcac9782022-05-07 08:35:09 +080080 - name: Run spotlessCheck for Java
Jiayu Liu53ec0822022-05-06 12:56:42 +080081 run: |
82 cd lib/java
83 gradle spotlessCheck
84
Jiayu Liubcac9782022-05-07 08:35:09 +080085 - name: Run ktfmtCheck for Kotlin
86 run: |
87 cd lib/kotlin
88 gradle ktfmtCheck
89
Jiayu Liuc77d91a2022-05-03 20:55:50 +080090 - 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 Liubcac9782022-05-07 08:35:09 +0800131 - name: Run make for java
Jiayu Liuc77d91a2022-05-03 20:55:50 +0800132 run: make -C lib/java
133
Jiayu Liu5b158382022-05-12 00:20:37 +0800134 # this will invoke publishToMavenLocal and install locally
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800135 - name: Run make install for java
136 run: make -C lib/java install
137
138 - name: Upload java libthrift artifacts
139 uses: actions/upload-artifact@v3
140 with:
141 name: libthrift
142 if-no-files-found: error
143 path: ~/.m2/repository/org/apache/thrift
144
Jiayu Liubcac9782022-05-07 08:35:09 +0800145 - name: Run make check for java
146 run: make -C lib/java check
147
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800148 - name: Run make precross for java
149 run: make -C lib/java precross
150
151 - name: Upload java precross artifacts
152 uses: actions/upload-artifact@v3
153 with:
154 name: java-precross
155 if-no-files-found: error
156 path: |
157 lib/java/build/functionalTestJar/
158 lib/java/build/runclient
159 lib/java/build/runnonblockingserver
160 lib/java/build/runserver
161 lib/java/build/runservletserver
162 retention-days: 3
163
Jiayu Liubcac9782022-05-07 08:35:09 +0800164 - name: Run make for kotlin
Jiayu Liuc77d91a2022-05-03 20:55:50 +0800165 run: make -C lib/kotlin
Jiayu Liubcac9782022-05-07 08:35:09 +0800166
167 - name: Run make check for kotlin
168 run: make -C lib/kotlin check
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800169
170 - name: Run make precross for kotlin
171 run: make -C lib/kotlin precross
172
173 - name: Upload kotlin precross artifacts
174 uses: actions/upload-artifact@v3
175 with:
176 name: kotlin-precross
177 if-no-files-found: error
178 path: |
179 lib/kotlin/cross-test-client/build/install/TestClient/
180 lib/kotlin/cross-test-server/build/install/TestServer/
181 retention-days: 3
182
183 cross-test:
184 needs:
185 - lib-java-kotlin
186 runs-on: ubuntu-20.04
187 steps:
188 - uses: actions/checkout@v3
189 - uses: actions/setup-python@v3
190 with:
191 python-version: "3.x"
192 - uses: actions/setup-java@v3
193 with:
194 distribution: temurin
195 # here we intentionally use java 8 so that we also verify java 11 compiles to version 8
196 java-version: 8
197 cache: "gradle"
198
199 - name: Download java precross artifacts
200 uses: actions/download-artifact@v3
201 with:
202 name: java-precross
203 path: lib/java/build
204
205 - name: Download kotlin precross artifacts
206 uses: actions/download-artifact@v3
207 with:
208 name: kotlin-precross
209 path: lib/kotlin
210
211 - name: Set back executable flags
212 run: |
213 chmod a+x \
214 lib/java/build/run* \
215 lib/kotlin/cross-test-client/build/install/TestClient/bin/* \
216 lib/kotlin/cross-test-server/build/install/TestServer/bin/*
217
218 - name: Run cross test
219 env:
220 THRIFT_CROSSTEST_CONCURRENCY: 4
221 PRECROSS_LANGS: java,kotlin
222 run: |
223 python test/test.py \
224 --retry-count 5 \
225 --skip-known-failures \
226 --server $PRECROSS_LANGS \
227 --client $PRECROSS_LANGS
228
229 - name: Upload log files from failed cross test runs
230 uses: actions/upload-artifact@v3
231 if: failure()
232 with:
233 name: cross-test-log
234 path: test/log/
235 retention-days: 3