test: add macosx into jobs
This commit is contained in:
16
.github/workflows/test.yaml
vendored
16
.github/workflows/test.yaml
vendored
@@ -8,14 +8,22 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
strategy:
|
||||||
name: CPP
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, macosx-latest]
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
env:
|
env:
|
||||||
CPLUS_INCLUDE_PATH: "/usr/local/include/:/usr/include/jsoncpp/:/usr/local/opt/openssl/include/:/usr/lib/"
|
CPLUS_INCLUDE_PATH: "/usr/local/include/:/usr/include/jsoncpp/:/usr/local/opt/openssl/include/:/usr/lib/"
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- run: sudo apt-get install lcov libcurl4-openssl-dev libssl-dev uuid-dev libjson-c-dev libjsoncpp-dev nodejs npm
|
|
||||||
|
- if: ${{ matrix.os == 'ubuntu-latest' }}
|
||||||
|
run: sudo apt-get install lcov libcurl4-openssl-dev libssl-dev uuid-dev libjson-c-dev libjsoncpp-dev nodejs npm
|
||||||
|
- if: ${{ matrix.os == 'macosx-latest' }}
|
||||||
|
run: brew install lcov libcurl4-openssl-dev libssl-dev uuid-dev libjson-c-dev libjsoncpp-dev nodejs npm
|
||||||
|
|
||||||
- run: bash ./unit_test.sh
|
- run: bash ./unit_test.sh
|
||||||
- run: bash ./generate_code_cov.sh
|
- run: bash ./generate_code_cov.sh
|
||||||
- run: bash ./function_test.sh
|
- run: bash ./function_test.sh
|
||||||
- run: bash <(curl -s https://codecov.io/bash)
|
- run: bash <(curl -s https://codecov.io/bash)
|
||||||
|
|||||||
@@ -7,11 +7,11 @@ if command -v python > /dev/null ; then
|
|||||||
MAKE="make -j $(python -c 'import multiprocessing as mp; print(int(mp.cpu_count()))')"
|
MAKE="make -j $(python -c 'import multiprocessing as mp; print(int(mp.cpu_count()))')"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo $MAKE
|
echo "$MAKE"
|
||||||
|
|
||||||
rm -rf sdk_build
|
rm -rf sdk_build
|
||||||
mkdir sdk_build
|
mkdir sdk_build
|
||||||
cd sdk_build
|
cd sdk_build || exit
|
||||||
cmake -DBUILD_PRODUCT="$product" -DBUILD_FUNCTION_TESTS=OFF -DBUILD_UNIT_TESTS=OFF -DENABLE_COVERAGE=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr ..
|
cmake -DBUILD_PRODUCT="$product" -DBUILD_FUNCTION_TESTS=OFF -DBUILD_UNIT_TESTS=OFF -DENABLE_COVERAGE=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr ..
|
||||||
$MAKE
|
$MAKE
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
cd `dirname $0`
|
cd $(dirname "$0") || exit
|
||||||
echo '-------build function test----------'
|
echo '-------build function test----------'
|
||||||
|
|
||||||
MAKE=make
|
MAKE=make
|
||||||
@@ -8,12 +8,12 @@ if command -v python > /dev/null ; then
|
|||||||
MAKE="make -j $(python -c 'import multiprocessing as mp; print(int(mp.cpu_count()))')"
|
MAKE="make -j $(python -c 'import multiprocessing as mp; print(int(mp.cpu_count()))')"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo $MAKE
|
echo "$MAKE"
|
||||||
|
|
||||||
FT_BUILD_DIR=ft_build
|
FT_BUILD_DIR=ft_build
|
||||||
rm -rf $FT_BUILD_DIR
|
rm -rf $FT_BUILD_DIR
|
||||||
mkdir $FT_BUILD_DIR
|
mkdir $FT_BUILD_DIR
|
||||||
cd $FT_BUILD_DIR
|
cd $FT_BUILD_DIR || exit
|
||||||
cmake -DBUILD_FUNCTION_TESTS=ON -DBUILD_UNIT_TESTS=OFF ..
|
cmake -DBUILD_FUNCTION_TESTS=ON -DBUILD_UNIT_TESTS=OFF ..
|
||||||
$MAKE cdn core cs ecs rds slb vpc cdn_ft core_ft cs_ft ecs_ft nlp_ft rds_ft slb_ft vpc_ft
|
$MAKE cdn core cs ecs rds slb vpc cdn_ft core_ft cs_ft ecs_ft nlp_ft rds_ft slb_ft vpc_ft
|
||||||
|
|
||||||
|
|||||||
22
unit_test.sh
22
unit_test.sh
@@ -1,31 +1,31 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
cd `dirname $0`
|
cd $(dirname "$0") || exit
|
||||||
echo '-------build unit test----------'
|
echo '-------build unit test----------'
|
||||||
|
|
||||||
echo 'start a test http server'
|
echo 'start a test http server'
|
||||||
NODE=`which nodejs`
|
NODE=$(which nodejs)
|
||||||
|
|
||||||
if [ "$NODE" ]
|
if [ "$NODE" ]
|
||||||
then
|
then
|
||||||
echo ''
|
echo ''
|
||||||
else
|
else
|
||||||
NODE=`which node`
|
NODE=$(which node)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo 'node binary path: ' $NODE
|
echo 'node binary path: ' "$NODE"
|
||||||
|
|
||||||
server=`ps -ef | grep http_test_server | grep -v grep`
|
server=$(ps -ef | grep http_test_server | grep -v grep)
|
||||||
echo "check server: " $server
|
echo "check server: " "$server"
|
||||||
if [ "$server" ]
|
if [ "$server" ]
|
||||||
then
|
then
|
||||||
echo "server is on"
|
echo "server is on"
|
||||||
else
|
else
|
||||||
echo "server is off, start it"
|
echo "server is off, start it"
|
||||||
cd test/httpserver
|
cd test/httpserver || exit
|
||||||
npm i
|
npm i
|
||||||
nohup $NODE http_test_server.js &
|
nohup "$NODE" http_test_server.js &
|
||||||
cd -
|
cd - || exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
MAKE=make
|
MAKE=make
|
||||||
@@ -33,12 +33,12 @@ if command -v python > /dev/null ; then
|
|||||||
MAKE="make -j $(python -c 'import multiprocessing as mp; print(int(mp.cpu_count()))')"
|
MAKE="make -j $(python -c 'import multiprocessing as mp; print(int(mp.cpu_count()))')"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo $MAKE
|
echo "$MAKE"
|
||||||
|
|
||||||
UT_BUILD_DIR=ut_build
|
UT_BUILD_DIR=ut_build
|
||||||
rm -rf $UT_BUILD_DIR
|
rm -rf $UT_BUILD_DIR
|
||||||
mkdir $UT_BUILD_DIR
|
mkdir $UT_BUILD_DIR
|
||||||
cd $UT_BUILD_DIR
|
cd $UT_BUILD_DIR || exit
|
||||||
cmake -DBUILD_FUNCTION_TESTS=OFF -DBUILD_UNIT_TESTS=ON -DENABLE_COVERAGE=ON ..
|
cmake -DBUILD_FUNCTION_TESTS=OFF -DBUILD_UNIT_TESTS=ON -DENABLE_COVERAGE=ON ..
|
||||||
$MAKE core_ut
|
$MAKE core_ut
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user