-
Notifications
You must be signed in to change notification settings - Fork 1
/
ci.sh
executable file
·73 lines (60 loc) · 2.21 KB
/
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
#!/usr/bin/env bash
set -eux
readonly ARCH=$(uname -m)
readonly OS=$(uname -s)
if [ "${OS}" = "Linux" ]; then
if [ "${ARCH}" = "x86_64" ]; then
# linux x86_64
# config apt to install google chrome
sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
sudo wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo apt update
sudo apt install cmake clang-format valgrind libcurl3-nss libcurl4-nss-dev google-chrome-stable
pip3 install --user cpp-coveralls
# check format
make format-code
diffs=$(git diff | wc -l)
if [ "$diffs" -ne 0 ]; then
exit 1
fi
make build BUILD_TYPE=Release
make clean
make build BUILD_TYPE=Debug WITH_TEST=ON WITH_SAMPLE=ON WITH_COVERAGE=ON TEST_TIMEOUT=600
sudo sysctl -w net.core.rmem_max=2500000
make test CTEST_ARGS="--output-on-failure -T memcheck --overwrite MemoryCheckCommandOptions=\"--error-exitcode=1 --leak-check=full --suppressions=$(pwd)/valgrind.supp\""
export PATH=$PATH:$(python3 -m site --user-base)/bin
coveralls -b ./build/linux_x86_64/test/CMakeFiles/colonio_test.dir/__/ -i src -e src/js -E '.*\.pb\.h' -E '.*\.pb\.cc' --gcov-options '\-lp'
exit 0
elif [ "${ARCH}" = "aarch64" ]; then
# linux aarch64
sudo apt install cmake
make build BUILT_TYPE=Release
make clean
make build BUILT_TYPE=Debug WITH_TEST=ON TEST_TIMEOUT=600
make setup-protoc
make test CTEST_ARGS='--output-on-failure'
exit 0
fi
elif [ "${OS}" = "Darwin" ]; then
# macos x86_64
brew update
# workaround to install python for macos
# https://github.com/ledger/ledger/pull/2161
brew list -1 | grep python | while read formula; do brew unlink ${formula}; brew link --overwrite ${formula}; done
brew upgrade
if [ -d ci_cache/local ]; then
cp -a ci_cache/local local
make setup SKIP_SETUP_LOCAL=ON
else
make setup
fi
make build BUILT_TYPE=Release
make clean
make build BUILT_TYPE=Debug WITH_TEST=ON TEST_TIMEOUT=600
make test CTEST_ARGS='--output-on-failure'
mkdir -p ci_cache
cp -a local ci_cache/local
exit 0
fi
echo "Unsupported environemnt. ARCH=${ARCH} OS=${OS}"
exit 1