-
Notifications
You must be signed in to change notification settings - Fork 14
333 lines (291 loc) · 11 KB
/
mac.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
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-12
outputs:
commit_id: ${{ steps.get_commit_id.outputs.commit_id }}
steps:
- name: checkout TDengine by pr
if: github.event_name == 'pull_request'
uses: actions/checkout@v3
with:
repository: "taosdata/TDengine"
path: "TDengine"
ref: '3.0'
- name: checkout TDengine by push
if: github.event_name == 'push'
uses: actions/checkout@v3
with:
repository: "taosdata/TDengine"
path: "TDengine"
ref: '3.0'
- name: checkout TDengine manually
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v3
with:
repository: "taosdata/TDengine"
path: "TDengine"
ref: '3.0'
- 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@v3
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@v3
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@v3
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: 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 -DVERNUMBER=3.9.9.9
make -j 4
- 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
ln -sf /usr/local/lib/libtaos.3.9.9.9.dylib /usr/local/lib/libtaos.1.dylib
ln -sf /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-12
needs: build-tdengine
steps:
- name: get cache server by pr
if: github.event_name == 'pull_request'
id: get-cache-server-pr
uses: actions/cache@v3
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@v3
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@v3
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@v3
- name: Cache Poetry
id: cache-poetry
uses: actions/[email protected]
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@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 connector
#----------------------------------------------
- name: Build Artifacts
run: |
poetry build
test:
runs-on: macos-12
needs: build-tdengine
steps:
- name: get cache server by pr
if: github.event_name == 'pull_request'
id: get-cache-server-pr
uses: actions/cache@v3
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@v3
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@v3
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@v3
- name: Cache Poetry
id: cache-poetry
uses: actions/[email protected]
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@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
- 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
taosd &
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