-
Notifications
You must be signed in to change notification settings - Fork 89
Expand file tree
/
Copy pathclp-ffi-js.yaml
More file actions
95 lines (85 loc) · 3.29 KB
/
clp-ffi-js.yaml
File metadata and controls
95 lines (85 loc) · 3.29 KB
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
version: "3"
includes:
yscope-dev-utils: "../../tools/yscope-dev-utils/exports/taskfiles/utils/utils.yaml"
vars:
G_CLP_FFI_JS_SRC_DIR: "{{.G_BUILD_DIR}}/clp-ffi-js"
G_CLP_FFI_JS_BUILD_DIR: "{{.G_CLP_FFI_JS_SRC_DIR}}/build/clp-ffi-js"
G_CLP_FFI_JS_NODE_MODULE_PATH: "{{.G_CLP_FFI_JS_BUILD_DIR}}/ClpFfiJs-node.js"
G_CLP_FFI_JS_WORKER_MODULE_PATH: "{{.G_CLP_FFI_JS_BUILD_DIR}}/ClpFfiJs-worker.js"
G_CLP_FFI_JS_CHECKSUM_FILE: "{{.G_BUILD_DIR}}/clp-ffi-js.md5"
# NOTE: clp-ffi-js normally builds its WASM artifacts against a pinned CLP source revision. For
# local CLP development and integration testing, we replace that dependency with the current
# workspace CLP checkout via a symlink.
#
# This allows us to quickly verify whether in-flight CLP changes remain compatible with downstream
# clp-ffi-js while reusing the existing clp-ffi-js build and test workflow through a small set of
# hacks/overrides.
#
# Run `task tests:clp-ffi-js` once to perform the initial setup. After that, selectively run
# - `task tests:clp-ffi-js:build-and-test-node`
# - `task tests:clp-ffi-js:build-and-test-browser`
# as needed. Note that `sudo` access is required for the latter.
tasks:
default:
dir: "{{.G_CLP_FFI_JS_SRC_DIR}}"
deps: ["download-src"]
cmds:
# Expose `clp-ffi-js` tasks for test setup
- task: "symlink-yscope-dev-utils"
- |-
sed -i 's/^\(\s*internal:\s*\)true\b/\1false/' taskfile.yaml
task node-modules
task config-cmake-project
rm -rf build/deps/clp
ln -s "{{.ROOT_DIR}}" build/deps/clp
# Repeatable test workflow
- task: "build-and-test-node"
- task: "build-and-test-browser"
build-and-test-node:
dir: "{{.G_CLP_FFI_JS_SRC_DIR}}"
deps: ["build-targets"]
cmds:
- |-
VITE_NODE_MODULE_ABS_PATH="{{.G_CLP_FFI_JS_NODE_MODULE_PATH}}" \
npm run test -- --project node
# NOTE: Browser tests require installing browsers and system dependencies. The task is skipped if
# sudo is unavailable.
build-and-test-browser:
dir: "{{.G_CLP_FFI_JS_SRC_DIR}}"
deps: ["build-targets"]
status:
- "! (command -v sudo >/dev/null && sudo -n true)"
cmds:
- |-
npm run test:init
VITE_WORKER_MODULE_ABS_PATH="{{.G_CLP_FFI_JS_WORKER_MODULE_PATH}}" \
npm run test -- --project browser
# Builds clp-ffi-js + CLP with Emscripten + Clang
build-targets:
internal: true
run: "once"
cmds:
- |-
cmake \
--build "{{.G_CLP_FFI_JS_BUILD_DIR}}" \
--parallel \
--target "ClpFfiJs-node" "ClpFfiJs-worker"
download-src:
internal: true
deps:
- "::init"
cmds:
- task: "yscope-dev-utils:remote:download-and-extract-tar"
vars:
CHECKSUM_FILE: "{{.G_CLP_FFI_JS_CHECKSUM_FILE}}"
FILE_SHA256: "5ab1c27031caafb014198d4db711a71b3fbb1661b396bcd4e46764194e2b1f61"
OUTPUT_DIR: "{{.G_CLP_FFI_JS_SRC_DIR}}"
TAR_FILE: "{{.G_BUILD_DIR}}/clp-ffi-js.tar.gz"
URL: "https://github.com/y-scope/clp-ffi-js/archive/4cc6a7c.tar.gz"
symlink-yscope-dev-utils:
internal: true
cmds:
- |-
rm -rf "{{.G_CLP_FFI_JS_SRC_DIR}}/tools/yscope-dev-utils"
ln -s "{{.ROOT_DIR}}/tools/yscope-dev-utils" \
"{{.G_CLP_FFI_JS_SRC_DIR}}/tools/yscope-dev-utils"