@zappdev/cli 0.1.0

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.
Files changed (209) hide show
  1. package/README.md +55 -0
  2. package/dist/zapp-cli.js +9471 -0
  3. package/native/src/app/app.zc +490 -0
  4. package/native/src/event/event.zc +24 -0
  5. package/native/src/event/events.zc +70 -0
  6. package/native/src/platform/darwin/backend.zc +923 -0
  7. package/native/src/platform/darwin/backend_bootstrap.zc +9 -0
  8. package/native/src/platform/darwin/bootstrap.zc +9 -0
  9. package/native/src/platform/darwin/engine_jsc.zc +86 -0
  10. package/native/src/platform/darwin/engine_qjs.zc +92 -0
  11. package/native/src/platform/darwin/platform.zc +156 -0
  12. package/native/src/platform/darwin/webview.zc +550 -0
  13. package/native/src/platform/darwin/webview_bootstrap.zc +9 -0
  14. package/native/src/platform/darwin/window.zc +1223 -0
  15. package/native/src/platform/darwin/worker/common.zc +223 -0
  16. package/native/src/platform/darwin/worker/core/base64_core.zc +29 -0
  17. package/native/src/platform/darwin/worker/core/crypto_core.zc +19 -0
  18. package/native/src/platform/darwin/worker/core/encoding_core.zc +32 -0
  19. package/native/src/platform/darwin/worker/core/fetch_core.zc +145 -0
  20. package/native/src/platform/darwin/worker/core/url_core.zc +69 -0
  21. package/native/src/platform/darwin/worker/core/websocket_core.zc +179 -0
  22. package/native/src/platform/darwin/worker/dispatch.zc +55 -0
  23. package/native/src/platform/darwin/worker/jsc/base64_jsc.zc +39 -0
  24. package/native/src/platform/darwin/worker/jsc/crypto_jsc.zc +49 -0
  25. package/native/src/platform/darwin/worker/jsc/encoding_jsc.zc +86 -0
  26. package/native/src/platform/darwin/worker/jsc/fetch_jsc.zc +149 -0
  27. package/native/src/platform/darwin/worker/jsc/url_jsc.zc +54 -0
  28. package/native/src/platform/darwin/worker/jsc/websocket_jsc.zc +127 -0
  29. package/native/src/platform/darwin/worker/jsc.zc +670 -0
  30. package/native/src/platform/darwin/worker/mod.zc +30 -0
  31. package/native/src/platform/darwin/worker/qjs/fetch_qjs.zc +233 -0
  32. package/native/src/platform/darwin/worker/qjs/qjs_macros.zc +23 -0
  33. package/native/src/platform/darwin/worker/qjs/websocket_qjs.zc +223 -0
  34. package/native/src/platform/darwin/worker/qjs.zc +1053 -0
  35. package/native/src/platform/darwin/worker/timers.zc +149 -0
  36. package/native/src/platform/darwin/worker/timers_qjs.zc +209 -0
  37. package/native/src/platform/platform.zc +64 -0
  38. package/native/src/platform/shared/log.zc +156 -0
  39. package/native/src/platform/shared/worker/qjs/base64_qjs.zc +38 -0
  40. package/native/src/platform/shared/worker/qjs/crypto_qjs.zc +44 -0
  41. package/native/src/platform/shared/worker/qjs/encoding_qjs.zc +95 -0
  42. package/native/src/platform/shared/worker/qjs/url_qjs.zc +65 -0
  43. package/native/src/platform/shared/worker_registry.zc +206 -0
  44. package/native/src/platform/window.zc +446 -0
  45. package/native/src/platform/windows/backend.zc +452 -0
  46. package/native/src/platform/windows/backend_bootstrap.zc +9 -0
  47. package/native/src/platform/windows/bootstrap.zc +9 -0
  48. package/native/src/platform/windows/engine_qjs.zc +60 -0
  49. package/native/src/platform/windows/platform.zc +387 -0
  50. package/native/src/platform/windows/webview.zc +1175 -0
  51. package/native/src/platform/windows/webview_bootstrap.zc +9 -0
  52. package/native/src/platform/windows/window.zc +1271 -0
  53. package/native/src/platform/windows/worker/common.zc +409 -0
  54. package/native/src/platform/windows/worker/core/base64_core.zc +52 -0
  55. package/native/src/platform/windows/worker/core/crypto_core.zc +34 -0
  56. package/native/src/platform/windows/worker/core/encoding_core.zc +60 -0
  57. package/native/src/platform/windows/worker/core/fetch_core.zc +274 -0
  58. package/native/src/platform/windows/worker/core/url_core.zc +216 -0
  59. package/native/src/platform/windows/worker/core/websocket_core.zc +343 -0
  60. package/native/src/platform/windows/worker/dispatch.zc +34 -0
  61. package/native/src/platform/windows/worker/mod.zc +46 -0
  62. package/native/src/platform/windows/worker/qjs/fetch_qjs.zc +255 -0
  63. package/native/src/platform/windows/worker/qjs/websocket_qjs.zc +263 -0
  64. package/native/src/platform/windows/worker/qjs.zc +1049 -0
  65. package/native/src/platform/windows/worker/timers_qjs.zc +288 -0
  66. package/native/src/platform/worker.zc +8 -0
  67. package/native/src/service/service.zc +228 -0
  68. package/native/vendor/quickjs-ng/.gitattributes +4 -0
  69. package/native/vendor/quickjs-ng/.github/dependabot.yml +7 -0
  70. package/native/vendor/quickjs-ng/.github/workflows/ci.yml +812 -0
  71. package/native/vendor/quickjs-ng/.github/workflows/docs.yml +49 -0
  72. package/native/vendor/quickjs-ng/.github/workflows/release.yml +162 -0
  73. package/native/vendor/quickjs-ng/.github/workflows/test-docs.yml +23 -0
  74. package/native/vendor/quickjs-ng/.github/workflows/tsan.yml +32 -0
  75. package/native/vendor/quickjs-ng/.github/workflows/valgrind.yml +33 -0
  76. package/native/vendor/quickjs-ng/.gitmodules +5 -0
  77. package/native/vendor/quickjs-ng/CMakeLists.txt +553 -0
  78. package/native/vendor/quickjs-ng/LICENSE +24 -0
  79. package/native/vendor/quickjs-ng/Makefile +149 -0
  80. package/native/vendor/quickjs-ng/amalgam.js +53 -0
  81. package/native/vendor/quickjs-ng/api-test.c +927 -0
  82. package/native/vendor/quickjs-ng/builtin-array-fromasync.h +119 -0
  83. package/native/vendor/quickjs-ng/builtin-array-fromasync.js +36 -0
  84. package/native/vendor/quickjs-ng/builtin-iterator-zip-keyed.h +332 -0
  85. package/native/vendor/quickjs-ng/builtin-iterator-zip-keyed.js +194 -0
  86. package/native/vendor/quickjs-ng/builtin-iterator-zip.h +337 -0
  87. package/native/vendor/quickjs-ng/builtin-iterator-zip.js +210 -0
  88. package/native/vendor/quickjs-ng/ctest.c +17 -0
  89. package/native/vendor/quickjs-ng/cutils.h +2013 -0
  90. package/native/vendor/quickjs-ng/cxxtest.cc +2 -0
  91. package/native/vendor/quickjs-ng/dtoa.c +1619 -0
  92. package/native/vendor/quickjs-ng/dtoa.h +87 -0
  93. package/native/vendor/quickjs-ng/examples/fib.c +67 -0
  94. package/native/vendor/quickjs-ng/examples/fib_module.js +10 -0
  95. package/native/vendor/quickjs-ng/examples/hello.js +1 -0
  96. package/native/vendor/quickjs-ng/examples/hello_module.js +6 -0
  97. package/native/vendor/quickjs-ng/examples/meson.build +17 -0
  98. package/native/vendor/quickjs-ng/examples/pi_bigint.js +118 -0
  99. package/native/vendor/quickjs-ng/examples/point.c +154 -0
  100. package/native/vendor/quickjs-ng/examples/test_fib.js +8 -0
  101. package/native/vendor/quickjs-ng/examples/test_point.js +43 -0
  102. package/native/vendor/quickjs-ng/fuzz.c +51 -0
  103. package/native/vendor/quickjs-ng/gen/function_source.c +81 -0
  104. package/native/vendor/quickjs-ng/gen/hello.c +53 -0
  105. package/native/vendor/quickjs-ng/gen/hello_module.c +106 -0
  106. package/native/vendor/quickjs-ng/gen/repl.c +3053 -0
  107. package/native/vendor/quickjs-ng/gen/standalone.c +324 -0
  108. package/native/vendor/quickjs-ng/gen/test_fib.c +81 -0
  109. package/native/vendor/quickjs-ng/libregexp-opcode.h +58 -0
  110. package/native/vendor/quickjs-ng/libregexp.c +2687 -0
  111. package/native/vendor/quickjs-ng/libregexp.h +98 -0
  112. package/native/vendor/quickjs-ng/libunicode-table.h +4707 -0
  113. package/native/vendor/quickjs-ng/libunicode.c +1746 -0
  114. package/native/vendor/quickjs-ng/libunicode.h +126 -0
  115. package/native/vendor/quickjs-ng/list.h +107 -0
  116. package/native/vendor/quickjs-ng/lre-test.c +73 -0
  117. package/native/vendor/quickjs-ng/meson.build +684 -0
  118. package/native/vendor/quickjs-ng/meson_options.txt +6 -0
  119. package/native/vendor/quickjs-ng/qjs-wasi-reactor.c +208 -0
  120. package/native/vendor/quickjs-ng/qjs.c +748 -0
  121. package/native/vendor/quickjs-ng/qjsc.c +673 -0
  122. package/native/vendor/quickjs-ng/quickjs-atom.h +267 -0
  123. package/native/vendor/quickjs-ng/quickjs-c-atomics.h +54 -0
  124. package/native/vendor/quickjs-ng/quickjs-libc.c +4986 -0
  125. package/native/vendor/quickjs-ng/quickjs-libc.h +79 -0
  126. package/native/vendor/quickjs-ng/quickjs-opcode.h +369 -0
  127. package/native/vendor/quickjs-ng/quickjs.c +60259 -0
  128. package/native/vendor/quickjs-ng/quickjs.h +1419 -0
  129. package/native/vendor/quickjs-ng/repl.js +1927 -0
  130. package/native/vendor/quickjs-ng/run-test262.c +2417 -0
  131. package/native/vendor/quickjs-ng/standalone.js +129 -0
  132. package/native/vendor/quickjs-ng/tests/assert.js +49 -0
  133. package/native/vendor/quickjs-ng/tests/bug1221.js +16 -0
  134. package/native/vendor/quickjs-ng/tests/bug1296.js +12 -0
  135. package/native/vendor/quickjs-ng/tests/bug1297.js +22 -0
  136. package/native/vendor/quickjs-ng/tests/bug1301.js +21 -0
  137. package/native/vendor/quickjs-ng/tests/bug1302.js +24 -0
  138. package/native/vendor/quickjs-ng/tests/bug1305.js +26 -0
  139. package/native/vendor/quickjs-ng/tests/bug1318.js +54 -0
  140. package/native/vendor/quickjs-ng/tests/bug1352.js +8 -0
  141. package/native/vendor/quickjs-ng/tests/bug1354.js +6 -0
  142. package/native/vendor/quickjs-ng/tests/bug1355.js +58 -0
  143. package/native/vendor/quickjs-ng/tests/bug1368.js +9 -0
  144. package/native/vendor/quickjs-ng/tests/bug39/1.js +6 -0
  145. package/native/vendor/quickjs-ng/tests/bug39/2.js +6 -0
  146. package/native/vendor/quickjs-ng/tests/bug39/3.js +7 -0
  147. package/native/vendor/quickjs-ng/tests/bug488-upstream.js +7 -0
  148. package/native/vendor/quickjs-ng/tests/bug633/0.js +7 -0
  149. package/native/vendor/quickjs-ng/tests/bug633/1.js +4 -0
  150. package/native/vendor/quickjs-ng/tests/bug633/2.js +4 -0
  151. package/native/vendor/quickjs-ng/tests/bug633/3.js +4 -0
  152. package/native/vendor/quickjs-ng/tests/bug645/0.js +4 -0
  153. package/native/vendor/quickjs-ng/tests/bug645/1.js +9 -0
  154. package/native/vendor/quickjs-ng/tests/bug645/2.js +7 -0
  155. package/native/vendor/quickjs-ng/tests/bug648.js +13 -0
  156. package/native/vendor/quickjs-ng/tests/bug652.js +4 -0
  157. package/native/vendor/quickjs-ng/tests/bug741.js +19 -0
  158. package/native/vendor/quickjs-ng/tests/bug775.js +7 -0
  159. package/native/vendor/quickjs-ng/tests/bug776.js +7 -0
  160. package/native/vendor/quickjs-ng/tests/bug832.js +2 -0
  161. package/native/vendor/quickjs-ng/tests/bug858.js +26 -0
  162. package/native/vendor/quickjs-ng/tests/bug904.js +6 -0
  163. package/native/vendor/quickjs-ng/tests/bug988.js +7 -0
  164. package/native/vendor/quickjs-ng/tests/bug999.js +3 -0
  165. package/native/vendor/quickjs-ng/tests/destructured-export.js +8 -0
  166. package/native/vendor/quickjs-ng/tests/detect_module/0.js +1 -0
  167. package/native/vendor/quickjs-ng/tests/detect_module/1.js +2 -0
  168. package/native/vendor/quickjs-ng/tests/detect_module/2.js +1 -0
  169. package/native/vendor/quickjs-ng/tests/detect_module/3.js +8 -0
  170. package/native/vendor/quickjs-ng/tests/detect_module/4.js +3 -0
  171. package/native/vendor/quickjs-ng/tests/empty.js +0 -0
  172. package/native/vendor/quickjs-ng/tests/fixture_cyclic_import.js +2 -0
  173. package/native/vendor/quickjs-ng/tests/fixture_string_exports.js +12 -0
  174. package/native/vendor/quickjs-ng/tests/function_source.js +14 -0
  175. package/native/vendor/quickjs-ng/tests/microbench.js +1267 -0
  176. package/native/vendor/quickjs-ng/tests/null_or_undefined.js +38 -0
  177. package/native/vendor/quickjs-ng/tests/str-pad-leak.js +5 -0
  178. package/native/vendor/quickjs-ng/tests/test_bigint.js +107 -0
  179. package/native/vendor/quickjs-ng/tests/test_bjson.js +366 -0
  180. package/native/vendor/quickjs-ng/tests/test_builtin.js +1314 -0
  181. package/native/vendor/quickjs-ng/tests/test_closure.js +220 -0
  182. package/native/vendor/quickjs-ng/tests/test_cyclic_import.js +12 -0
  183. package/native/vendor/quickjs-ng/tests/test_domexception.js +35 -0
  184. package/native/vendor/quickjs-ng/tests/test_language.js +755 -0
  185. package/native/vendor/quickjs-ng/tests/test_loop.js +367 -0
  186. package/native/vendor/quickjs-ng/tests/test_queue_microtask.js +39 -0
  187. package/native/vendor/quickjs-ng/tests/test_std.js +340 -0
  188. package/native/vendor/quickjs-ng/tests/test_string_exports.js +25 -0
  189. package/native/vendor/quickjs-ng/tests/test_worker.js +43 -0
  190. package/native/vendor/quickjs-ng/tests/test_worker_module.js +30 -0
  191. package/native/vendor/quickjs-ng/tests.conf +14 -0
  192. package/native/vendor/quickjs-ng/unicode_download.sh +19 -0
  193. package/native/vendor/quickjs-ng/unicode_gen.c +3108 -0
  194. package/native/vendor/quickjs-ng/unicode_gen_def.h +310 -0
  195. package/native/vendor/quickjs-ng/update-version.sh +32 -0
  196. package/native/vendor/webview2/include/WebView2.h +60636 -0
  197. package/native/vendor/webview2/include/WebView2EnvironmentOptions.h +406 -0
  198. package/package.json +33 -0
  199. package/src/backend.ts +139 -0
  200. package/src/build-config.ts +87 -0
  201. package/src/build.ts +276 -0
  202. package/src/common.ts +195 -0
  203. package/src/config.ts +89 -0
  204. package/src/dev.ts +164 -0
  205. package/src/generate.ts +200 -0
  206. package/src/icons.ts +116 -0
  207. package/src/init.ts +190 -0
  208. package/src/package.ts +150 -0
  209. package/src/zapp-cli.ts +263 -0
@@ -0,0 +1,812 @@
1
+ name: ci
2
+
3
+ on:
4
+ pull_request:
5
+ paths:
6
+ - '**'
7
+ - '!.gitignore'
8
+ - '!LICENSE'
9
+ - '!README.md'
10
+ - '!docs/**'
11
+ - '!examples/**'
12
+ - '.github/workflows/ci.yml'
13
+ push:
14
+ branches:
15
+ - master
16
+ paths:
17
+ - '**'
18
+ - '!.gitignore'
19
+ - '!LICENSE'
20
+ - '!README.md'
21
+ - '!docs/**'
22
+ - '!examples/**'
23
+ - '.github/workflows/ci.yml'
24
+
25
+ jobs:
26
+ codegen:
27
+ runs-on: ubuntu-latest
28
+ steps:
29
+ - uses: actions/checkout@v6
30
+ - name: build
31
+ run: |
32
+ make codegen
33
+ - name: Check if the git repository is clean
34
+ run: (exit "$(git status --porcelain --untracked-files=no | head -255 | wc -l)") || (echo "Dirty git tree"; git diff; exit 1)
35
+
36
+ ci:
37
+ runs-on: ${{ matrix.config.os }}
38
+ name: ${{ matrix.config.os }} (${{ matrix.config.configType }}${{ matrix.config.arch }})
39
+ env:
40
+ ASAN_OPTIONS: halt_on_error=1
41
+ MSAN_OPTIONS: halt_on_error=1
42
+ UBSAN_OPTIONS: halt_on_error=1
43
+ defaults:
44
+ run:
45
+ shell: ${{ matrix.config.arch == '' && 'sh' || 'alpine.sh' }} {0}
46
+
47
+ strategy:
48
+ fail-fast: false
49
+ matrix:
50
+ config:
51
+ # see https://github.com/quickjs-ng/quickjs/issues/879 - tl;dr flaky
52
+ #- { os: ubuntu-24.04-arm, configType: Debug }
53
+ #- { os: ubuntu-24.04-arm, configType: Release, runTest262: true }
54
+ - { os: ubuntu-latest, configType: Debug }
55
+ - { os: ubuntu-latest, configType: Release, runTest262: true }
56
+ - { os: ubuntu-latest, configType: examples }
57
+ - { os: ubuntu-latest, configType: shared }
58
+ - { os: ubuntu-latest, configType: asan+ubsan, runTest262: true }
59
+ - { os: ubuntu-latest, configType: msan }
60
+ - { os: ubuntu-latest, configType: tcc }
61
+ - { os: ubuntu-latest, arch: x86, runTest262: true }
62
+ - { os: ubuntu-latest, arch: riscv64 }
63
+ - { os: ubuntu-latest, arch: s390x }
64
+
65
+ - { os: macos-14, configType: Debug }
66
+ - { os: macos-14, configType: Release }
67
+ - { os: macos-14, configType: examples }
68
+ - { os: macos-14, configType: shared }
69
+ - { os: macos-14, configType: asan+ubsan }
70
+ steps:
71
+ - uses: actions/checkout@v6
72
+ with:
73
+ submodules: true
74
+
75
+ - name: install TCC
76
+ if: ${{ matrix.config.configType == 'tcc' }}
77
+ run: |
78
+ pushd /tmp
79
+ git clone https://repo.or.cz/tinycc.git
80
+ cd tinycc
81
+ git checkout c21576f8a32715ab439690d18184b0e02022bbbd
82
+ ./configure
83
+ make
84
+ sudo make install
85
+ tcc -v
86
+ popd
87
+ echo "CC=tcc" >> $GITHUB_ENV;
88
+
89
+ - name: Install extra dependencies
90
+ if: ${{ matrix.config.arch != '' }}
91
+ shell: 'sh'
92
+ run: |
93
+ sudo apt update && sudo apt install -y binfmt-support
94
+
95
+ - name: Setup Alpine
96
+ if: ${{ matrix.config.arch != '' }}
97
+ uses: jirutka/setup-alpine@v1
98
+ with:
99
+ arch: ${{ matrix.config.arch }}
100
+ packages: "build-base make cmake git"
101
+
102
+ - name: uname
103
+ run: uname -a
104
+
105
+ - name: Set build ENV vars
106
+ run: |
107
+ if [ "${{ matrix.config.configType }}" = "Debug" ]; then
108
+ echo "BUILD_TYPE=Debug" >> $GITHUB_ENV;
109
+ elif [ "${{ matrix.config.configType }}" = "examples" ]; then
110
+ echo "QJS_BUILD_EXAMPLES=ON" >> $GITHUB_ENV;
111
+ elif [ "${{ matrix.config.configType }}" = "shared" ]; then
112
+ echo "BUILD_SHARED_LIBS=ON" >> $GITHUB_ENV;
113
+ elif [ "${{ matrix.config.configType }}" = "asan+ubsan" ]; then
114
+ echo "BUILD_TYPE=RelWithDebInfo" >> $GITHUB_ENV;
115
+ echo "QJS_ENABLE_ASAN=ON" >> $GITHUB_ENV;
116
+ echo "QJS_ENABLE_UBSAN=ON" >> $GITHUB_ENV;
117
+ elif [ "${{ matrix.config.configType }}" = "msan" ]; then
118
+ echo "BUILD_TYPE=RelWithDebInfo" >> $GITHUB_ENV;
119
+ echo "QJS_ENABLE_MSAN=ON" >> $GITHUB_ENV;
120
+ echo "CC=clang" >> $GITHUB_ENV;
121
+ fi
122
+
123
+ - name: build
124
+ run: |
125
+ make \
126
+ BUILD_TYPE=$BUILD_TYPE \
127
+ QJS_BUILD_EXAMPLES=$QJS_BUILD_EXAMPLES \
128
+ BUILD_SHARED_LIBS=$BUILD_SHARED_LIBS \
129
+ QJS_ENABLE_ASAN=$QJS_ENABLE_ASAN \
130
+ QJS_ENABLE_UBSAN=$QJS_ENABLE_UBSAN \
131
+ QJS_ENABLE_MSAN=$QJS_ENABLE_MSAN
132
+
133
+ - name: stats
134
+ if: ${{ matrix.config.configType != 'examples' }}
135
+ run: |
136
+ make stats
137
+
138
+ - name: cxxtest
139
+ run: |
140
+ make cxxtest
141
+
142
+ - name: test
143
+ if: ${{ matrix.config.configType != 'examples' }}
144
+ run: |
145
+ make test
146
+
147
+ - name: test examples
148
+ if: ${{ matrix.config.configType == 'examples' }}
149
+ run: |
150
+ cp build/fib.so examples/
151
+ cp build/point.so examples/
152
+ ./build/qjs examples/test_fib.js
153
+ ./build/qjs examples/test_point.js
154
+ ./build/qjs tests/test_bjson.js
155
+ ./build/function_source
156
+
157
+ - name: test 262
158
+ if: ${{ matrix.config.runTest262 }}
159
+ run: |
160
+ git submodule update --init --checkout --depth 1
161
+ make test262
162
+
163
+ - name: test standalone
164
+ run: |
165
+ ./build/qjs -c examples/hello.js -o hello
166
+ ./hello
167
+
168
+ - name: test api
169
+ run: |
170
+ ./build/api-test
171
+
172
+ - name: test lre
173
+ run: |
174
+ ./build/lre-test
175
+
176
+ windows-msvc:
177
+ runs-on: ${{ matrix.config.os }}
178
+ strategy:
179
+ fail-fast: false
180
+ matrix:
181
+ config:
182
+ - { arch: x64, vsArch: x64, buildType: Debug, os: windows-latest }
183
+ - { arch: x64, vsArch: x64, buildType: Release, os: windows-latest }
184
+ - { arch: Win32, vsArch: x86, buildType: Debug, os: windows-latest }
185
+ - { arch: Win32, vsArch: x86, buildType: Release, os: windows-latest }
186
+ - { arch: ARM64, vsArch: arm64, buildType: Debug, os: windows-11-arm }
187
+ - { arch: ARM64, vsArch: arm64, buildType: Release, os: windows-11-arm }
188
+ steps:
189
+ - uses: actions/checkout@v6
190
+ - name: build
191
+ run: |
192
+ cmake -B build -DQJS_BUILD_WERROR=ON -DQJS_BUILD_EXAMPLES=ON -G "Visual Studio 17 2022" -A ${{matrix.config.arch}}
193
+ cmake --build build --config ${{matrix.config.buildType}}
194
+ - name: stats
195
+ run: |
196
+ build\${{matrix.config.buildType}}\qjs.exe -qd
197
+ - name: test
198
+ run: |
199
+ cp build\${{matrix.config.buildType}}\fib.dll examples\
200
+ cp build\${{matrix.config.buildType}}\point.dll examples\
201
+ build\${{matrix.config.buildType}}\qjs.exe examples\test_fib.js
202
+ build\${{matrix.config.buildType}}\qjs.exe examples\test_point.js
203
+ build\${{matrix.config.buildType}}\run-test262.exe -c tests.conf
204
+ build\${{matrix.config.buildType}}\function_source.exe
205
+ - name: test standalone
206
+ run: |
207
+ build\${{matrix.config.buildType}}\qjs.exe -c examples\hello.js -o hello.exe
208
+ .\hello.exe
209
+ - name: test api
210
+ run: |
211
+ build\${{matrix.config.buildType}}\api-test.exe
212
+ - name: test lre
213
+ run: |
214
+ build\${{matrix.config.buildType}}\lre-test.exe
215
+ - name: Set up Visual Studio shell
216
+ uses: egor-tensin/vs-shell@v2
217
+ with:
218
+ arch: ${{ matrix.config.vsArch }}
219
+ - name: cxxtest
220
+ run: |
221
+ cl.exe /DJS_NAN_BOXING=0 /Zs cxxtest.cc
222
+ cl.exe /DJS_NAN_BOXING=1 /Zs cxxtest.cc
223
+
224
+ windows-clang:
225
+ runs-on: windows-latest
226
+ strategy:
227
+ fail-fast: false
228
+ matrix:
229
+ buildType: [Debug, Release]
230
+ steps:
231
+ - uses: actions/checkout@v6
232
+ - name: build
233
+ run: |
234
+ git submodule update --init --checkout --depth 1
235
+ cmake -B build -DQJS_BUILD_WERROR=ON -DQJS_BUILD_EXAMPLES=ON -G "Visual Studio 17 2022" -T ClangCL
236
+ cmake --build build --config ${{matrix.buildType}}
237
+ - name: stats
238
+ run: |
239
+ build\${{matrix.buildType}}\qjs.exe -qd
240
+ - name: cxxtest
241
+ run: |
242
+ clang-cl.exe /DJS_NAN_BOXING=0 /Zs cxxtest.cc
243
+ clang-cl.exe /DJS_NAN_BOXING=1 /Zs cxxtest.cc
244
+ - name: test
245
+ run: |
246
+ cp build\${{matrix.buildType}}\fib.dll examples\
247
+ cp build\${{matrix.buildType}}\point.dll examples\
248
+ build\${{matrix.buildType}}\qjs.exe examples\test_fib.js
249
+ build\${{matrix.buildType}}\qjs.exe examples\test_point.js
250
+ build\${{matrix.buildType}}\run-test262.exe -c tests.conf
251
+ build\${{matrix.buildType}}\function_source.exe
252
+ - name: test api
253
+ run: |
254
+ build\${{matrix.buildType}}\api-test.exe
255
+ - name: test lre
256
+ run: |
257
+ build\${{matrix.buildType}}\lre-test.exe
258
+
259
+ windows-ninja:
260
+ runs-on: windows-latest
261
+ strategy:
262
+ fail-fast: false
263
+ matrix:
264
+ buildType: [Debug, Release]
265
+ steps:
266
+ - uses: actions/checkout@v6
267
+ - name: install ninja
268
+ run: |
269
+ choco install ninja
270
+ ninja.exe --version
271
+ - name: build
272
+ run: |
273
+ git submodule update --init --checkout --depth 1
274
+ cmake -B build -DQJS_BUILD_WERROR=ON -DQJS_BUILD_EXAMPLES=ON -DCMAKE_BUILD_TYPE=${{matrix.buildType}} -G "Ninja"
275
+ cmake --build build
276
+ - name: stats
277
+ run: |
278
+ build\qjs.exe -qd
279
+ - name: test
280
+ run: |
281
+ cp build\fib.dll examples\
282
+ cp build\point.dll examples\
283
+ build\qjs.exe examples\test_fib.js
284
+ build\qjs.exe examples\test_point.js
285
+ build\run-test262.exe -c tests.conf
286
+ build\function_source.exe
287
+ - name: test api
288
+ run: |
289
+ build\api-test.exe
290
+ - name: test lre
291
+ run: |
292
+ build\lre-test.exe
293
+
294
+ windows-sdk:
295
+ runs-on: windows-latest
296
+ strategy:
297
+ fail-fast: false
298
+ matrix:
299
+ arch: [x64, Win32]
300
+ buildType: [Debug, Release]
301
+ steps:
302
+ - uses: actions/checkout@v6
303
+ - name: Install windows sdk
304
+ uses: ChristopheLav/windows-sdk-install@v1
305
+ with:
306
+ version-sdk: 26100
307
+ features: 'OptionId.DesktopCPPx86,OptionId.DesktopCPPx64'
308
+ - name: build
309
+ run: |
310
+ cmake -B build -DQJS_BUILD_WERROR=ON -DQJS_BUILD_EXAMPLES=ON -DCMAKE_SYSTEM_VERSION="10.0.26100.0" -A ${{matrix.arch}}
311
+ cmake --build build --config ${{matrix.buildType}}
312
+ - name: stats
313
+ run: |
314
+ build\${{matrix.buildType}}\qjs.exe -qd
315
+ - name: test
316
+ run: |
317
+ cp build\${{matrix.buildType}}\fib.dll examples\
318
+ cp build\${{matrix.buildType}}\point.dll examples\
319
+ build\${{matrix.buildType}}\qjs.exe examples\test_fib.js
320
+ build\${{matrix.buildType}}\qjs.exe examples\test_point.js
321
+ build\${{matrix.buildType}}\run-test262.exe -c tests.conf
322
+ build\${{matrix.buildType}}\function_source.exe
323
+ - name: test api
324
+ run: |
325
+ build\${{matrix.buildType}}\api-test.exe
326
+ - name: test lre
327
+ run: |
328
+ build\${{matrix.buildType}}\lre-test.exe
329
+
330
+ windows-mingw:
331
+ runs-on: windows-latest
332
+ strategy:
333
+ fail-fast: false
334
+ matrix:
335
+ buildType: [Debug, Release]
336
+ sys:
337
+ - mingw32
338
+ - mingw64
339
+ - clang64
340
+ - ucrt64
341
+ defaults:
342
+ run:
343
+ shell: msys2 {0}
344
+ steps:
345
+ - uses: actions/checkout@v6
346
+ - name: Setup MSYS2
347
+ uses: msys2/setup-msys2@v2
348
+ with:
349
+ update: true
350
+ msystem: ${{matrix.sys}}
351
+ install: >-
352
+ git
353
+ make
354
+ pacboy: >-
355
+ cmake:p
356
+ ninja:p
357
+ toolchain:p
358
+ - name: build
359
+ run: |
360
+ make BUILD_TYPE=${{matrix.buildType}}
361
+ - name: stats
362
+ run: |
363
+ make stats
364
+ ldd build/qjs
365
+ - name: cxxtest
366
+ if: ${{ matrix.sys != 'clang64' }}
367
+ run: |
368
+ make cxxtest
369
+ - name: cxxtest
370
+ if: ${{ matrix.sys == 'clang64' }}
371
+ run: |
372
+ make cxxtest CXX=clang++
373
+ - name: test
374
+ run: |
375
+ make test
376
+ - name: test standalone
377
+ run: |
378
+ ./build/qjs -c examples/hello.js -o hello.exe
379
+ ./hello
380
+ - name: test api
381
+ run: |
382
+ ./build/api-test
383
+ - name: test lre
384
+ run: |
385
+ ./build/lre-test
386
+ windows-mingw-shared:
387
+ runs-on: windows-latest
388
+ defaults:
389
+ run:
390
+ shell: msys2 {0}
391
+ steps:
392
+ - uses: actions/checkout@v6
393
+ - name: Setup MSYS2
394
+ uses: msys2/setup-msys2@v2
395
+ with:
396
+ install: >-
397
+ git
398
+ make
399
+ pacboy: >-
400
+ cmake:p
401
+ ninja:p
402
+ toolchain:p
403
+ - name: build
404
+ run: |
405
+ make BUILD_SHARED_LIBS=ON
406
+ ldd build/qjs
407
+ - name: stats
408
+ run: |
409
+ make stats
410
+
411
+ emscripten:
412
+ runs-on: ubuntu-latest
413
+ steps:
414
+ - uses: actions/checkout@v6
415
+ - uses: mymindstorm/setup-emsdk@v14
416
+ - name: check emsdk
417
+ run: emcc -v
418
+ - name: build
419
+ run: |
420
+ emcmake cmake -B build -DQJS_BUILD_WERROR=ON -DQJS_BUILD_LIBC=ON
421
+ emmake make -C build qjs_wasm "-j$(getconf _NPROCESSORS_ONLN)"
422
+ - name: result
423
+ run: ls -lh build
424
+ wasi:
425
+ runs-on: ubuntu-22.04
426
+ steps:
427
+ - uses: actions/checkout@v6
428
+ - uses: jcbhmr/setup-wasmtime@v2
429
+ - name: setup wasi-sdk
430
+ run: |
431
+ wget -nv https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-29/wasi-sdk-29.0-x86_64-linux.deb -P /tmp
432
+ sudo apt install /tmp/wasi-sdk*.deb
433
+ - name: test
434
+ run: |
435
+ cmake -B build -DQJS_BUILD_WERROR=ON -DCMAKE_TOOLCHAIN_FILE=/opt/wasi-sdk/share/cmake/wasi-sdk.cmake
436
+ make -C build qjs_exe
437
+ wasmtime run build/qjs -qd
438
+ echo "console.log('hello wasi!');" > t.js
439
+ wasmtime run --dir . build/qjs t.js
440
+ - name: build wasi reactor
441
+ run: |
442
+ cmake -B build -DQJS_BUILD_WERROR=ON -DCMAKE_TOOLCHAIN_FILE=/opt/wasi-sdk/share/cmake/wasi-sdk.cmake -DQJS_WASI_REACTOR=ON
443
+ make -C build qjs_wasi
444
+ ls -lh build/qjs.wasm
445
+
446
+ cygwin:
447
+ runs-on: windows-latest
448
+ defaults:
449
+ run:
450
+ shell: C:\cygwin\bin\bash.exe --login --norc -eo pipefail -o igncr '{0}'
451
+ env:
452
+ CYGWIN_NOWINPATH: 1
453
+ CHERE_INVOKING: 1
454
+ steps:
455
+ - name: Set up Cygwin
456
+ uses: cygwin/cygwin-install-action@master
457
+ with:
458
+ packages: make cmake gcc-g++ bash
459
+
460
+ - uses: actions/checkout@v6
461
+
462
+ - name: build
463
+ run: make
464
+
465
+ - name: stats
466
+ run: make stats
467
+
468
+ - name: cxxtest
469
+ run: |
470
+ make cxxtest
471
+
472
+ - name: test
473
+ run: make test
474
+
475
+ - name: test api
476
+ run: |
477
+ ./build/api-test
478
+
479
+ - name: test lre
480
+ run: |
481
+ ./build/lre-test
482
+
483
+ openbsd:
484
+ runs-on: ubuntu-latest
485
+ steps:
486
+ - uses: actions/checkout@v6
487
+ - name: build + test
488
+ uses: vmactions/openbsd-vm@v1
489
+ with:
490
+ usesh: true
491
+ prepare: |
492
+ pkg_add cmake gmake
493
+ run: |
494
+ gmake
495
+ gmake stats
496
+
497
+ freebsd:
498
+ runs-on: ubuntu-latest
499
+ steps:
500
+ - uses: actions/checkout@v6
501
+ - name: build + test
502
+ uses: vmactions/freebsd-vm@v1
503
+ with:
504
+ usesh: true
505
+ prepare: |
506
+ pkg install -y cmake gmake
507
+ run: |
508
+ gmake
509
+ gmake stats
510
+
511
+ android:
512
+ runs-on: ubuntu-latest
513
+ container: reactnativecommunity/react-native-android:v13.0
514
+ steps:
515
+ - uses: actions/checkout@v6
516
+ - name: Configure android arm64
517
+ # see build options you can use in https://developer.android.com/ndk/guides/cmake
518
+ run: |
519
+ mkdir build
520
+ cd build
521
+ "$ANDROID_HOME/cmake/3.22.1/bin/cmake" "-DCMAKE_TOOLCHAIN_FILE=$ANDROID_HOME/ndk/26.0.10792818/build/cmake/android.toolchain.cmake" -DCMAKE_BUILD_TYPE=Release -DANDROID_ABI="arm64-v8a" -DANDROID_PLATFORM=android-24 -DQJS_BUILD_LIBC=ON ..
522
+ - name: Build android arm64
523
+ run: |
524
+ "$ANDROID_HOME/cmake/3.22.1/bin/cmake" --build build --target qjs
525
+ ls -lh build
526
+
527
+ ios:
528
+ runs-on: macos-latest
529
+ steps:
530
+ - uses: actions/checkout@v6
531
+ - name: configure
532
+ run: |
533
+ cmake -B build -GXcode -DQJS_BUILD_WERROR=ON -DCMAKE_SYSTEM_NAME:STRING=iOS -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED:BOOL=NO -DQJS_BUILD_LIBC=ON
534
+ - name: build
535
+ run: |
536
+ cmake --build build --config Release --target qjs
537
+ ls -lh build
538
+
539
+ mimalloc-linux:
540
+ runs-on: ubuntu-24.04
541
+ env:
542
+ QJS_BUILD_CLI_WITH_MIMALLOC: ON
543
+ MIMALLOC_SHOW_STATS: 1
544
+ steps:
545
+ - uses: actions/checkout@v6
546
+ - name: install dependencies
547
+ run: |
548
+ sudo apt update && sudo apt -y install libmimalloc-dev
549
+ - name: build
550
+ run: |
551
+ make
552
+ - name: cxxtest
553
+ run: |
554
+ make cxxtest
555
+ - name: test
556
+ run: |
557
+ make test
558
+
559
+ mimalloc-macos:
560
+ runs-on: macos-latest
561
+ env:
562
+ QJS_BUILD_CLI_WITH_STATIC_MIMALLOC: ON
563
+ MIMALLOC_SHOW_STATS: 1
564
+ steps:
565
+ - uses: actions/checkout@v6
566
+ - name: install dependencies
567
+ run: |
568
+ brew install mimalloc
569
+ - name: build
570
+ run: |
571
+ make
572
+ - name: cxxtest
573
+ run: |
574
+ make cxxtest
575
+ - name: test
576
+ run: |
577
+ make test
578
+
579
+ amalgam:
580
+ strategy:
581
+ matrix:
582
+ # TODO(bnoordhuis) test on windows
583
+ config:
584
+ - { os: ubuntu-latest }
585
+ - { os: macos-latest }
586
+ runs-on: ${{ matrix.config.os }}
587
+ steps:
588
+ - uses: actions/checkout@v6
589
+ - name: build
590
+ run: |
591
+ make
592
+ - name: create amalgamation
593
+ run: |
594
+ make amalgam
595
+ - name: build amalgamation
596
+ run: |
597
+ unzip -d "$RUNNER_TEMP" build/quickjs-amalgam.zip
598
+ cc -Wall -I. -o "$RUNNER_TEMP/run-test262.o" -c run-test262.c
599
+ cc -Wall -I/ -DQJS_BUILD_LIBC -o "$RUNNER_TEMP/quickjs-amalgam.o" -c "$RUNNER_TEMP/quickjs-amalgam.c"
600
+ cc -o "$RUNNER_TEMP/run-test262" "$RUNNER_TEMP/run-test262.o" "$RUNNER_TEMP/quickjs-amalgam.o" -lm
601
+ - name: test
602
+ run: |
603
+ make test RUN262="$RUNNER_TEMP/run-test262"
604
+
605
+ jscheck:
606
+ runs-on: ubuntu-latest
607
+ steps:
608
+ - uses: actions/checkout@v6
609
+ - name: jscheck
610
+ run: |
611
+ make jscheck
612
+
613
+ parserless:
614
+ runs-on: ubuntu-latest
615
+ steps:
616
+ - uses: actions/checkout@v6
617
+ - name: build
618
+ run: |
619
+ make QJS_DISABLE_PARSER=ON QJS_BUILD_EXAMPLES=ON
620
+ - name: test
621
+ run: |
622
+ ./build/hello
623
+ ./build/hello_module
624
+
625
+
626
+ meson:
627
+ runs-on: ${{ matrix.platform }}
628
+ name: meson on ${{ matrix.platform }} (${{ matrix.mode.name }} ${{ matrix.flavor }}, ${{ matrix.features.name }})
629
+ strategy:
630
+ fail-fast: false
631
+ matrix:
632
+ flavor:
633
+ - debug
634
+ - release
635
+ features:
636
+ - name: default
637
+ args: ""
638
+ - name: libc
639
+ args: -Dlibc=true
640
+ - name: mimalloc
641
+ args: -Dcli_mimalloc=auto
642
+ mode:
643
+ - name: default
644
+ args: -Dtests=enabled
645
+ extra_envs: {}
646
+
647
+ # Alternative compiler setups
648
+ - name: gcc
649
+ args: -Dtests=enabled
650
+ extra_envs:
651
+ CC: gcc
652
+ CXX: g++
653
+ - name: clang
654
+ args: -Dtests=enabled
655
+ extra_envs:
656
+ CC: clang
657
+ CXX: clang++
658
+
659
+ - name: sanitize
660
+ args: >-
661
+ "-Db_sanitize=address,undefined"
662
+ extra_envs: {}
663
+
664
+ # This is for MSVC, which only supports AddressSanitizer.
665
+ # https://learn.microsoft.com/en-us/cpp/sanitizers/
666
+ - name: sanitize+asanonly
667
+ args: -Db_sanitize=address
668
+ extra_envs:
669
+ ASAN_OPTIONS: report_globals=0:halt_on_error=1:abort_on_error=1:print_summary=1
670
+
671
+ - name: clang+sanitize
672
+ args: >-
673
+ "-Db_sanitize=address,undefined"
674
+ "-Db_lundef=false"
675
+ extra_envs:
676
+ CC: clang
677
+ CXX: clang++
678
+ - name: clang+msan
679
+ args: >-
680
+ "-Db_sanitize=memory"
681
+ "-Db_lundef=false"
682
+ extra_envs:
683
+ CC: clang
684
+ CXX: clang++
685
+
686
+ # default clang on GitHub hosted runners is from MSYS2.
687
+ # Use Visual Studio supplied clang-cl instead.
688
+ - name: clang-cl+sanitize
689
+ args: >-
690
+ "-Db_sanitize=address,undefined"
691
+ "-Db_lundef=false"
692
+ extra_envs:
693
+ CC: clang-cl
694
+ CXX: clang-cl
695
+ platform:
696
+ - ubuntu-latest
697
+ - windows-latest
698
+ - macos-latest
699
+
700
+ exclude:
701
+ # clang-cl only makes sense on windows.
702
+ - platform: ubuntu-latest
703
+ mode:
704
+ name: clang-cl+sanitize
705
+ - platform: macos-latest
706
+ mode:
707
+ name: clang-cl+sanitize
708
+
709
+ # Use clang-cl instead of MSYS2 clang.
710
+ #
711
+ # we already tested clang+sanitize on linux,
712
+ # if this doesn't work, it should be an issue for MSYS2 team to consider.
713
+ - platform: windows-latest
714
+ mode:
715
+ name: clang
716
+ - platform: windows-latest
717
+ mode:
718
+ name: clang+sanitize
719
+ - platform: windows-latest
720
+ mode:
721
+ name: clang+msan
722
+
723
+ # MSVC-only sanitizers
724
+ - platform: ubuntu-latest
725
+ mode:
726
+ name: sanitize+asanonly
727
+ - platform: macos-latest
728
+ mode:
729
+ name: sanitize+asanonly
730
+ - platform: windows-latest
731
+ mode:
732
+ name: sanitize
733
+
734
+ # clang is the default on macos
735
+ # also gcc is an alias to clang
736
+ - platform: macos-latest
737
+ mode:
738
+ name: clang
739
+ - platform: macos-latest
740
+ mode:
741
+ name: gcc
742
+
743
+ # gcc is the default on linux
744
+ - platform: ubuntu-latest
745
+ mode:
746
+ name: gcc
747
+
748
+ # only run sanitizer tests on linux
749
+ #
750
+ # gcc/clang's codegen shouldn't massively change across platforms,
751
+ # and linux supports most of the sanitizers.
752
+ - platform: macos-latest
753
+ mode:
754
+ name: clang+sanitize
755
+ - platform: macos-latest
756
+ mode:
757
+ # macos does not support msan
758
+ name: clang+msan
759
+ - platform: macos-latest
760
+ mode:
761
+ name: sanitize
762
+
763
+ steps:
764
+ - name: Setup meson
765
+ run: |
766
+ pipx install meson ninja
767
+ - name: Install mimalloc
768
+ if: ${{ matrix.platform == 'ubuntu-latest' && matrix.features.name == 'mimalloc' }}
769
+ run: sudo apt update && sudo apt -y install libmimalloc-dev
770
+ - name: Install mimalloc
771
+ if: ${{ matrix.platform == 'macos-latest' && matrix.features.name == 'mimalloc' }}
772
+ run: brew install mimalloc
773
+ # TODO: Install mimalloc on Windows
774
+ # You need to:
775
+ # - checkout mimalloc
776
+ # - `msbuild mimalloc\ide\vs2022\mimalloc.sln`
777
+ # - not cmake, because https://github.com/microsoft/mimalloc/issues/575#issuecomment-1112723975
778
+ # - it is possible to integrate vcpkg with meson, but:
779
+ # - 1. the above issue
780
+ # - 2. the vcpkg port of mimalloc is outdated, and still broken on server 2019
781
+ # - or maintain a meson port for mimalloc (and ensure it behaves correctly)
782
+ # - Make it findable with cmake
783
+ # - not the simpler pkg-config. although there was pkg-config in PATH,
784
+ # but that was from strawberry perl and thus broken
785
+ # ... good job, microsoft :))))
786
+
787
+ - name: Checkout
788
+ uses: actions/checkout@v6
789
+ - name: Activate MSVC and Configure
790
+ if: ${{ matrix.platform == 'windows-latest' }}
791
+ env: ${{ matrix.mode.extra_envs }}
792
+ run: |
793
+ meson setup build-${{ matrix.flavor }} --buildtype=${{ matrix.flavor }} ${{ matrix.mode.args }} ${{ matrix.features.args }} --vsenv
794
+ - name: Configuring
795
+ if: ${{ matrix.platform != 'windows-latest' }}
796
+ env: ${{ matrix.mode.extra_envs }}
797
+ run: |
798
+ meson setup build-${{ matrix.flavor }} --buildtype=${{ matrix.flavor }} ${{ matrix.mode.args }} ${{ matrix.features.args }}
799
+ - name: Building
800
+ run: |
801
+ meson compile -C build-${{ matrix.flavor }}
802
+
803
+ - name: Running tests
804
+ env: ${{ matrix.mode.extra_envs }}
805
+ run: |
806
+ meson test -C build-${{ matrix.flavor }} --timeout-multiplier 5 --print-errorlogs
807
+ meson test --benchmark -C build-${{ matrix.flavor }} --timeout-multiplier 5 --print-errorlogs
808
+ - uses: actions/upload-artifact@v7
809
+ if: ${{ failure() }}
810
+ with:
811
+ name: ${{ matrix.platform }}-${{ matrix.mode.name }}-${{ matrix.features.name }}-${{ matrix.flavor }}-logs
812
+ path: build-${{ matrix.flavor }}/meson-logs