compilation_on_android_ubuntu.yml 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702
  1. # Copyright (C) 2019 Intel Corporation. All rights reserved.
  2. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  3. name: compilation on android, ubuntu-22.04
  4. on:
  5. # will be triggered on PR events
  6. pull_request:
  7. types:
  8. - opened
  9. - synchronize
  10. paths:
  11. - ".github/workflows/build_llvm_libraries.yml"
  12. - ".github/workflows/compilation_on_android_ubuntu.yml"
  13. - "build-scripts/**"
  14. - "core/**"
  15. - "!core/deps/**"
  16. - "product-mini/**"
  17. - "samples/**"
  18. - "!samples/workload/**"
  19. - "tests/wamr-test-suites/**"
  20. - "wamr-compiler/**"
  21. - "wamr-sdk/**"
  22. - "test-tools/wamr-ide/**"
  23. # will be triggered on push events
  24. push:
  25. branches:
  26. - main
  27. - "dev/**"
  28. paths:
  29. - ".github/workflows/build_llvm_libraries.yml"
  30. - ".github/workflows/compilation_on_android_ubuntu.yml"
  31. - "build-scripts/**"
  32. - "core/**"
  33. - "!core/deps/**"
  34. - "product-mini/**"
  35. - "samples/**"
  36. - "!samples/workload/**"
  37. - "tests/wamr-test-suites/**"
  38. - "wamr-compiler/**"
  39. - "wamr-sdk/**"
  40. - "test-tools/wamr-ide/**"
  41. # allow to be triggered manually
  42. workflow_dispatch:
  43. # Cancel any in-flight jobs for the same PR/branch so there's only one active
  44. # at a time
  45. concurrency:
  46. group: ${{ github.workflow }}-${{ github.ref }}
  47. cancel-in-progress: true
  48. env:
  49. # For BUILD
  50. AOT_BUILD_OPTIONS: " -DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_FAST_JIT=0 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_LAZY_JIT=0"
  51. CLASSIC_INTERP_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=0 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_JIT=0 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_LAZY_JIT=0"
  52. FAST_INTERP_BUILD_OPTIONS: " -DWAMR_BUILD_AOT=0 -DWAMR_BUILD_FAST_INTERP=1 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_JIT=0 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_LAZY_JIT=0"
  53. FAST_JIT_BUILD_OPTIONS: " -DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_FAST_JIT=1 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_LAZY_JIT=0"
  54. LLVM_LAZY_JIT_BUILD_OPTIONS: " -DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_FAST_JIT=0 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LAZY_JIT=1"
  55. LLVM_EAGER_JIT_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_FAST_JIT=0 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LAZY_JIT=0"
  56. MULTI_TIER_JIT_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_JIT=1 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LAZY_JIT=1"
  57. # For Spec Test
  58. DEFAULT_TEST_OPTIONS: "-s spec -b -P"
  59. MULTI_MODULES_TEST_OPTIONS: "-s spec -b -M -P"
  60. SIMD_TEST_OPTIONS: "-s spec -b -S -P"
  61. THREADS_TEST_OPTIONS: "-s spec -b -p -P"
  62. X86_32_TARGET_TEST_OPTIONS: "-m x86_32 -P"
  63. WASI_TEST_OPTIONS: "-s wasi_certification -w"
  64. GC_TEST_OPTIONS: "-s spec -G -b -P"
  65. jobs:
  66. build_llvm_libraries_on_ubuntu_2204:
  67. uses: ./.github/workflows/build_llvm_libraries.yml
  68. with:
  69. os: "ubuntu-22.04"
  70. arch: "X86"
  71. build_wamrc:
  72. needs:
  73. [build_llvm_libraries_on_ubuntu_2204]
  74. runs-on: ${{ matrix.os }}
  75. strategy:
  76. matrix:
  77. include:
  78. - os: ubuntu-22.04
  79. llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
  80. steps:
  81. - name: checkout
  82. uses: actions/checkout@v3
  83. # since jobs.id can't contain the dot character
  84. # it is hard to use `format` to assemble the cache key
  85. - name: Get LLVM libraries
  86. id: retrieve_llvm_libs
  87. uses: actions/cache@v3
  88. with:
  89. path: |
  90. ./core/deps/llvm/build/bin
  91. ./core/deps/llvm/build/include
  92. ./core/deps/llvm/build/lib
  93. ./core/deps/llvm/build/libexec
  94. ./core/deps/llvm/build/share
  95. key: ${{ matrix.llvm_cache_key }}
  96. - name: Quit if cache miss
  97. if: steps.retrieve_llvm_libs.outputs.cache-hit != 'true'
  98. run: echo "::error::can not get prebuilt llvm libraries" && exit 1
  99. - name: Build wamrc
  100. run: |
  101. mkdir build && cd build
  102. cmake ..
  103. cmake --build . --config Release --parallel 4
  104. working-directory: wamr-compiler
  105. build_iwasm:
  106. needs:
  107. [build_llvm_libraries_on_ubuntu_2204]
  108. runs-on: ${{ matrix.os }}
  109. strategy:
  110. matrix:
  111. make_options_run_mode: [
  112. # Running mode
  113. $AOT_BUILD_OPTIONS,
  114. $CLASSIC_INTERP_BUILD_OPTIONS,
  115. $FAST_INTERP_BUILD_OPTIONS,
  116. $FAST_JIT_BUILD_OPTIONS,
  117. $LLVM_LAZY_JIT_BUILD_OPTIONS,
  118. $LLVM_EAGER_JIT_BUILD_OPTIONS,
  119. $MULTI_TIER_JIT_BUILD_OPTIONS,
  120. ]
  121. make_options_feature: [
  122. # Features
  123. "-DWAMR_BUILD_CUSTOM_NAME_SECTION=1",
  124. "-DWAMR_BUILD_DEBUG_AOT=1",
  125. "-DWAMR_BUILD_DEBUG_INTERP=1",
  126. "-DWAMR_BUILD_DUMP_CALL_STACK=1",
  127. "-DWAMR_BUILD_LIB_PTHREAD=1",
  128. "-DWAMR_BUILD_LIB_WASI_THREADS=1",
  129. "-DWAMR_BUILD_LOAD_CUSTOM_SECTION=1",
  130. "-DWAMR_BUILD_MINI_LOADER=1",
  131. "-DWAMR_BUILD_MEMORY_PROFILING=1",
  132. "-DWAMR_BUILD_MULTI_MODULE=1",
  133. "-DWAMR_BUILD_PERF_PROFILING=1",
  134. "-DWAMR_BUILD_REF_TYPES=1",
  135. "-DWAMR_BUILD_SIMD=1",
  136. "-DWAMR_BUILD_TAIL_CALL=1",
  137. "-DWAMR_DISABLE_HW_BOUND_CHECK=1",
  138. ]
  139. os: [ubuntu-22.04]
  140. platform: [android, linux]
  141. exclude:
  142. # uncompatiable feature and platform
  143. # uncompatiable mode and feature
  144. # MULTI_MODULE only on INTERP mode
  145. - make_options_run_mode: $AOT_BUILD_OPTIONS
  146. make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
  147. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  148. make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
  149. - make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
  150. make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
  151. - make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
  152. make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
  153. - make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
  154. make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
  155. # SIMD only on JIT/AOT mode
  156. - make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS
  157. make_options_feature: "-DWAMR_BUILD_SIMD=1"
  158. - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
  159. make_options_feature: "-DWAMR_BUILD_SIMD=1"
  160. # DEBUG_INTERP only on CLASSIC INTERP mode
  161. - make_options_run_mode: $AOT_BUILD_OPTIONS
  162. make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
  163. - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
  164. make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
  165. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  166. make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
  167. - make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
  168. make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
  169. - make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
  170. make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
  171. - make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
  172. make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
  173. # DEBUG_AOT only on JIT/AOT mode
  174. - make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS
  175. make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
  176. - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
  177. make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
  178. # TODO: DEBUG_AOT on JIT
  179. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  180. make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
  181. - make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
  182. make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
  183. - make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
  184. make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
  185. - make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
  186. make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
  187. # MINI_LOADER only on INTERP mode
  188. - make_options_run_mode: $AOT_BUILD_OPTIONS
  189. make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
  190. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  191. make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
  192. - make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
  193. make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
  194. - make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
  195. make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
  196. - make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
  197. make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
  198. # Fast-JIT and Multi-Tier-JIT mode don't support android(X86-32)
  199. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  200. platform: android
  201. - make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
  202. platform: android
  203. include:
  204. - os: ubuntu-22.04
  205. llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
  206. steps:
  207. - name: checkout
  208. uses: actions/checkout@v3
  209. # only download llvm cache when needed
  210. - name: Get LLVM libraries
  211. id: retrieve_llvm_libs
  212. if: endsWith(matrix.make_options_run_mode, '_JIT_BUILD_OPTIONS')
  213. uses: actions/cache@v3
  214. with:
  215. path: |
  216. ./core/deps/llvm/build/bin
  217. ./core/deps/llvm/build/include
  218. ./core/deps/llvm/build/lib
  219. ./core/deps/llvm/build/libexec
  220. ./core/deps/llvm/build/share
  221. key: ${{ matrix.llvm_cache_key }}
  222. - name: Quit if cache miss
  223. if: endsWith(matrix.make_options_run_mode, '_JIT_BUILD_OPTIONS') && (steps.retrieve_llvm_libs.outputs.cache-hit != 'true')
  224. run: echo "::error::can not get prebuilt llvm libraries" && exit 1
  225. - name: Build iwasm
  226. run: |
  227. mkdir build && cd build
  228. cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }}
  229. cmake --build . --config Release --parallel 4
  230. working-directory: product-mini/platforms/${{ matrix.platform }}
  231. build_samples_wasm_c_api:
  232. needs:
  233. [
  234. build_iwasm,
  235. build_llvm_libraries_on_ubuntu_2204,
  236. build_wamrc,
  237. ]
  238. runs-on: ${{ matrix.os }}
  239. strategy:
  240. fail-fast: false
  241. matrix:
  242. make_options: [
  243. # Running mode
  244. $AOT_BUILD_OPTIONS,
  245. $CLASSIC_INTERP_BUILD_OPTIONS,
  246. $FAST_INTERP_BUILD_OPTIONS,
  247. $FAST_JIT_BUILD_OPTIONS,
  248. $LLVM_LAZY_JIT_BUILD_OPTIONS,
  249. $LLVM_EAGER_JIT_BUILD_OPTIONS,
  250. $MULTI_TIER_JIT_BUILD_OPTIONS,
  251. ]
  252. os: [ubuntu-22.04]
  253. wasi_sdk_release:
  254. [
  255. "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz",
  256. ]
  257. wabt_release:
  258. [
  259. "https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-ubuntu.tar.gz",
  260. ]
  261. include:
  262. - os: ubuntu-22.04
  263. llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
  264. steps:
  265. - name: checkout
  266. uses: actions/checkout@v3
  267. - name: Get LLVM libraries
  268. id: retrieve_llvm_libs
  269. if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS'))
  270. uses: actions/cache@v3
  271. with:
  272. path: |
  273. ./core/deps/llvm/build/bin
  274. ./core/deps/llvm/build/include
  275. ./core/deps/llvm/build/lib
  276. ./core/deps/llvm/build/libexec
  277. ./core/deps/llvm/build/share
  278. key: ${{ matrix.llvm_cache_key }}
  279. - name: Quit if cache miss
  280. if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS')) && (steps.retrieve_llvm_libs.outputs.cache-hit != 'true')
  281. run: echo "::error::can not get prebuilt llvm libraries" && exit 1
  282. - name: download and install wabt
  283. run: |
  284. cd /opt
  285. sudo wget ${{ matrix.wabt_release }}
  286. sudo tar -xzf wabt-1.0.31-*.tar.gz
  287. sudo mv wabt-1.0.31 wabt
  288. - name: Build wamrc
  289. if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS'))
  290. run: |
  291. mkdir build && cd build
  292. cmake ..
  293. cmake --build . --config Release --parallel 4
  294. working-directory: wamr-compiler
  295. - name: Build Sample [wasm-c-api]
  296. run: |
  297. VERBOSE=1
  298. cmake -S . -B build ${{ matrix.make_options }}
  299. cmake --build build --config Release --parallel 4
  300. ctest --test-dir build --output-on-failure
  301. working-directory: samples/wasm-c-api
  302. build_samples_others:
  303. needs: [build_iwasm]
  304. runs-on: ${{ matrix.os }}
  305. strategy:
  306. matrix:
  307. os: [ubuntu-22.04]
  308. wasi_sdk_release:
  309. [
  310. "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz",
  311. ]
  312. wabt_release:
  313. [
  314. "https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-ubuntu.tar.gz",
  315. ]
  316. steps:
  317. - name: checkout
  318. uses: actions/checkout@v3
  319. - name: download and install wasi-sdk
  320. run: |
  321. cd /opt
  322. sudo wget ${{ matrix.wasi_sdk_release }}
  323. sudo tar -xzf wasi-sdk-*.tar.gz
  324. sudo mv wasi-sdk-20.0 wasi-sdk
  325. - name: download and install wabt
  326. run: |
  327. cd /opt
  328. sudo wget ${{ matrix.wabt_release }}
  329. sudo tar -xzf wabt-1.0.31-*.tar.gz
  330. sudo mv wabt-1.0.31 wabt
  331. - name: Build Sample [basic]
  332. run: |
  333. cd samples/basic
  334. ./build.sh
  335. ./run.sh
  336. - name: Build Sample [file]
  337. run: |
  338. cd samples/file
  339. mkdir build && cd build
  340. cmake ..
  341. cmake --build . --config Release --parallel 4
  342. ./src/iwasm -f wasm-app/file.wasm -d .
  343. - name: Build Sample [multi-thread]
  344. run: |
  345. cd samples/multi-thread
  346. mkdir build && cd build
  347. cmake ..
  348. cmake --build . --config Release --parallel 4
  349. ./iwasm wasm-apps/test.wasm
  350. - name: Build Sample [multi-module]
  351. run: |
  352. cd samples/multi-module
  353. mkdir build && cd build
  354. cmake ..
  355. cmake --build . --config Release --parallel 4
  356. ./multi_module
  357. - name: Build Sample [spawn-thread]
  358. run: |
  359. cd samples/spawn-thread
  360. mkdir build && cd build
  361. cmake ..
  362. cmake --build . --config Release --parallel 4
  363. ./spawn_thread
  364. - name: Build Sample [ref-types]
  365. run: |
  366. cd samples/ref-types
  367. mkdir build && cd build
  368. cmake ..
  369. cmake --build . --config Release --parallel 4
  370. ./hello
  371. - name: Build Sample [simple]
  372. run: |
  373. ./build.sh -p host-interp
  374. python3 ./sample_test_run.py $(pwd)/out
  375. exit $?
  376. working-directory: ./samples/simple
  377. - name: Build Sample [wasi-threads]
  378. run: |
  379. cd samples/wasi-threads
  380. mkdir build && cd build
  381. cmake ..
  382. cmake --build . --config Release --parallel 4
  383. ./iwasm wasm-apps/no_pthread.wasm
  384. test:
  385. needs:
  386. [
  387. build_iwasm,
  388. build_llvm_libraries_on_ubuntu_2204,
  389. build_wamrc,
  390. ]
  391. runs-on: ${{ matrix.os }}
  392. strategy:
  393. fail-fast: false
  394. matrix:
  395. os: [ubuntu-22.04]
  396. running_mode:
  397. [
  398. "classic-interp",
  399. "fast-interp",
  400. "jit",
  401. "aot",
  402. "fast-jit",
  403. "multi-tier-jit",
  404. ]
  405. test_option:
  406. [
  407. $DEFAULT_TEST_OPTIONS,
  408. $MULTI_MODULES_TEST_OPTIONS,
  409. $SIMD_TEST_OPTIONS,
  410. $THREADS_TEST_OPTIONS,
  411. $WASI_TEST_OPTIONS,
  412. $GC_TEST_OPTIONS,
  413. ]
  414. wasi_sdk_release:
  415. [
  416. "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz",
  417. ]
  418. include:
  419. - os: ubuntu-22.04
  420. llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
  421. ubuntu_version: "22.04"
  422. exclude:
  423. # uncompatiable modes and features
  424. # classic-interp and fast-interp don't support simd
  425. - running_mode: "classic-interp"
  426. test_option: $SIMD_TEST_OPTIONS
  427. - running_mode: "fast-interp"
  428. test_option: $SIMD_TEST_OPTIONS
  429. # aot and jit don't support multi module
  430. - running_mode: "aot"
  431. test_option: $MULTI_MODULES_TEST_OPTIONS
  432. - running_mode: "jit"
  433. test_option: $MULTI_MODULES_TEST_OPTIONS
  434. # fast-jit doesn't support multi module, simd
  435. - running_mode: "fast-jit"
  436. test_option: $MULTI_MODULES_TEST_OPTIONS
  437. - running_mode: "fast-jit"
  438. test_option: $SIMD_TEST_OPTIONS
  439. # multi-tier-jit doesn't support multi module, simd
  440. - running_mode: "multi-tier-jit"
  441. test_option: $MULTI_MODULES_TEST_OPTIONS
  442. - running_mode: "multi-tier-jit"
  443. test_option: $SIMD_TEST_OPTIONS
  444. # aot and jit don't support GC
  445. - running_mode: "aot"
  446. test_option: $GC_TEST_OPTIONS
  447. - running_mode: "jit"
  448. test_option: $GC_TEST_OPTIONS
  449. - running_mode: "multi-tier-jit"
  450. test_option: $GC_TEST_OPTIONS
  451. - running_mode: "fast-jit"
  452. test_option: $GC_TEST_OPTIONS
  453. steps:
  454. - name: checkout
  455. uses: actions/checkout@v3
  456. - name: Set-up OCaml
  457. uses: ocaml/setup-ocaml@v2
  458. if: matrix.test_option == '$GC_TEST_OPTIONS'
  459. with:
  460. ocaml-compiler: 4.13
  461. - name: Set-up Ocamlbuild
  462. if: matrix.test_option == '$GC_TEST_OPTIONS'
  463. run: opam install ocamlbuild
  464. - name: download and install wasi-sdk
  465. if: matrix.test_option == '$WASI_TEST_OPTIONS'
  466. run: |
  467. cd /opt
  468. sudo wget ${{ matrix.wasi_sdk_release }}
  469. sudo tar -xzf wasi-sdk-*.tar.gz
  470. sudo mv wasi-sdk-20.0 wasi-sdk
  471. - name: set env variable(if llvm are used)
  472. if: matrix.running_mode == 'aot' || matrix.running_mode == 'jit' || matrix.running_mode == 'multi-tier-jit'
  473. run: echo "USE_LLVM=true" >> $GITHUB_ENV
  474. - name: set env variable(if x86_32 test needed)
  475. if: >
  476. ((matrix.test_option == '$DEFAULT_TEST_OPTIONS' || matrix.test_option == '$THREADS_TEST_OPTIONS'
  477. || matrix.test_option == '$WASI_TEST_OPTIONS')
  478. && matrix.running_mode != 'fast-jit' && matrix.running_mode != 'jit' && matrix.running_mode != 'multi-tier-jit')
  479. || (matrix.test_option == '$GC_TEST_OPTIONS')
  480. run: echo "TEST_ON_X86_32=true" >> $GITHUB_ENV
  481. #only download llvm libraries in jit and aot mode
  482. - name: Get LLVM libraries
  483. if: env.USE_LLVM == 'true'
  484. id: retrieve_llvm_libs
  485. uses: actions/cache@v3
  486. with:
  487. path: |
  488. ./core/deps/llvm/build/bin
  489. ./core/deps/llvm/build/include
  490. ./core/deps/llvm/build/lib
  491. ./core/deps/llvm/build/libexec
  492. ./core/deps/llvm/build/share
  493. key: ${{ matrix.llvm_cache_key }}
  494. - name: Quit if cache miss
  495. if: env.USE_LLVM == 'true' && steps.retrieve_llvm_libs.outputs.cache-hit != 'true'
  496. run: echo "::error::can not get prebuilt llvm libraries" && exit 1
  497. - name: install jq JSON processor
  498. if: matrix.running_mode == 'aot' && matrix.test_option == '$WASI_TEST_OPTIONS'
  499. run: sudo apt-get update && sudo apt install -y jq
  500. - name: Build WASI thread tests
  501. if: matrix.test_option == '$WASI_TEST_OPTIONS'
  502. run: bash build.sh
  503. working-directory: ./core/iwasm/libraries/lib-wasi-threads/test/
  504. - name: build socket api tests
  505. if: matrix.test_option == '$WASI_TEST_OPTIONS'
  506. run: bash build.sh
  507. working-directory: ./core/iwasm/libraries/lib-socket/test/
  508. - name: run tests
  509. timeout-minutes: 20
  510. if: matrix.test_option != '$GC_TEST_OPTIONS'
  511. run: ./test_wamr.sh ${{ matrix.test_option }} -t ${{ matrix.running_mode }}
  512. working-directory: ./tests/wamr-test-suites
  513. - name: run gc tests
  514. timeout-minutes: 20
  515. if: matrix.test_option == '$GC_TEST_OPTIONS'
  516. run: |
  517. eval $(opam env)
  518. ./test_wamr.sh ${{ matrix.test_option }} -t ${{ matrix.running_mode }}
  519. working-directory: ./tests/wamr-test-suites
  520. #only install x32 support libraries when to run x86_32 cases
  521. - name: install x32 support libraries
  522. if: env.TEST_ON_X86_32 == 'true'
  523. run:
  524. # Add another apt repository as some packages cannot
  525. # be downloaded with the github default repository
  526. sudo curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/apt/trusted.gpg.d/microsoft.asc &&
  527. sudo apt-add-repository https://packages.microsoft.com/ubuntu/${{ matrix.ubuntu_version }}/prod &&
  528. sudo apt-get update &&
  529. sudo apt install -y g++-multilib lib32gcc-9-dev
  530. - name: run tests x86_32
  531. timeout-minutes: 20
  532. if: env.TEST_ON_X86_32 == 'true' && matrix.test_option != '$GC_TEST_OPTIONS'
  533. run: ./test_wamr.sh ${{ env.X86_32_TARGET_TEST_OPTIONS }} ${{ matrix.test_option }} -t ${{ matrix.running_mode }}
  534. working-directory: ./tests/wamr-test-suites
  535. - name: run gc tests x86_32
  536. timeout-minutes: 20
  537. if: env.TEST_ON_X86_32 == 'true' && matrix.test_option == '$GC_TEST_OPTIONS'
  538. run: |
  539. eval $(opam env)
  540. ./test_wamr.sh ${{ env.X86_32_TARGET_TEST_OPTIONS }} ${{ matrix.test_option }} -t ${{ matrix.running_mode }}
  541. working-directory: ./tests/wamr-test-suites
  542. test-wamr-ide:
  543. needs:
  544. [
  545. build_iwasm
  546. ]
  547. runs-on: ubuntu-22.04
  548. env:
  549. PYTHON_VERSION: '3.10'
  550. PYTHON_UBUNTU_STANDALONE_BUILD: https://github.com/indygreg/python-build-standalone/releases/download/20230507/cpython-3.10.11+20230507-x86_64-unknown-linux-gnu-install_only.tar.gz
  551. steps:
  552. - name: checkout
  553. uses: actions/checkout@v3
  554. - name: install dependencies
  555. run: |
  556. rustup target add wasm32-wasi
  557. sudo apt update && sudo apt-get install -y lld ninja-build
  558. npm install
  559. working-directory: test-tools/wamr-ide/VSCode-Extension
  560. - name: build iwasm with source debugging feature
  561. run: |
  562. mkdir build
  563. cd build
  564. cmake .. -DWAMR_BUILD_DEBUG_INTERP=1
  565. make
  566. working-directory: product-mini/platforms/linux
  567. - name: Cache LLDB
  568. id: cache-lldb
  569. uses: actions/cache@v3
  570. env:
  571. cache-name: cache-lldb-vscode
  572. with:
  573. path: test-tools/wamr-ide/VSCode-Extension/resource/debug/linux
  574. key: ${{ env.cache-name }}-${{ hashFiles('build-scripts/lldb-wasm.patch') }}-${{ env.PYTHON_UBUNTU_STANDALONE_BUILD }}
  575. - if: ${{ steps.cache-lldb.outputs.cache-hit != 'true' }}
  576. name: get stand-alone python ubuntu
  577. run: |
  578. wget ${{ env.PYTHON_UBUNTU_STANDALONE_BUILD }} -O python.tar.gz
  579. tar -xvf python.tar.gz
  580. working-directory: core/deps
  581. - if: ${{ steps.cache-lldb.outputs.cache-hit != 'true' }}
  582. name: download llvm
  583. run: |
  584. wget https://github.com/llvm/llvm-project/archive/1f27fe6128769f00197925c3b8f6abb9d0e5cd2e.zip
  585. unzip -q 1f27fe6128769f00197925c3b8f6abb9d0e5cd2e.zip
  586. mv llvm-project-1f27fe6128769f00197925c3b8f6abb9d0e5cd2e llvm-project
  587. working-directory: core/deps
  588. - if: ${{ steps.cache-lldb.outputs.cache-hit != 'true' }}
  589. name: apply wamr patch
  590. run: |
  591. git init
  592. git config user.email "action@github.com"
  593. git config user.name "github action"
  594. git apply ../../../build-scripts/lldb-wasm.patch
  595. working-directory: core/deps/llvm-project
  596. - if: ${{ steps.cache-lldb.outputs.cache-hit != 'true' }}
  597. name: build lldb ubuntu
  598. run: |
  599. echo "start to build lldb..."
  600. mkdir -p wamr-lldb
  601. cmake -S ./llvm -B build \
  602. -G Ninja \
  603. -DCMAKE_INSTALL_PREFIX=../wamr-lldb \
  604. -DCMAKE_BUILD_TYPE:STRING="Release" \
  605. -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
  606. -DLLVM_ENABLE_PROJECTS="clang;lldb" \
  607. -DLLVM_TARGETS_TO_BUILD:STRING="X86;WebAssembly" \
  608. -DLLVM_BUILD_BENCHMARKS:BOOL=OFF \
  609. -DLLVM_BUILD_DOCS:BOOL=OFF \
  610. -DLLVM_BUILD_EXAMPLES:BOOL=OFF \
  611. -DLLVM_BUILD_LLVM_DYLIB:BOOL=OFF \
  612. -DLLVM_BUILD_TESTS:BOOL=OFF \
  613. -DLLVM_INCLUDE_BENCHMARKS:BOOL=OFF \
  614. -DLLVM_INCLUDE_DOCS:BOOL=OFF \
  615. -DLLVM_INCLUDE_EXAMPLES:BOOL=OFF \
  616. -DLLVM_INCLUDE_TESTS:BOOL=OFF \
  617. -DLLVM_ENABLE_BINDINGS:BOOL=OFF \
  618. -DLLVM_ENABLE_LIBXML2:BOOL=ON \
  619. -DLLVM_ENABLE_LLD:BOOL=ON \
  620. -DLLDB_ENABLE_PYTHON:BOOL=ON \
  621. -DLLDB_EMBED_PYTHON_HOME=ON \
  622. -DLLDB_PYTHON_HOME=.. \
  623. -DLLDB_PYTHON_RELATIVE_PATH=lib/lldb-python \
  624. -DPython3_EXECUTABLE="$(pwd)/../python/bin/python${{ env.PYTHON_VERSION }}"
  625. cmake --build build --target lldb install --parallel $(nproc)
  626. working-directory: core/deps/llvm-project
  627. - if: ${{ steps.cache-lldb.outputs.cache-hit != 'true' }}
  628. name: copy lldb to extension folder
  629. run: |
  630. mkdir -p bin
  631. mkdir -p lib
  632. cp ../../../../../../core/deps/llvm-project/lldb/tools/lldb-vscode/package.json ./
  633. cp -r ../../../../../../core/deps/llvm-project/lldb/tools/lldb-vscode/syntaxes/ ./
  634. cp ../../../../../../core/deps/llvm-project/build/bin/lldb* bin
  635. cp ../../../../../../core/deps/llvm-project/build/lib/liblldb*.so lib
  636. cp ../../../../../../core/deps/llvm-project/build/lib/liblldb*.so.* lib
  637. cp -R ../../../../../../core/deps/llvm-project/build/lib/lldb-python lib
  638. cp -R ../../../../../../core/deps/python/lib/python* lib
  639. cp ../../../../../../core/deps/python/lib/libpython${{ env.PYTHON_VERSION }}.so.1.0 lib
  640. working-directory: test-tools/wamr-ide/VSCode-Extension/resource/debug/linux
  641. - name: run tests
  642. timeout-minutes: 5
  643. run: xvfb-run npm run test
  644. working-directory: test-tools/wamr-ide/VSCode-Extension