Skip to content

Commit 2b59e6e

Browse files
committed
test: add macosx into jobs
1 parent 8d13c48 commit 2b59e6e

File tree

4 files changed

+24
-20
lines changed

4 files changed

+24
-20
lines changed

.github/workflows/test.yaml

+8-4
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,18 @@ on:
88

99
jobs:
1010
test:
11-
runs-on: ubuntu-latest
12-
name: CPP
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
os: [ubuntu-latest, windows-latest, macosx-latest]
15+
runs-on: ${{ matrix.os }}
1316
env:
1417
CPLUS_INCLUDE_PATH: "/usr/local/include/:/usr/include/jsoncpp/:/usr/local/opt/openssl/include/:/usr/lib/"
1518
steps:
1619
- uses: actions/checkout@v3
17-
- run: sudo apt-get install lcov libcurl4-openssl-dev libssl-dev uuid-dev libjson-c-dev libjsoncpp-dev nodejs npm
20+
- if: ${{ matrix.os == 'ubuntu-latest' }}
21+
run: sudo apt-get install lcov libcurl4-openssl-dev libssl-dev uuid-dev libjson-c-dev libjsoncpp-dev nodejs npm
1822
- run: bash ./unit_test.sh
19-
- run: bash ./generate_code_cov.sh
23+
- run: bash ./generate_code_cov.sh
2024
- run: bash ./function_test.sh
2125
- run: bash <(curl -s https://codecov.io/bash)

easyinstall.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ if command -v python > /dev/null ; then
77
MAKE="make -j $(python -c 'import multiprocessing as mp; print(int(mp.cpu_count()))')"
88
fi
99

10-
echo $MAKE
10+
echo "$MAKE"
1111

1212
rm -rf sdk_build
1313
mkdir sdk_build
14-
cd sdk_build
14+
cd sdk_build || exit
1515
cmake -DBUILD_PRODUCT="$product" -DBUILD_FUNCTION_TESTS=OFF -DBUILD_UNIT_TESTS=OFF -DENABLE_COVERAGE=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr ..
1616
$MAKE
1717

function_test.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
#!/bin/bash
22

3-
cd `dirname $0`
3+
cd $(dirname "$0") || exit
44
echo '-------build function test----------'
55

66
MAKE=make
77
if command -v python > /dev/null ; then
88
MAKE="make -j $(python -c 'import multiprocessing as mp; print(int(mp.cpu_count()))')"
99
fi
1010

11-
echo $MAKE
11+
echo "$MAKE"
1212

1313
FT_BUILD_DIR=ft_build
1414
rm -rf $FT_BUILD_DIR
1515
mkdir $FT_BUILD_DIR
16-
cd $FT_BUILD_DIR
16+
cd $FT_BUILD_DIR || exit
1717
cmake -DBUILD_FUNCTION_TESTS=ON -DBUILD_UNIT_TESTS=OFF ..
1818
$MAKE cdn core cs ecs rds slb vpc cdn_ft core_ft cs_ft ecs_ft nlp_ft rds_ft slb_ft vpc_ft
1919

unit_test.sh

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,44 @@
11
#!/bin/bash
22

3-
cd `dirname $0`
3+
cd $(dirname "$0") || exit
44
echo '-------build unit test----------'
55

66
echo 'start a test http server'
7-
NODE=`which nodejs`
7+
NODE=$(which nodejs)
88

99
if [ "$NODE" ]
1010
then
1111
echo ''
1212
else
13-
NODE=`which node`
13+
NODE=$(which node)
1414
fi
1515

16-
echo 'node binary path: ' $NODE
16+
echo 'node binary path: ' "$NODE"
1717

18-
server=`ps -ef | grep http_test_server | grep -v grep`
19-
echo "check server: " $server
18+
server=$(ps -ef | grep http_test_server | grep -v grep)
19+
echo "check server: " "$server"
2020
if [ "$server" ]
2121
then
2222
echo "server is on"
2323
else
2424
echo "server is off, start it"
25-
cd test/httpserver
25+
cd test/httpserver || exit
2626
npm i
27-
nohup $NODE http_test_server.js &
28-
cd -
27+
nohup "$NODE" http_test_server.js &
28+
cd - || exit
2929
fi
3030

3131
MAKE=make
3232
if command -v python > /dev/null ; then
3333
MAKE="make -j $(python -c 'import multiprocessing as mp; print(int(mp.cpu_count()))')"
3434
fi
3535

36-
echo $MAKE
36+
echo "$MAKE"
3737

3838
UT_BUILD_DIR=ut_build
3939
rm -rf $UT_BUILD_DIR
4040
mkdir $UT_BUILD_DIR
41-
cd $UT_BUILD_DIR
41+
cd $UT_BUILD_DIR || exit
4242
cmake -DBUILD_FUNCTION_TESTS=OFF -DBUILD_UNIT_TESTS=ON -DENABLE_COVERAGE=ON ..
4343
$MAKE core_ut
4444

0 commit comments

Comments
 (0)