taos-connector-python merge main to 3.0 and modify stmt2_get_fields interface #844
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test on macOS | |
on: | |
push: | |
branches: | |
- 'main' | |
- '3.0' | |
pull_request: | |
branches: | |
- 'main' | |
- '3.0' | |
workflow_dispatch: | |
inputs: | |
tdengine_branch: | |
description: 'TDengine branch' | |
required: true | |
type: string | |
jobs: | |
build-tdengine: | |
runs-on: macos-latest | |
outputs: | |
commit_id: ${{ steps.get_commit_id.outputs.commit_id }} | |
steps: | |
- name: Checkout TDengine | |
if: | | |
github.event_name == 'pull_request' | |
|| github.event_name == 'push' | |
|| github.event_name == 'schedule' | |
uses: actions/checkout@v4 | |
with: | |
repository: 'taosdata/TDengine' | |
path: 'TDengine' | |
ref: ${{ github.event.pull_request.base.ref }} | |
- name: get_commit_id | |
id: get_commit_id | |
run: | | |
cd TDengine | |
echo "commit_id=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT | |
- name: Cache server by pr | |
if: github.event_name == 'pull_request' | |
id: cache-server-pr | |
uses: actions/cache@v4 | |
with: | |
path: server.tar.gz | |
key: ${{ runner.os }}-build-${{ github.base_ref }}-${{ steps.get_commit_id.outputs.commit_id }} | |
- name: Cache server by push | |
if: github.event_name == 'push' | |
id: cache-server-push | |
uses: actions/cache@v4 | |
with: | |
path: server.tar.gz | |
key: ${{ runner.os }}-build-${{ github.ref_name }}-${{ steps.get_commit_id.outputs.commit_id }} | |
- name: Cache server manually | |
if: github.event_name == 'workflow_dispatch' | |
id: cache-server-manually | |
uses: actions/cache@v4 | |
with: | |
path: server.tar.gz | |
key: ${{ runner.os }}-build-${{ inputs.tdengine_branch }}-${{ steps.get_commit_id.outputs.commit_id }} | |
- name: prepare install | |
if: > | |
(github.event_name == 'workflow_dispatch' && steps.cache-server-manually.outputs.cache-hit != 'true') || | |
(github.event_name == 'pull_request' && steps.cache-server-pr.outputs.cache-hit != 'true') || | |
(github.event_name == 'push' && steps.cache-server-push.outputs.cache-hit != 'true') | |
run: brew install argp-standalone pkgconfig geos | |
- name: Set up homebrew | |
if: | | |
github.event_name == 'pull_request' | |
|| github.event_name == 'push' | |
|| github.event_name == 'schedule' | |
run: | | |
brew update | |
brew install --overwrite argp-standalone pkg-config | |
brew info argp-standalone | |
- name: Set up Go | |
if: | | |
github.event_name == 'pull_request' | |
|| github.event_name == 'push' | |
|| github.event_name == 'schedule' | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.18 | |
- name: Set up Rust | |
if: | | |
github.event_name == 'pull_request' | |
|| github.event_name == 'push' | |
|| github.event_name == 'schedule' | |
uses: actions-rs/[email protected] | |
with: | |
toolchain: stable | |
- name: install TDengine | |
if: > | |
(github.event_name == 'workflow_dispatch' && steps.cache-server-manually.outputs.cache-hit != 'true') || | |
(github.event_name == 'pull_request' && steps.cache-server-pr.outputs.cache-hit != 'true') || | |
(github.event_name == 'push' && steps.cache-server-push.outputs.cache-hit != 'true') | |
run: | | |
cd TDengine | |
mkdir debug | |
cd debug | |
cmake .. -DBUILD_TEST=off -DBUILD_HTTP=false -DBUILD_DEPENDENCY_TESTS=false -DVERNUMBER=3.9.9.9 | |
make -j 14 install | |
echo "do make_install grep libtao" | |
pwd | |
ls /usr/local/lib | grep libtao | |
- name: package | |
if: > | |
(github.event_name == 'workflow_dispatch' && steps.cache-server-manually.outputs.cache-hit != 'true') || | |
(github.event_name == 'pull_request' && steps.cache-server-pr.outputs.cache-hit != 'true') || | |
(github.event_name == 'push' && steps.cache-server-push.outputs.cache-hit != 'true') | |
run: | | |
mkdir -p ./release | |
cp ./TDengine/debug/build/bin/taos ./release/ | |
cp ./TDengine/debug/build/bin/taosd ./release/ | |
cp ./TDengine/debug/build/bin/taosadapter ./release/ | |
cp ./TDengine/debug/build/lib/libtaos.3.9.9.9.dylib ./release/ | |
cp ./TDengine/include/client/taos.h ./release/ | |
cat >./release/install.sh<<EOF | |
chmod +x ./taos | |
chmod +x ./taosd | |
chmod +x ./taosadapter | |
cp ./taos /usr/local/bin | |
cp ./taosd /usr/local/bin | |
cp ./taosadapter /usr/local/bin | |
cp ./libtaos.3.9.9.9.dylib /usr/local/lib | |
pwd | |
ls /usr/local/lib | grep libtaos | |
ln -sfv /usr/local/lib/libtaos.3.9.9.9.dylib /usr/local/lib/libtaos.1.dylib | |
ln -sfv /usr/local/lib/libtaos.1.dylib /usr/local/lib/libtaos.dylib | |
cp ./taos.h /usr/local/include | |
EOF | |
tar -zcvf server.tar.gz ./release | |
build-poetry: | |
runs-on: macos-latest | |
needs: build-tdengine | |
steps: | |
- name: get cache server by pr | |
if: github.event_name == 'pull_request' | |
id: get-cache-server-pr | |
uses: actions/cache@v4 | |
with: | |
path: server.tar.gz | |
key: ${{ runner.os }}-build-${{ github.base_ref }}-${{ needs.build-tdengine.outputs.commit_id }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ github.base_ref }}- | |
- name: get cache server by push | |
if: github.event_name == 'push' | |
id: get-cache-server-push | |
uses: actions/cache@v4 | |
with: | |
path: server.tar.gz | |
key: ${{ runner.os }}-build-${{ github.ref_name }}-${{ needs.build-tdengine.outputs.commit_id }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ github.ref_name }}- | |
- name: get cache server manually | |
if: github.event_name == 'workflow_dispatch' | |
id: get-cache-server-manually | |
uses: actions/cache@v4 | |
with: | |
path: server.tar.gz | |
key: ${{ runner.os }}-build-${{ inputs.tdengine_branch }}-${{ needs.build-tdengine.outputs.commit_id }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ inputs.tdengine_branch }}- | |
- name: prepare install | |
run: brew install geos | |
- name: install TDengine | |
run: | | |
tar -zxvf server.tar.gz | |
cd release && sudo sh install.sh | |
- name: Checkout Connector | |
uses: actions/checkout@v4 | |
- name: Cache Poetry | |
id: cache-poetry | |
uses: actions/cache@v4 | |
with: | |
path: ~/.poetry | |
key: macos-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@v4 | |
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 connector | |
#---------------------------------------------- | |
- name: Build Artifacts | |
run: | | |
poetry build | |
test: | |
runs-on: macos-latest | |
needs: build-tdengine | |
steps: | |
- name: get cache server by pr | |
if: github.event_name == 'pull_request' | |
id: get-cache-server-pr | |
uses: actions/cache@v4 | |
with: | |
path: server.tar.gz | |
key: ${{ runner.os }}-build-${{ github.base_ref }}-${{ needs.build-tdengine.outputs.commit_id }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ github.base_ref }}- | |
- name: get cache server by push | |
if: github.event_name == 'push' | |
id: get-cache-server-push | |
uses: actions/cache@v4 | |
with: | |
path: server.tar.gz | |
key: ${{ runner.os }}-build-${{ github.ref_name }}-${{ needs.build-tdengine.outputs.commit_id }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ github.ref_name }}- | |
- name: get cache server manually | |
if: github.event_name == 'workflow_dispatch' | |
id: get-cache-server-manually | |
uses: actions/cache@v4 | |
with: | |
path: server.tar.gz | |
key: ${{ runner.os }}-build-${{ inputs.tdengine_branch }}-${{ needs.build-tdengine.outputs.commit_id }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ inputs.tdengine_branch }}- | |
- name: prepare install | |
run: brew install geos | |
- name: install TDengine | |
run: | | |
tar -zxvf server.tar.gz | |
cd release && sudo sh install.sh | |
- name: Checkout Connector | |
uses: actions/checkout@v4 | |
- name: Cache Poetry | |
id: cache-poetry | |
uses: actions/cache@v4 | |
with: | |
path: ~/.poetry | |
key: macos-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@v4 | |
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 | |
- name: Copy taos.cfg | |
run: | | |
sudo mkdir -p /etc/taos | |
sudo cp ./.github/workflows/taos.cfg /etc/taos/taos.cfg | |
- name: Start TDengine | |
run: | | |
export C_INCLUDE_PATH=$PWD/TDengine/build/build/include | |
export LD_LIBRARY_PATH=$PWD/TDengine/build/build/lib | |
mkdir -p /tmp/taos/v3/log /tmp/taos/v3/data | |
sudo taosd & | |
sudo taosadapter & | |
sleep 1 | |
#---------------------------------------------- | |
# run test suite | |
#---------------------------------------------- | |
- name: Test | |
run: | | |
export LD_LIBRARY_PATH=$PWD/TDengine/build/build/lib | |
source $VENV | |
export TDENGINE_URL=localhost:6041 | |
poetry run pip install psutil pandas "numpy<2.0.0" | |
poetry run pytest tests | |
- name: Build Artifacts | |
run: | | |
poetry build |