blob: d1afc33837e454c1385f66b83ef46a7009bdff15 [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:
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 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
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 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 Liuab83ffc2022-05-10 01:56:30 +0800134 - 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 Liubcac9782022-05-07 08:35:09 +0800144 - name: Run make check for java
145 run: make -C lib/java check
146
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800147 - 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 Liubcac9782022-05-07 08:35:09 +0800163 - name: Run make for kotlin
Jiayu Liuc77d91a2022-05-03 20:55:50 +0800164 run: make -C lib/kotlin
Jiayu Liubcac9782022-05-07 08:35:09 +0800165
166 - name: Run make check for kotlin
167 run: make -C lib/kotlin check
Jiayu Liuab83ffc2022-05-10 01:56:30 +0800168
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