Skip to content

Merge pull request #203 from taosdata/enh/sunpeng/TD-25291-add-begin-… #145

Merge pull request #203 from taosdata/enh/sunpeng/TD-25291-add-begin-…

Merge pull request #203 from taosdata/enh/sunpeng/TD-25291-add-begin-… #145

name: Test on Ubuntu-20.04
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test:
runs-on: ubuntu-20.04
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Build tools
run: |
sudo apt-get update -y
sudo apt-get install -y build-essential cmake libgeos-dev git libssl-dev libgflags2.2 libgflags-dev libsnappy-dev libjansson-dev
- name: Set up python
run: |
python --version
- name: Cache Poetry
id: cache-poetry
uses: actions/[email protected]
with:
path: ~/.poetry
key: ubuntu-20.04-poetry
#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
#----------------------------------------------
# install your root project, if required
#----------------------------------------------
- name: Install library
run: poetry install --no-interaction
#----------------------------------------------
# build your TDengine 3.0
#----------------------------------------------
- name: Determine TDengine branch
uses: haya14busa/action-cond@v1
id: determine-branch
with:
cond: ${{ github.base_ref == 'main' }}
if_true: 'main'
if_false: '3.0'
- name: Checkout tdengine
uses: actions/checkout@v2
with:
repository: "taosdata/TDengine"
path: "TDengine_v3"
ref: ${{ steps.determine-branch.outputs.value }}
- name: Build TDengine 3.0
run: |
cd TDengine_v3
mkdir build
cd build
cmake ../ -DBUILD_JDBC=false -DBUILD_TOOLS=true -DCMAKE_INSTALL_PREFIX:PATH=`realpath ../../local/` -DBUILD_HTTP=false
make -j4
sudo make install
ls -alh /etc/taos/
cd ../../
- name: Start TDengine 3.0
run: |
tree TDengine_v3/build/build/
export C_INCLUDE_PATH=$PWD/TDengine_v3/build/build/bin
export LD_LIBRARY_PATH=$PWD/TDengine_v3/build/build/lib
mkdir -p /tmp/taos/v3/log /tmp/taos/v3/data
printf "dataDir /tmp/taos/v3/data\nlogDir /tmp/taos/v3/log\ndebugFlag 135\n" |sudo tee /etc/taos/taos.cfg
TAOS_SUPPORT_VNODES=256 ./TDengine_v3/build/build/bin/taosd &
./TDengine_v3/build/build/bin/taosadapter &
#----------------------------------------------
# run test suite
#----------------------------------------------
- name: Test 3.0
run: |
export LD_LIBRARY_PATH=$PWD/TDengine_v3/build/build/lib
#source $VENV
export TDENGINE_URL=localhost:6041
curl -L -H "Authorization: Basic cm9vdDp0YW9zZGF0YQ==" -d "show databases" localhost:6041/rest/sql
poetry run pip install psutil pandas pytest-cov
poetry run pytest --cov-report term --cov-report html --cov-report xml --cov=taos --cov=taosrest --cov-append tests
- name: Test examples 3.0
run: |
cd examples || ls -l
pip3 install .. > /dev/null || echo "failed to install taospy from source code"
pip3 install taos-ws-py > /dev/null || echo "failed to install taos-ws-py"
pip3 install pandas sqlalchemy > /dev/null || echo "failed to install pandas"
taosBenchmark -d power -t 10 -n 10 -y
for i in `find . -name "*.py" \
|grep -Ev "cloud|trades|v2|websocket_with_req_id|tmq_consumer|rest_cursor|rest_client.py|import-json|connect_rest_examples|schemaless_insert"`; \
do printf "$i " && python $i > /dev/null \
&& echo -e "\033[32m $i success! \033[0m" \
| tee -a ~/examples-success.txt \
|| echo -e "\033[31m $i failed! \033[0m" \
| tee -a ~/examples-failed.txt; \
done
- name: 'Upload taosd logs'
if: failure()
uses: actions/upload-artifact@v3
with:
name: log-v3-taosd
path: /tmp/taos/v3/log/
retention-days: 1
- name: Check Test Result
run: |
if [ -f ~/examples-failed.txt ]; then
cat ~/examples-failed.txt
exit 1
elif [ -f ~/examples-success.txt ]; then
cat ~/examples-success.txt
fi