sqlmath 2024.3.25__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sqlmath-2024.3.25/.ci.sh +518 -0
- sqlmath-2024.3.25/.gitconfig +27 -0
- sqlmath-2024.3.25/.github/workflows/ci.yml +92 -0
- sqlmath-2024.3.25/.github/workflows/publish.yml +88 -0
- sqlmath-2024.3.25/.github/workflows/publish_pypi_test.yml +29 -0
- sqlmath-2024.3.25/.gitignore +40 -0
- sqlmath-2024.3.25/.npmignore +12 -0
- sqlmath-2024.3.25/CHANGELOG.md +651 -0
- sqlmath-2024.3.25/LICENSE +19 -0
- sqlmath-2024.3.25/MANIFEST.in +42 -0
- sqlmath-2024.3.25/PKG-INFO +171 -0
- sqlmath-2024.3.25/README.md +146 -0
- sqlmath-2024.3.25/asset_image_folder_open_solid.svg +1 -0
- sqlmath-2024.3.25/asset_image_github_brands.svg +1 -0
- sqlmath-2024.3.25/asset_image_logo_512.html +46 -0
- sqlmath-2024.3.25/asset_image_logo_512.png +0 -0
- sqlmath-2024.3.25/asset_image_logo_512.svg +44 -0
- sqlmath-2024.3.25/asset_sqlmath_external_rollup.js +10719 -0
- sqlmath-2024.3.25/cpplint.py +6902 -0
- sqlmath-2024.3.25/csslint.js +11283 -0
- sqlmath-2024.3.25/indent.exe +0 -0
- sqlmath-2024.3.25/index.html +1000 -0
- sqlmath-2024.3.25/jslint.mjs +11549 -0
- sqlmath-2024.3.25/jslint_ci.sh +3652 -0
- sqlmath-2024.3.25/libiconv2.dll +0 -0
- sqlmath-2024.3.25/libintl3.dll +0 -0
- sqlmath-2024.3.25/package.json +42 -0
- sqlmath-2024.3.25/pyproject.toml +64 -0
- sqlmath-2024.3.25/setup.py +589 -0
- sqlmath-2024.3.25/sqlmath/__init__.py +642 -0
- sqlmath-2024.3.25/sqlmath.mjs +1678 -0
- sqlmath-2024.3.25/sqlmath_base.c +3588 -0
- sqlmath-2024.3.25/sqlmath_browser.mjs +4695 -0
- sqlmath-2024.3.25/sqlmath_custom.c +50 -0
- sqlmath-2024.3.25/sqlmath_custom.mjs +4 -0
- sqlmath-2024.3.25/sqlmath_external_pcre2.c +46103 -0
- sqlmath-2024.3.25/sqlmath_external_sqlite.c +293002 -0
- sqlmath-2024.3.25/sqlmath_external_zlib.c +22610 -0
- sqlmath-2024.3.25/sqlmath_wrapper_wasm.js +201 -0
- sqlmath-2024.3.25/test.mjs +2712 -0
- sqlmath-2024.3.25/test.py +510 -0
- sqlmath-2024.3.25/test_data_sinefit.csv +1013 -0
sqlmath-2024.3.25/.ci.sh
ADDED
|
@@ -0,0 +1,518 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
|
|
3
|
+
# sh one-liner
|
|
4
|
+
# sh jslint_ci.sh shCiBuildWasm
|
|
5
|
+
# sh jslint_ci.sh shSqlmathUpdate
|
|
6
|
+
|
|
7
|
+
: "
|
|
8
|
+
for URL in \
|
|
9
|
+
https://github.com/google/re2/archive/refs/tags/2023-03-01.tar.gz \
|
|
10
|
+
https://github.com/madler/zlib/releases/download/v1.3/zlib-1.3.tar.gz \
|
|
11
|
+
https://github.com/nalgeon/sqlean/archive/refs/tags/0.21.8.tar.gz \
|
|
12
|
+
https://www.sqlite.org/2023/sqlite-autoconf-3420000.tar.gz
|
|
13
|
+
do
|
|
14
|
+
curl -L "$URL" | tar -xz
|
|
15
|
+
done
|
|
16
|
+
for DIR in \
|
|
17
|
+
re2-2023-03-01 \
|
|
18
|
+
sqlean-0.21.8 \
|
|
19
|
+
sqlite-autoconf-3420000 \
|
|
20
|
+
zlib-1.3
|
|
21
|
+
do
|
|
22
|
+
rm -rf ".$DIR"
|
|
23
|
+
mv "$DIR" ".$DIR"
|
|
24
|
+
done
|
|
25
|
+
"
|
|
26
|
+
|
|
27
|
+
shCiArtifactUploadCustom() {(set -e
|
|
28
|
+
# this function will run custom-code to upload build-artifacts
|
|
29
|
+
git fetch origin artifact
|
|
30
|
+
git checkout origin/artifact "branch-$GITHUB_BRANCH0"
|
|
31
|
+
mv "branch-$GITHUB_BRANCH0"/* .
|
|
32
|
+
git add -f _sqlmath* sqlmath_wasm.*
|
|
33
|
+
# screenshot html
|
|
34
|
+
node --input-type=module --eval '
|
|
35
|
+
import moduleChildProcess from "child_process";
|
|
36
|
+
(async function () {
|
|
37
|
+
let {
|
|
38
|
+
GITHUB_BRANCH0,
|
|
39
|
+
GITHUB_GITHUB_IO
|
|
40
|
+
} = process.env;
|
|
41
|
+
await Promise.all([
|
|
42
|
+
(
|
|
43
|
+
`https://${GITHUB_GITHUB_IO}/branch-${GITHUB_BRANCH0}`
|
|
44
|
+
+ `/index.html`
|
|
45
|
+
),
|
|
46
|
+
".artifact/apidoc.html"
|
|
47
|
+
].map(async function (url) {
|
|
48
|
+
await new Promise(function (resolve) {
|
|
49
|
+
moduleChildProcess.spawn(
|
|
50
|
+
"sh",
|
|
51
|
+
["jslint_ci.sh", "shBrowserScreenshot", url],
|
|
52
|
+
{stdio: ["ignore", 1, 2]}
|
|
53
|
+
).on("exit", resolve);
|
|
54
|
+
});
|
|
55
|
+
}));
|
|
56
|
+
}());
|
|
57
|
+
' "$@" # '
|
|
58
|
+
)}
|
|
59
|
+
|
|
60
|
+
shCiBaseCustom() {(set -e
|
|
61
|
+
# this function will run custom-code for base-ci
|
|
62
|
+
shCiEmsdkExport
|
|
63
|
+
# .github_cache - restore
|
|
64
|
+
if [ "$GITHUB_ACTION" ] && [ -d .github_cache ]
|
|
65
|
+
then
|
|
66
|
+
cp -a .github_cache/* . || true # js-hack - */
|
|
67
|
+
fi
|
|
68
|
+
# cleanup
|
|
69
|
+
rm -rf *.egg-info _sqlmath* build/ sqlmath/_sqlmath* && mkdir -p build/
|
|
70
|
+
PID_LIST=""
|
|
71
|
+
#
|
|
72
|
+
# python -m build --sdist
|
|
73
|
+
# python -m cibuildwheel
|
|
74
|
+
(
|
|
75
|
+
if (shCiMatrixIsmainNodeversion)
|
|
76
|
+
then
|
|
77
|
+
python setup.py sdist
|
|
78
|
+
pip install cibuildwheel
|
|
79
|
+
python -m cibuildwheel --output-dir=dist/
|
|
80
|
+
fi
|
|
81
|
+
) &
|
|
82
|
+
PID_LIST="$PID_LIST $!"
|
|
83
|
+
#
|
|
84
|
+
# shCiBuildWasm
|
|
85
|
+
(
|
|
86
|
+
if (shCiMatrixIsmainName)
|
|
87
|
+
then
|
|
88
|
+
shImageLogoCreate
|
|
89
|
+
shCiBuildWasm
|
|
90
|
+
# .github_cache - save
|
|
91
|
+
if [ "$GITHUB_ACTION" ] && [ ! -d .github_cache/_emsdk ]
|
|
92
|
+
then
|
|
93
|
+
mkdir -p .github_cache
|
|
94
|
+
cp -a "$EMSDK" .github_cache
|
|
95
|
+
fi
|
|
96
|
+
fi
|
|
97
|
+
) &
|
|
98
|
+
PID_LIST="$PID_LIST $!"
|
|
99
|
+
#
|
|
100
|
+
shPidListWait build_ext "$PID_LIST"
|
|
101
|
+
#
|
|
102
|
+
# run nodejs-ci
|
|
103
|
+
shCiTestNodejs
|
|
104
|
+
#
|
|
105
|
+
# upload artifact
|
|
106
|
+
if (shCiMatrixIsmainNodeversion) && ( \
|
|
107
|
+
[ "$GITHUB_BRANCH0" = alpha ] \
|
|
108
|
+
|| [ "$GITHUB_BRANCH0" = beta ] \
|
|
109
|
+
|| [ "$GITHUB_BRANCH0" = master ] \
|
|
110
|
+
)
|
|
111
|
+
then
|
|
112
|
+
export GITHUB_UPLOAD_RETRY=0
|
|
113
|
+
while true
|
|
114
|
+
do
|
|
115
|
+
GITHUB_UPLOAD_RETRY="$((GITHUB_UPLOAD_RETRY + 1))"
|
|
116
|
+
if [ "$GITHUB_UPLOAD_RETRY" -gt 4 ]
|
|
117
|
+
then
|
|
118
|
+
return 1
|
|
119
|
+
fi
|
|
120
|
+
if (node --input-type=module --eval '
|
|
121
|
+
import moduleChildProcess from "child_process";
|
|
122
|
+
(function () {
|
|
123
|
+
moduleChildProcess.spawn(
|
|
124
|
+
"sh",
|
|
125
|
+
["jslint_ci.sh", "shCiBaseCustomArtifactUpload"],
|
|
126
|
+
{stdio: ["ignore", 1, 2]}
|
|
127
|
+
).on("exit", process.exit);
|
|
128
|
+
}());
|
|
129
|
+
' "$@") # '
|
|
130
|
+
then
|
|
131
|
+
break
|
|
132
|
+
fi
|
|
133
|
+
done
|
|
134
|
+
fi
|
|
135
|
+
)}
|
|
136
|
+
|
|
137
|
+
shCiBaseCustomArtifactUpload() {(set -e
|
|
138
|
+
# this function will upload build-artifacts to branch-gh-pages
|
|
139
|
+
COMMIT_MESSAGE="- upload artifact
|
|
140
|
+
- retry$GITHUB_UPLOAD_RETRY
|
|
141
|
+
- $GITHUB_BRANCH0
|
|
142
|
+
- $(printf "$GITHUB_SHA" | cut -c-8)
|
|
143
|
+
- $(uname)
|
|
144
|
+
"
|
|
145
|
+
printf "\n\n$COMMIT_MESSAGE\n"
|
|
146
|
+
# init .git/config
|
|
147
|
+
git config --local user.email "github-actions@users.noreply.github.com"
|
|
148
|
+
git config --local user.name "github-actions"
|
|
149
|
+
# git clone origin/artifact
|
|
150
|
+
rm -rf .tmp/artifact
|
|
151
|
+
shGitCmdWithGithubToken clone origin .tmp/artifact \
|
|
152
|
+
--branch=artifact --single-branch
|
|
153
|
+
(
|
|
154
|
+
cd .tmp/artifact/
|
|
155
|
+
cp ../../.git/config .git/config
|
|
156
|
+
# update dir branch-$GITHUB_BRANCH0
|
|
157
|
+
mkdir -p "branch-$GITHUB_BRANCH0"
|
|
158
|
+
case "$(uname)" in
|
|
159
|
+
Darwin*)
|
|
160
|
+
rm -f "branch-$GITHUB_BRANCH0/"*darwin*
|
|
161
|
+
rm -f "branch-$GITHUB_BRANCH0/"*macos*
|
|
162
|
+
;;
|
|
163
|
+
Linux*)
|
|
164
|
+
rm -f "branch-$GITHUB_BRANCH0/"*linux*
|
|
165
|
+
# save sdist
|
|
166
|
+
rm -f "branch-$GITHUB_BRANCH0/"*.tar.gz
|
|
167
|
+
cp ../../dist/sqlmath-*.tar.gz "branch-$GITHUB_BRANCH0"
|
|
168
|
+
;;
|
|
169
|
+
MINGW64_NT*)
|
|
170
|
+
rm -f "branch-$GITHUB_BRANCH0/"*-win*
|
|
171
|
+
rm -f "branch-$GITHUB_BRANCH0/"*_win*
|
|
172
|
+
;;
|
|
173
|
+
esac
|
|
174
|
+
cp ../../_sqlmath* "branch-$GITHUB_BRANCH0"
|
|
175
|
+
cp ../../sqlmath/_sqlmath* "branch-$GITHUB_BRANCH0"
|
|
176
|
+
if [ -f ../../sqlmath_wasm.wasm ]
|
|
177
|
+
then
|
|
178
|
+
cp ../../sqlmath_wasm.* "branch-$GITHUB_BRANCH0"
|
|
179
|
+
fi
|
|
180
|
+
if [ -f ../../.artifact/asset_image_logo_512.png ]
|
|
181
|
+
then
|
|
182
|
+
cp ../../.artifact/asset_image_logo_* "branch-$GITHUB_BRANCH0"
|
|
183
|
+
fi
|
|
184
|
+
# save cibuildwheel
|
|
185
|
+
cp ../../dist/sqlmath-*.whl "branch-$GITHUB_BRANCH0"
|
|
186
|
+
# git commit
|
|
187
|
+
git add .
|
|
188
|
+
git add -f "branch-$GITHUB_BRANCH0"/_sqlmath*
|
|
189
|
+
if (git commit -am "$COMMIT_MESSAGE")
|
|
190
|
+
then
|
|
191
|
+
# git push
|
|
192
|
+
shGitCmdWithGithubToken push origin artifact
|
|
193
|
+
# git squash
|
|
194
|
+
if (shCiMatrixIsmainName) && [ "$GITHUB_BRANCH0" = alpha ]
|
|
195
|
+
then
|
|
196
|
+
shGitCommitPushOrSquash "" 50
|
|
197
|
+
fi
|
|
198
|
+
fi
|
|
199
|
+
# debug
|
|
200
|
+
shGitLsTree
|
|
201
|
+
)
|
|
202
|
+
)}
|
|
203
|
+
|
|
204
|
+
shCiBuildWasm() {(set -e
|
|
205
|
+
# this function will build binaries in wasm
|
|
206
|
+
shCiEmsdkExport
|
|
207
|
+
# install emsdk
|
|
208
|
+
shCiEmsdkInstall
|
|
209
|
+
# cd ${EMSDK} && . ./emsdk_env.sh && cd ..
|
|
210
|
+
# build wasm
|
|
211
|
+
printf "shCiBuildWasm\n" 1>&2
|
|
212
|
+
OPTION1="$OPTION1 -Wextra"
|
|
213
|
+
OPTION1="$OPTION1 -Wno-unused-parameter"
|
|
214
|
+
OPTION1="$OPTION1 -flto"
|
|
215
|
+
# debug
|
|
216
|
+
# OPTION1="$OPTION1 -O0"
|
|
217
|
+
OPTION1="$OPTION1 -Os"
|
|
218
|
+
# OPTION2="$OPTION2 -Oz"
|
|
219
|
+
# OPTION1="$OPTION1 -fsanitize=address"
|
|
220
|
+
for FILE in \
|
|
221
|
+
sqlmath_base.c \
|
|
222
|
+
sqlmath_custom.c \
|
|
223
|
+
sqlmath_external_pcre2.c \
|
|
224
|
+
sqlmath_external_sqlite.c \
|
|
225
|
+
sqlmath_external_zlib.c
|
|
226
|
+
do
|
|
227
|
+
OPTION2=""
|
|
228
|
+
FILE2="build/$(basename "$FILE").wasm.o"
|
|
229
|
+
case "$FILE" in
|
|
230
|
+
sqlmath_base.c)
|
|
231
|
+
;;
|
|
232
|
+
sqlmath_custom.c)
|
|
233
|
+
;;
|
|
234
|
+
*)
|
|
235
|
+
# optimization - skip rebuild of rollup if possible
|
|
236
|
+
if [ "$FILE2" -nt "$FILE" ]
|
|
237
|
+
then
|
|
238
|
+
printf "shCiBuildWasm - skip $FILE\n" 1>&2
|
|
239
|
+
continue
|
|
240
|
+
fi
|
|
241
|
+
esac
|
|
242
|
+
OPTION2="$OPTION2 -DSRC_SQLITE_BASE_C2="
|
|
243
|
+
OPTION2="$OPTION2 -c $FILE -o $FILE2"
|
|
244
|
+
emcc $OPTION1 $OPTION2
|
|
245
|
+
done
|
|
246
|
+
OPTION2=""
|
|
247
|
+
#
|
|
248
|
+
OPTION2="$OPTION2 -s EXPORTED_FUNCTIONS=_sqlite3_initialize"
|
|
249
|
+
OPTION2="$OPTION2,_dbCall"
|
|
250
|
+
OPTION2="$OPTION2,_dbFileLoadOrSave"
|
|
251
|
+
OPTION2="$OPTION2,_jsbatonGetErrmsg"
|
|
252
|
+
OPTION2="$OPTION2,_jsbatonGetInt64"
|
|
253
|
+
OPTION2="$OPTION2,_jsbatonGetString"
|
|
254
|
+
OPTION2="$OPTION2,_sqlite3_errmsg"
|
|
255
|
+
OPTION2="$OPTION2,_sqlite3_free"
|
|
256
|
+
OPTION2="$OPTION2,_sqlite3_malloc"
|
|
257
|
+
#
|
|
258
|
+
OPTION2="$OPTION2 -s EXPORTED_RUNTIME_METHODS=cwrap"
|
|
259
|
+
OPTION2="$OPTION2 -s LLD_REPORT_UNDEFINED"
|
|
260
|
+
#
|
|
261
|
+
case "$1" in
|
|
262
|
+
--debug)
|
|
263
|
+
OPTION2="$OPTION2 -s ASSERTIONS=1 -s SAFE_HEAP=1"
|
|
264
|
+
;;
|
|
265
|
+
*)
|
|
266
|
+
OPTION2="$OPTION2 --closure 1"
|
|
267
|
+
;;
|
|
268
|
+
esac
|
|
269
|
+
emcc $OPTION1 $OPTION2 \
|
|
270
|
+
--memory-init-file 0 \
|
|
271
|
+
--pre-js sqlmath_wrapper_wasm.js \
|
|
272
|
+
-o build/sqlmath_wasm.js \
|
|
273
|
+
-s ALLOW_MEMORY_GROWTH=1 \
|
|
274
|
+
-s ALLOW_TABLE_GROWTH=1 \
|
|
275
|
+
-s NODEJS_CATCH_EXIT=0 \
|
|
276
|
+
-s NODEJS_CATCH_REJECTION=0 \
|
|
277
|
+
-s RESERVED_FUNCTION_POINTERS=64 \
|
|
278
|
+
-s SINGLE_FILE=0 \
|
|
279
|
+
-s WASM=1 \
|
|
280
|
+
-s WASM_BIGINT \
|
|
281
|
+
build/sqlmath_base.c.wasm.o \
|
|
282
|
+
build/sqlmath_custom.c.wasm.o \
|
|
283
|
+
build/sqlmath_external_pcre2.c.wasm.o \
|
|
284
|
+
build/sqlmath_external_sqlite.c.wasm.o \
|
|
285
|
+
build/sqlmath_external_zlib.c.wasm.o \
|
|
286
|
+
#
|
|
287
|
+
printf '' > sqlmath_wasm.js
|
|
288
|
+
printf "/*jslint-disable*/
|
|
289
|
+
// Copyright (c) 2021 Kai Zhu
|
|
290
|
+
// SPDX-License-Identifier: MIT
|
|
291
|
+
// $(date -u +"%Y-%m-%dT%H:%M:%S%z")
|
|
292
|
+
(function () {
|
|
293
|
+
\"use strict\";
|
|
294
|
+
" >> sqlmath_wasm.js
|
|
295
|
+
cat build/sqlmath_wasm.js | tr -d "\r" >> sqlmath_wasm.js
|
|
296
|
+
printf '
|
|
297
|
+
}());
|
|
298
|
+
/*jslint-enable*/
|
|
299
|
+
' >> sqlmath_wasm.js
|
|
300
|
+
cp build/sqlmath_wasm.wasm .
|
|
301
|
+
ls -l sqlmath_wasm.*
|
|
302
|
+
)}
|
|
303
|
+
|
|
304
|
+
shCiEmsdkExport() {
|
|
305
|
+
# this function will export emsdk env
|
|
306
|
+
export EMSCRIPTEN_VERSION=3.1.3
|
|
307
|
+
export EMSDK="$PWD/_emsdk"
|
|
308
|
+
# https://github.com/sql-js/sql.js/blob/v1.6.2/.devcontainer/Dockerfile
|
|
309
|
+
if [ ! "$PATH_EMSDK" ]
|
|
310
|
+
then
|
|
311
|
+
export PATH_EMSDK="$EMSDK:$EMSDK/upstream/emscripten/"
|
|
312
|
+
export PATH="$PATH_EMSDK:$PATH"
|
|
313
|
+
fi
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
shCiEmsdkInstall() {(set -e
|
|
317
|
+
# this function will install emsdk
|
|
318
|
+
shCiEmsdkExport
|
|
319
|
+
if [ -d "$EMSDK" ]
|
|
320
|
+
then
|
|
321
|
+
exit
|
|
322
|
+
fi
|
|
323
|
+
# https://github.com/emscripten-core/emsdk/blob/2.0.34/docker/Dockerfile
|
|
324
|
+
git clone https://github.com/emscripten-core/emsdk.git $EMSDK
|
|
325
|
+
#
|
|
326
|
+
echo "## Install Emscripten"
|
|
327
|
+
cd ${EMSDK}
|
|
328
|
+
./emsdk install ${EMSCRIPTEN_VERSION}
|
|
329
|
+
echo "## Done"
|
|
330
|
+
#
|
|
331
|
+
# This generates configuration that contains all valid paths according to
|
|
332
|
+
# installed SDK
|
|
333
|
+
# TODO(sbc): We should be able to use just emcc -v here but it doesn't
|
|
334
|
+
# currently create the sanity file.
|
|
335
|
+
cd ${EMSDK}
|
|
336
|
+
echo "## Generate standard configuration"
|
|
337
|
+
./emsdk activate ${EMSCRIPTEN_VERSION}
|
|
338
|
+
chmod 777 ${EMSDK}/upstream/emscripten
|
|
339
|
+
chmod -R 777 ${EMSDK}/upstream/emscripten/cache
|
|
340
|
+
echo "int main() { return 0; }" > hello.c
|
|
341
|
+
${EMSDK}/upstream/emscripten/emcc -c hello.c
|
|
342
|
+
cat ${EMSDK}/upstream/emscripten/cache/sanity.txt
|
|
343
|
+
echo "## Done"
|
|
344
|
+
#
|
|
345
|
+
# Cleanup Emscripten installation and strip some symbols
|
|
346
|
+
echo "## Aggressive optimization: Remove debug symbols"
|
|
347
|
+
cd ${EMSDK} && . ./emsdk_env.sh
|
|
348
|
+
# Remove debugging symbols from embedded node (extra 7MB)
|
|
349
|
+
strip -s `which node`
|
|
350
|
+
# Tests consume ~80MB disc space
|
|
351
|
+
rm -fr ${EMSDK}/upstream/emscripten/tests
|
|
352
|
+
# Fastcomp is not supported
|
|
353
|
+
rm -fr ${EMSDK}/upstream/fastcomp
|
|
354
|
+
# strip out symbols from clang (~extra 50MB disc space)
|
|
355
|
+
find ${EMSDK}/upstream/bin -type f -exec strip -s {} + || true
|
|
356
|
+
echo "## Done"
|
|
357
|
+
#
|
|
358
|
+
# download ports
|
|
359
|
+
# touch "$EMSDK/.null.c"
|
|
360
|
+
# emcc \
|
|
361
|
+
# -s USE_ZLIB \
|
|
362
|
+
# "$EMSDK/.null.c" -o "$EMSDK/.null_wasm.js"
|
|
363
|
+
)}
|
|
364
|
+
|
|
365
|
+
shIndentC() {(set -e
|
|
366
|
+
# this function will indent/prettify c file
|
|
367
|
+
if (uname | grep -q "MING\|MSYS")
|
|
368
|
+
then
|
|
369
|
+
./indent.exe \
|
|
370
|
+
--blank-lines-after-commas \
|
|
371
|
+
--braces-on-func-def-line \
|
|
372
|
+
--break-function-decl-args \
|
|
373
|
+
--break-function-decl-args-end \
|
|
374
|
+
--dont-line-up-parentheses \
|
|
375
|
+
--k-and-r-style \
|
|
376
|
+
--line-length78 \
|
|
377
|
+
--no-tabs \
|
|
378
|
+
-bfde \
|
|
379
|
+
$@
|
|
380
|
+
dos2unix $@
|
|
381
|
+
fi
|
|
382
|
+
)}
|
|
383
|
+
|
|
384
|
+
shCiLintCustom() {(set -e
|
|
385
|
+
# this function will run custom-code to lint files
|
|
386
|
+
if [ "$GITHUB_ACTION" ]
|
|
387
|
+
then
|
|
388
|
+
pip install pycodestyle ruff
|
|
389
|
+
fi
|
|
390
|
+
shLintPython \
|
|
391
|
+
setup.py \
|
|
392
|
+
sqlmath/__init__.py \
|
|
393
|
+
test.py
|
|
394
|
+
)}
|
|
395
|
+
|
|
396
|
+
shCiPublishNpmCustom() {(set -e
|
|
397
|
+
# this function will run custom-code to npm-publish package
|
|
398
|
+
# fetch artifact
|
|
399
|
+
git fetch origin artifact --depth=1
|
|
400
|
+
git checkout origin/artifact \
|
|
401
|
+
branch-beta/_sqlmath* \
|
|
402
|
+
branch-beta/sqlmath_wasm*
|
|
403
|
+
cp -a branch-beta/_sqlmath* .
|
|
404
|
+
cp -a branch-beta/sqlmath_wasm.* .
|
|
405
|
+
# npm-publish
|
|
406
|
+
npm publish --access public
|
|
407
|
+
)}
|
|
408
|
+
|
|
409
|
+
shCiPublishPypiCustom() {(set -e
|
|
410
|
+
# this function will run custom-code to npm-publish package
|
|
411
|
+
# fetch artifact
|
|
412
|
+
git fetch origin artifact --depth=1
|
|
413
|
+
git checkout origin/artifact branch-alpha/
|
|
414
|
+
mkdir dist/
|
|
415
|
+
cp -a branch-alpha/sqlmath-*.tar.gz dist/
|
|
416
|
+
cp -a branch-alpha/sqlmath-*.whl dist/
|
|
417
|
+
ls -la dist/
|
|
418
|
+
)}
|
|
419
|
+
|
|
420
|
+
shCiTestNodejs() {(set -e
|
|
421
|
+
# this function will run test in nodejs
|
|
422
|
+
# init .tmp
|
|
423
|
+
mkdir -p .tmp
|
|
424
|
+
# rebuild c-module
|
|
425
|
+
export npm_config_mode_test=1
|
|
426
|
+
if [ "$npm_config_fast" != true ]
|
|
427
|
+
then
|
|
428
|
+
# lint c-file
|
|
429
|
+
python cpplint.py \
|
|
430
|
+
--filter=-whitespace/comments \
|
|
431
|
+
sqlmath_base.c \
|
|
432
|
+
sqlmath_custom.c
|
|
433
|
+
# lint js-file
|
|
434
|
+
node jslint.mjs .
|
|
435
|
+
# create file MANIFEST.in
|
|
436
|
+
# git ls-tree -r --name-only HEAD | sed "s|^|include |" > MANIFEST.in
|
|
437
|
+
if [ -d .git/ ]
|
|
438
|
+
then
|
|
439
|
+
git ls-tree -r --name-only HEAD | sed "s|^|include |" > MANIFEST.in
|
|
440
|
+
fi
|
|
441
|
+
# create PKG-INFO
|
|
442
|
+
python setup.py build_pkg_info
|
|
443
|
+
# build nodejs c-addon
|
|
444
|
+
PID_LIST=""
|
|
445
|
+
(
|
|
446
|
+
unset npm_config_mode_test
|
|
447
|
+
npm_config_mode_setup=1 node --input-type=module -e '
|
|
448
|
+
import {ciBuildExt} from "./sqlmath.mjs";
|
|
449
|
+
ciBuildExt({process});
|
|
450
|
+
' "$@" # '
|
|
451
|
+
) &
|
|
452
|
+
PID_LIST="$PID_LIST $!"
|
|
453
|
+
# build python c-extension
|
|
454
|
+
python setup.py build_ext &
|
|
455
|
+
PID_LIST="$PID_LIST $!"
|
|
456
|
+
shPidListWait build_ext "$PID_LIST"
|
|
457
|
+
fi;
|
|
458
|
+
PID_LIST=""
|
|
459
|
+
# test nodejs
|
|
460
|
+
(
|
|
461
|
+
rm -f *~ .test*.sqlite __data/.test*.sqlite
|
|
462
|
+
COVERAGE_EXCLUDE="--exclude=jslint.mjs"
|
|
463
|
+
if (node --eval '
|
|
464
|
+
require("assert")(require("./package.json").name !== "sqlmath");
|
|
465
|
+
' >/dev/null 2>&1)
|
|
466
|
+
then
|
|
467
|
+
COVERAGE_EXCLUDE="$COVERAGE_EXCLUDE --exclude=sqlmath.mjs"
|
|
468
|
+
fi
|
|
469
|
+
# ugly-hack - github-action will flakily hang during test
|
|
470
|
+
if [ "$GITHUB_ACTION" ] && (timeout --version >/dev/null 2>&1)
|
|
471
|
+
then
|
|
472
|
+
timeout 120 sh jslint_ci.sh \
|
|
473
|
+
shRunWithCoverage $COVERAGE_EXCLUDE node test.mjs
|
|
474
|
+
else
|
|
475
|
+
shRunWithCoverage $COVERAGE_EXCLUDE node test.mjs
|
|
476
|
+
fi
|
|
477
|
+
) &
|
|
478
|
+
PID_LIST="$PID_LIST $!"
|
|
479
|
+
# test python
|
|
480
|
+
python setup.py test &
|
|
481
|
+
PID_LIST="$PID_LIST $!"
|
|
482
|
+
shPidListWait test "$PID_LIST"
|
|
483
|
+
)}
|
|
484
|
+
|
|
485
|
+
shSqlmathUpdate() {(set -e
|
|
486
|
+
# this function will update files with ~/Documents/sqlmath/
|
|
487
|
+
. "$HOME/myci2.sh" : && shMyciUpdate
|
|
488
|
+
if [ "$PWD/" = "$HOME/Documents/sqlmath/" ]
|
|
489
|
+
then
|
|
490
|
+
shRollupFetch asset_sqlmath_external_rollup.js
|
|
491
|
+
shRollupFetch index.html
|
|
492
|
+
shRollupFetch sqlmath_external_pcre2.c
|
|
493
|
+
shRollupFetch sqlmath_external_sqlite.c
|
|
494
|
+
shRollupFetch sqlmath_external_zlib.c
|
|
495
|
+
return
|
|
496
|
+
fi
|
|
497
|
+
if [ -d "$HOME/Documents/sqlmath/" ]
|
|
498
|
+
then
|
|
499
|
+
for FILE in \
|
|
500
|
+
.ci.sh \
|
|
501
|
+
asset_sqlmath_external_rollup.js \
|
|
502
|
+
indent.exe \
|
|
503
|
+
index.html \
|
|
504
|
+
setup.py \
|
|
505
|
+
sqlmath.mjs \
|
|
506
|
+
sqlmath/__init__.py \
|
|
507
|
+
sqlmath_base.c \
|
|
508
|
+
sqlmath_browser.mjs \
|
|
509
|
+
sqlmath_external_pcre2.c \
|
|
510
|
+
sqlmath_external_sqlite.c \
|
|
511
|
+
sqlmath_external_zlib.c \
|
|
512
|
+
sqlmath_wrapper_wasm.js
|
|
513
|
+
do
|
|
514
|
+
ln -f "$HOME/Documents/sqlmath/$FILE" "$FILE"
|
|
515
|
+
done
|
|
516
|
+
fi
|
|
517
|
+
git --no-pager diff
|
|
518
|
+
)}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# base - .gitconfig - beg
|
|
2
|
+
[branch "alpha"]
|
|
3
|
+
merge = refs/heads/alpha
|
|
4
|
+
remote = origin
|
|
5
|
+
[branch "base"]
|
|
6
|
+
merge = refs/heads/base
|
|
7
|
+
remote = origin
|
|
8
|
+
[core]
|
|
9
|
+
# autocrlf = false
|
|
10
|
+
autocrlf = input
|
|
11
|
+
bare = false
|
|
12
|
+
# filemode = false
|
|
13
|
+
logallrefupdates = true
|
|
14
|
+
repositoryformatversion = 0
|
|
15
|
+
[diff]
|
|
16
|
+
algorithm = histogram
|
|
17
|
+
[pull]
|
|
18
|
+
ff = only
|
|
19
|
+
[receive]
|
|
20
|
+
denyCurrentBranch = warn
|
|
21
|
+
# base - .gitconfig - end
|
|
22
|
+
[remote "origin"]
|
|
23
|
+
fetch = +refs/heads/*:refs/remotes/origin/*
|
|
24
|
+
url = https://github.com/user/sqlmath
|
|
25
|
+
[remote "upstream"]
|
|
26
|
+
fetch = +refs/heads/*:refs/remotes/upstream/*
|
|
27
|
+
url = https://github.com/sqlmath/sqlmath
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# this workflow will run nodejs coverages and tests
|
|
2
|
+
# and upload build-artifacts to branch-gh-pages
|
|
3
|
+
name: ci
|
|
4
|
+
on:
|
|
5
|
+
push:
|
|
6
|
+
branches:
|
|
7
|
+
- alpha
|
|
8
|
+
- beta
|
|
9
|
+
- master
|
|
10
|
+
workflow_dispatch:
|
|
11
|
+
env:
|
|
12
|
+
MY_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
13
|
+
zzzz1234: 1
|
|
14
|
+
jobs:
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
job1:
|
|
18
|
+
strategy:
|
|
19
|
+
matrix:
|
|
20
|
+
architecture:
|
|
21
|
+
# - arm64
|
|
22
|
+
- x64
|
|
23
|
+
# - x86
|
|
24
|
+
node_version:
|
|
25
|
+
- 18
|
|
26
|
+
- 20
|
|
27
|
+
# - 22
|
|
28
|
+
python_version:
|
|
29
|
+
- "3.10"
|
|
30
|
+
os:
|
|
31
|
+
- macos-latest
|
|
32
|
+
- ubuntu-latest
|
|
33
|
+
- windows-latest
|
|
34
|
+
# base - .github/workflows/ci.yml - beg
|
|
35
|
+
env:
|
|
36
|
+
CI_MATRIX_NAME: >
|
|
37
|
+
node
|
|
38
|
+
v${{ matrix.node_version }}
|
|
39
|
+
${{ matrix.architecture }}
|
|
40
|
+
${{ matrix.os }}
|
|
41
|
+
CI_MATRIX_NAME_MAIN: "node v20 x64 ubuntu-latest"
|
|
42
|
+
CI_MATRIX_NODE_VERSION: v${{ matrix.node_version }}
|
|
43
|
+
CI_MATRIX_NODE_VERSION_MAIN: v20
|
|
44
|
+
CI_WORKFLOW_NAME: >
|
|
45
|
+
${{ github.workflow }}
|
|
46
|
+
- ${{ github.event_name }}
|
|
47
|
+
- ${{ github.event.inputs.workflow_dispatch_name }}
|
|
48
|
+
- ${{ github.ref_name }}
|
|
49
|
+
name: >
|
|
50
|
+
node
|
|
51
|
+
v${{ matrix.node_version }}
|
|
52
|
+
${{ matrix.architecture }}
|
|
53
|
+
${{ matrix.os }}
|
|
54
|
+
runs-on: ${{ matrix.os }}
|
|
55
|
+
steps:
|
|
56
|
+
# disable autocrlf in windows
|
|
57
|
+
- run: |
|
|
58
|
+
sh -c uname
|
|
59
|
+
echo "$(date -u +"%Y-%m-%d %TZ") - ${{ env.CI_WORKFLOW_NAME }}" # "
|
|
60
|
+
git config --global core.autocrlf false
|
|
61
|
+
# https://github.com/actions/checkout
|
|
62
|
+
- uses: actions/checkout@v4
|
|
63
|
+
# fetch jslint_ci.sh from trusted source
|
|
64
|
+
- run: |
|
|
65
|
+
git fetch origin alpha --depth=1
|
|
66
|
+
sh -c 'for FILE in .ci.sh .ci2.sh jslint_ci.sh myci2.sh; do
|
|
67
|
+
if [ -f "$FILE" ]; then git checkout origin/alpha "$FILE"; fi; done'
|
|
68
|
+
# pre-run .ci.sh
|
|
69
|
+
- run: sh jslint_ci.sh shCiPre
|
|
70
|
+
# https://github.com/actions/setup-node
|
|
71
|
+
- uses: actions/setup-node@v4
|
|
72
|
+
with:
|
|
73
|
+
architecture: ${{ matrix.architecture }}
|
|
74
|
+
node-version: ${{ matrix.node_version }}
|
|
75
|
+
# https://github.com/actions/setup-python
|
|
76
|
+
- uses: actions/setup-python@v5
|
|
77
|
+
with:
|
|
78
|
+
python-version: ${{ matrix.python_version }}
|
|
79
|
+
# https://github.com/actions/cache
|
|
80
|
+
- uses: actions/cache@v4
|
|
81
|
+
with:
|
|
82
|
+
key: >
|
|
83
|
+
${{ hashFiles('./package.json') }}
|
|
84
|
+
${{ matrix.architecture }}
|
|
85
|
+
${{ matrix.node_version }}
|
|
86
|
+
${{ matrix.os }}
|
|
87
|
+
path: .github_cache
|
|
88
|
+
# run nodejs coverages and tests
|
|
89
|
+
- run: sh jslint_ci.sh shCiBase
|
|
90
|
+
# upload build-artifacts to branch-gh-pages
|
|
91
|
+
- run: sh jslint_ci.sh shCiArtifactUpload
|
|
92
|
+
# base - .github/workflows/ci.yml - end
|