Skip to content

Commit 270be34

Browse files
authored
ci: add python ws 3.3.6.0 compatibility test (#352)
* ci: change TDengine version from 3.3.6 to main * ci: add python ws compatibility ci * ci: remove redundant step * style: format code * test: fix failed test case * refactor: eliminate warnings and format code
1 parent 5f9c448 commit 270be34

23 files changed

Lines changed: 639 additions & 439 deletions

.github/workflows/build.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,25 @@ name: Build
33
on:
44
push:
55
branches:
6-
- 'main'
7-
- '3.0'
6+
- "main"
7+
- "3.0"
88
pull_request:
99
branches:
10-
- 'main'
11-
- '3.0'
10+
- "main"
11+
- "3.0"
1212

1313
jobs:
1414
test:
1515
runs-on: ubuntu-22.04
1616
steps:
1717
- name: Checkout
1818
uses: actions/checkout@v3
19-
19+
2020
- name: Get CMake
2121
uses: lukka/get-cmake@latest
2222
with:
2323
cmakeVersion: 3.31.6
24-
24+
2525
- name: Build tools
2626
run: |
2727
sudo apt-get update -y
@@ -62,15 +62,15 @@ jobs:
6262
#----------------------------------------------
6363
- name: Install dependencies
6464
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
65-
run: |
65+
run: |
6666
poetry install --no-interaction --no-root
6767
poetry run pip install "numpy<2.0.0"
6868
6969
#----------------------------------------------
7070
# install your root project, if required
7171
#----------------------------------------------
7272
- name: Install library
73-
run: |
73+
run: |
7474
poetry install --no-interaction --with=test
7575
poetry run pip install "numpy<2.0.0"
7676
@@ -84,15 +84,15 @@ jobs:
8484
id: determine-branch
8585
with:
8686
cond: ${{ github.base_ref == 'main' }}
87-
if_true: '3.3.6'
88-
if_false: '3.0'
87+
if_true: "main"
88+
if_false: "3.0"
8989

9090
- name: Checkout tdengine
9191
uses: actions/checkout@v2
9292
with:
9393
repository: "taosdata/TDengine"
9494
path: "TDengine_v3"
95-
ref: ${{ steps.determine-branch.outputs.value }}
95+
ref: ${{ steps.determine-branch.outputs.value }}
9696

9797
- name: Build TDengine 3.0
9898
run: |
@@ -129,7 +129,7 @@ jobs:
129129
curl -L -H "Authorization: Basic cm9vdDp0YW9zZGF0YQ==" -d "show databases" localhost:6041/rest/sql
130130
poetry run pytest --cov-report term --cov-report html --cov-report xml --cov=taos --cov=taosrest --cov-append tests
131131
132-
- name: 'Upload taosd logs'
132+
- name: "Upload taosd logs"
133133
if: failure()
134134
uses: actions/upload-artifact@v4
135135
with:
@@ -140,7 +140,7 @@ jobs:
140140
- name: Upload coverage to Codecov
141141
uses: codecov/codecov-action@v4
142142
with:
143-
files: ./coverage.xml
143+
files: ./coverage.xml
144144
token: ${{ secrets.CODECOV_TOKEN }}
145145

146146
- name: Build Artifacts

.github/workflows/mac.yml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@ name: Test on macOS
33
on:
44
push:
55
branches:
6-
- 'main'
7-
- '3.0'
6+
- "main"
7+
- "3.0"
88
pull_request:
99
branches:
10-
- 'main'
11-
- '3.0'
10+
- "main"
11+
- "3.0"
1212
workflow_dispatch:
1313
inputs:
1414
tdengine_branch:
15-
description: 'TDengine branch'
15+
description: "TDengine branch"
1616
required: true
1717
type: string
1818

@@ -30,8 +30,8 @@ jobs:
3030
id: determine-branch
3131
with:
3232
cond: ${{ github.base_ref == 'main' }}
33-
if_true: '3.3.6'
34-
if_false: '3.0'
33+
if_true: "main"
34+
if_false: "3.0"
3535

3636
#----------------------------------------------
3737
# Checkout TDengine repository
@@ -127,7 +127,6 @@ jobs:
127127
echo "do make_install grep libtao"
128128
pwd
129129
130-
131130
- name: package
132131
if: >
133132
(github.event_name == 'workflow_dispatch' && steps.cache-server-manually.outputs.cache-hit != 'true') ||
@@ -212,7 +211,7 @@ jobs:
212211
key: macos-poetry
213212

214213
#----------------------------------------------
215-
# install & configure poetry
214+
# install & configure poetry
216215
#----------------------------------------------
217216
- name: Install Poetry
218217
uses: snok/install-poetry@v1
@@ -301,7 +300,7 @@ jobs:
301300
302301
- name: Checkout Connector
303302
uses: actions/checkout@v4
304-
303+
305304
- name: Cache Poetry
306305
id: cache-poetry
307306
uses: actions/cache@v4
@@ -310,7 +309,7 @@ jobs:
310309
key: macos-poetry
311310

312311
#----------------------------------------------
313-
# install & configure poetry
312+
# install & configure poetry
314313
#----------------------------------------------
315314
- name: Install Poetry
316315
uses: snok/install-poetry@v1
@@ -384,4 +383,4 @@ jobs:
384383
385384
- name: Build Artifacts
386385
run: |
387-
poetry build
386+
poetry build
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
name: taos-ws-py-compatibility
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- "3.0"
8+
tags:
9+
- taos-ws-py-v*
10+
pull_request:
11+
branches:
12+
- main
13+
- "3.0"
14+
15+
env:
16+
PYTHON_VERSION: "3.10"
17+
18+
jobs:
19+
rebuild:
20+
runs-on: ubuntu-latest
21+
outputs:
22+
status: ${{ steps.set-output.outputs.rebuild }}
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
29+
- name: Detect file changes for rebuild
30+
if: "!startsWith(github.ref, 'refs/tags/taos-ws-py')"
31+
id: detect-changes
32+
uses: tj-actions/changed-files@v41
33+
with:
34+
files: |
35+
.github/workflows/taos-ws-py*.yml
36+
taos-ws-py/**
37+
38+
- name: Set rebuild status
39+
id: set-output
40+
run: |
41+
if [[ "${GITHUB_REF}" == refs/tags/taos-ws-py* ]]; then
42+
echo "rebuild=true" >> $GITHUB_OUTPUT
43+
else
44+
echo "rebuild=${{ steps.detect-changes.outputs.any_changed }}" >> $GITHUB_OUTPUT
45+
fi
46+
47+
test:
48+
runs-on: ubuntu-latest
49+
needs: rebuild
50+
if: needs.rebuild.outputs.status == 'true'
51+
timeout-minutes: 30
52+
strategy:
53+
matrix:
54+
target: [x86_64]
55+
steps:
56+
- name: Checkout
57+
uses: actions/checkout@v4
58+
59+
- name: Set up Python
60+
uses: actions/setup-python@v5
61+
with:
62+
python-version: "${{ env.PYTHON_VERSION }}"
63+
architecture: x64
64+
65+
- name: Get CMake
66+
uses: lukka/get-cmake@latest
67+
with:
68+
cmakeVersion: 3.31.6
69+
70+
- name: Build taos-ws-py wheel
71+
uses: PyO3/maturin-action@v1
72+
with:
73+
rust-toolchain: stable
74+
target: ${{ matrix.target }}
75+
working-directory: taos-ws-py
76+
manylinux: auto
77+
args: --release --strip
78+
79+
- name: Install taos-ws-py wheel
80+
run: pip install taos-ws-py --no-index --force-reinstall --find-links taos-ws-py/target/wheels
81+
82+
- name: Get TDengine
83+
run: wget https://github.com/taosdata/TDengine/releases/download/ver-3.3.6.0/TDengine-server-3.3.6.0-Linux-x64.tar.gz
84+
85+
- name: Install TDengine
86+
run: |
87+
tar -zxf TDengine-server-3.3.6.0-Linux-x64.tar.gz
88+
cd TDengine-server-3.3.6.0
89+
sudo ./install.sh -e no
90+
91+
- name: Copy taos.cfg
92+
run: |
93+
sudo mkdir -p /etc/taos
94+
sudo cp ./.github/workflows/taos.cfg /etc/taos/taos.cfg
95+
96+
- name: Start TDengine
97+
run: |
98+
taosd &
99+
taosadapter &
100+
101+
- name: Run tests
102+
env:
103+
TDENGINE_URL: localhost:6041
104+
WS_CLOUD_URL: ${{ secrets.WS_CLOUD_URL }}
105+
WS_CLOUD_TOKEN: ${{ secrets.WS_CLOUD_TOKEN }}
106+
run: |
107+
pip3 install pytest
108+
pytest ./taos-ws-py/tests/

.github/workflows/taos-ws-py.yml

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ on:
44
push:
55
branches:
66
- main
7-
- '3.0'
7+
- "3.0"
88
tags:
99
- taos-ws-py-v*
1010
pull_request:
1111
branches:
1212
- main
13-
- '3.0'
13+
- "3.0"
1414
env:
1515
PYTHON_VERSION: "3.10" # to build abi3 wheels
1616

@@ -49,9 +49,9 @@ jobs:
4949
matrix:
5050
target: [x86_64]
5151
steps:
52-
- name: Install gettext
52+
- name: Install gettext
5353
run: |
54-
brew install gettext
54+
brew install gettext
5555
5656
- uses: actions/checkout@v4
5757

@@ -68,10 +68,10 @@ jobs:
6868
target: x86_64
6969
working-directory: taos-ws-py
7070
args: --release --strip
71-
- name: Install Homebrew
72-
run: |
73-
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
74-
- name: Set DYLD_LIBRARY_PATH
71+
- name: Install Homebrew
72+
run: |
73+
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
74+
- name: Set DYLD_LIBRARY_PATH
7575
run: |
7676
echo "export DYLD_LIBRARY_PATH=/usr/local/opt/gettext/lib:$DYLD_LIBRARY_PATH" >> $GITHUB_ENV
7777
- name: Install built wheel - x86_64
@@ -165,27 +165,22 @@ jobs:
165165
166166
#
167167
# build TDengine and run taos-ws-py tests
168-
#
168+
#
169169

170170
- name: Determine TDengine branch
171171
uses: haya14busa/action-cond@v1
172172
id: determine-branch
173173
with:
174174
cond: ${{ github.base_ref == 'main' }}
175-
if_true: '3.3.6'
176-
if_false: '3.0'
175+
if_true: "main"
176+
if_false: "3.0"
177177

178178
- name: Checkout tdengine
179179
uses: actions/checkout@v2
180180
with:
181181
repository: "taosdata/TDengine"
182182
path: "TDengine_v3"
183-
ref: ${{ steps.determine-branch.outputs.value }}
184-
185-
- name: Get CMake
186-
uses: lukka/get-cmake@latest
187-
with:
188-
cmakeVersion: 3.31.6
183+
ref: ${{ steps.determine-branch.outputs.value }}
189184

190185
- name: Build TDengine 3.0
191186
run: |
@@ -226,7 +221,6 @@ jobs:
226221
pip3 install ./
227222
pytest ./taos-ws-py/tests/
228223
229-
230224
- name: Upload wheels linux
231225
uses: actions/upload-artifact@v4
232226
with:

taos-ws-py/src/common.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@ pub fn to_py_datetime(dt: chrono::NaiveDateTime, py: Python) -> PyResult<PyObjec
1818
dt.hour() as _,
1919
dt.minute() as _,
2020
dt.second() as _,
21-
dt.timestamp_subsec_micros() as _,
21+
dt.and_utc().timestamp_subsec_micros() as _,
2222
],
2323
);
2424

2525
Ok(datetime.call(args, None)?.into_py(py))
2626
}
27+
2728
// pub fn datetime_to_py(t: chrono py: Python)
2829
pub unsafe fn get_row_of_block_unchecked(py: Python, block: &RawBlock, index: usize) -> PyObject {
2930
let mut vec = Vec::new();

0 commit comments

Comments
 (0)