forked from apache/fury
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_ci.sh
executable file
·276 lines (264 loc) · 8.21 KB
/
run_ci.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
set -e
set -x
ROOT="$(git rev-parse --show-toplevel)"
echo "Root path: $ROOT, home path: $HOME"
cd "$ROOT"
install_python() {
wget -q https://repo.anaconda.com/miniconda/Miniconda3-py38_23.5.2-0-Linux-x86_64.sh -O Miniconda3.sh
bash Miniconda3.sh -b -p $HOME/miniconda && rm -f miniconda.*
which python
echo "Python version $(python -V), path $(which python)"
}
install_pyfury() {
echo "Python version $(python -V), path $(which python)"
"$ROOT"/ci/deploy.sh install_pyarrow
pip install Cython wheel numpy pytest
pushd "$ROOT/python"
pip list
export PATH=~/bin:$PATH
echo "Install pyfury"
# Fix strange installed deps not found
pip install setuptools
pip install -v -e .
popd
}
install_bazel() {
if command -v bazel >/dev/null; then
echo "existing bazel location $(which bazel)"
echo "existing bazel version $(bazel version)"
fi
# GRPC support bazel 6.3.2 https://grpc.github.io/grpc/core/md_doc_bazel_support.html
UNAME_OUT="$(uname -s)"
case "${UNAME_OUT}" in
Linux*) MACHINE=linux;;
Darwin*) MACHINE=darwin;;
*) echo "unknown machine: $UNAME_OUT"
esac
URL="https://github.com/bazelbuild/bazel/releases/download/6.3.2/bazel-6.3.2-installer-$MACHINE-x86_64.sh"
wget -q -O install.sh $URL
chmod +x install.sh
set +x
./install.sh --user
source ~/.bazel/bin/bazel-complete.bash
set -x
export PATH=~/bin:$PATH
echo "$HOME/bin/bazel version: $(~/bin/bazel version)"
rm -f install.sh
VERSION=`bazel version`
echo "bazel version: $VERSION"
if [[ "$MACHINE" == linux ]]; then
MEM=`cat /proc/meminfo | grep MemTotal | awk '{print $2}'`
JOBS=`expr $MEM / 1024 / 1024 / 3`
echo "build --jobs="$JOBS >> ~/.bazelrc
grep "jobs" ~/.bazelrc
fi
}
JDKS=(
"zulu21.28.85-ca-jdk21.0.0-linux_x64"
"zulu17.44.17-ca-crac-jdk17.0.8-linux_x64"
"zulu15.46.17-ca-jdk15.0.10-linux_x64"
"zulu13.54.17-ca-jdk13.0.14-linux_x64"
"zulu11.66.15-ca-jdk11.0.20-linux_x64"
"zulu8.72.0.17-ca-jdk8.0.382-linux_x64"
)
install_jdks() {
cd "$ROOT"
for jdk in "${JDKS[@]}"; do
wget -q https://cdn.azul.com/zulu/bin/"$jdk".tar.gz -O "$jdk".tar.gz
tar zxf "$jdk".tar.gz
done
}
graalvm_test() {
cd "$ROOT"/java
mvn -T10 -B --no-transfer-progress clean install -DskipTests
echo "Start to build graalvm native image"
cd "$ROOT"/integration_tests/graalvm_tests
mvn -DskipTests=true --no-transfer-progress -Pnative package
echo "Built graalvm native image"
echo "Start to run graalvm native image"
./target/main
echo "Execute graalvm tests succeed!"
}
integration_tests() {
cd "$ROOT"/java
mvn -T10 -B --no-transfer-progress clean install -DskipTests
echo "benchmark tests"
cd "$ROOT"/java/benchmark
mvn -T10 -B --no-transfer-progress clean test install -Pjmh
echo "Start latest jdk tests"
cd "$ROOT"/integration_tests/latest_jdk_tests
echo "latest_jdk_tests: JDK 21"
export JAVA_HOME="$ROOT/zulu21.28.85-ca-jdk21.0.0-linux_x64"
export PATH=$JAVA_HOME/bin:$PATH
mvn -T10 -B --no-transfer-progress clean test
echo "Start JPMS tests"
cd "$ROOT"/integration_tests/jpms_tests
mvn -T10 -B --no-transfer-progress clean compile
echo "Start jdk compatibility tests"
cd "$ROOT"/integration_tests/jdk_compatibility_tests
mvn -T10 -B --no-transfer-progress clean test
for jdk in "${JDKS[@]}"; do
export JAVA_HOME="$ROOT/$jdk"
export PATH=$JAVA_HOME/bin:$PATH
echo "First round for generate data: ${jdk}"
mvn -T10 --no-transfer-progress clean test -Dtest=org.apache.fury.integration_tests.JDKCompatibilityTest
done
for jdk in "${JDKS[@]}"; do
export JAVA_HOME="$ROOT/$jdk"
export PATH=$JAVA_HOME/bin:$PATH
echo "Second round for compatibility: ${jdk}"
mvn -T10 --no-transfer-progress clean test -Dtest=org.apache.fury.integration_tests.JDKCompatibilityTest
done
}
jdk17_plus_tests() {
java -version
echo "Executing fury java tests"
cd "$ROOT/java"
set +e
mvn -T10 --batch-mode --no-transfer-progress test install -pl '!fury-format,!fury-testsuite'
testcode=$?
if [[ $testcode -ne 0 ]]; then
exit $testcode
fi
echo "Executing fury java tests succeeds"
echo "Executing latest_jdk_tests"
cd "$ROOT"/integration_tests/latest_jdk_tests
mvn -T10 -B --no-transfer-progress clean test
echo "Executing latest_jdk_tests succeeds"
}
case $1 in
java8)
echo "Executing fury java tests"
cd "$ROOT/java"
set +e
mvn -T16 --batch-mode --no-transfer-progress test
testcode=$?
if [[ $testcode -ne 0 ]]; then
exit $testcode
fi
echo "Executing fury java tests succeeds"
;;
java11)
java -version
echo "Executing fury java tests"
cd "$ROOT/java"
set +e
mvn -T16 --batch-mode --no-transfer-progress test
testcode=$?
if [[ $testcode -ne 0 ]]; then
exit $testcode
fi
echo "Executing fury java tests succeeds"
;;
java17)
jdk17_plus_tests
;;
java21)
jdk17_plus_tests
;;
integration_tests)
echo "Install jdk"
install_jdks
echo "Executing fury integration tests"
integration_tests
echo "Executing fury integration tests succeeds"
;;
javascript)
set +e
echo "Executing fury javascript tests"
cd "$ROOT/javascript"
npm install
node ./node_modules/.bin/jest --ci --reporters=default --reporters=jest-junit
testcode=$?
if [[ $testcode -ne 0 ]]; then
echo "Executing fury javascript tests failed"
exit $testcode
fi
echo "Executing fury javascript tests succeeds"
;;
rust)
set -e
rustup component add clippy-preview
rustup component add rustfmt
echo "Executing fury rust tests"
cd "$ROOT/rust"
cargo doc --no-deps --document-private-items --all-features --open
cargo fmt --all -- --check
cargo fmt --all
cargo clippy --workspace --all-features --all-targets
cargo doc
cargo build --all-features --all-targets
cargo test
testcode=$?
if [[ $testcode -ne 0 ]]; then
echo "Executing fury rust tests failed"
exit $testcode
fi
cargo clean
echo "Executing fury rust tests succeeds"
;;
cpp)
echo "Install pyarrow"
"$ROOT"/ci/deploy.sh install_pyarrow
export PATH=~/bin:$PATH
echo "bazel version: $(bazel version)"
set +e
echo "Executing fury c++ tests"
bazel test $(bazel query //...)
testcode=$?
if [[ $testcode -ne 0 ]]; then
echo "Executing fury c++ tests failed"
exit $testcode
fi
echo "Executing fury c++ tests succeeds"
;;
python)
install_pyfury
pip install pandas
cd "$ROOT/python"
echo "Executing fury python tests"
pytest -v -s --durations=60 pyfury/tests
testcode=$?
if [[ $testcode -ne 0 ]]; then
exit $testcode
fi
echo "Executing fury python tests succeeds"
;;
go)
echo "Executing fury go tests for go"
cd "$ROOT/go/fury"
go test -v
echo "Executing fury go tests succeeds"
;;
format)
echo "Install format tools"
pip install black==22.1.0 flake8==3.9.1 flake8-quotes flake8-bugbear click==8.0.2
echo "Executing format check"
bash ci/format.sh
cd "$ROOT/java"
mvn -T10 -B --no-transfer-progress spotless:check
mvn -T10 -B --no-transfer-progress checkstyle:check
echo "Executing format check succeeds"
;;
*)
echo "Execute command $*"
"$@"
;;
esac