compilation_on_android_ubuntu.yml 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720
  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. WAMR_COMPILER_TEST_OPTIONS: "-s wamr_compiler -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@v4
  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@v4
  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. "-DWAMR_ENABLE_SHARED_MEMORY_MMAP=1",
  139. ]
  140. os: [ubuntu-22.04]
  141. platform: [android, linux]
  142. exclude:
  143. # uncompatiable feature and platform
  144. # uncompatiable mode and feature
  145. # MULTI_MODULE only on INTERP mode and AOT mode
  146. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  147. make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
  148. - make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
  149. make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
  150. - make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
  151. make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
  152. - make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
  153. make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
  154. # SIMD only on JIT/AOT mode
  155. - make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS
  156. make_options_feature: "-DWAMR_BUILD_SIMD=1"
  157. - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
  158. make_options_feature: "-DWAMR_BUILD_SIMD=1"
  159. # DEBUG_INTERP only on CLASSIC INTERP mode
  160. - make_options_run_mode: $AOT_BUILD_OPTIONS
  161. make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
  162. - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
  163. make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
  164. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  165. make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
  166. - make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
  167. make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
  168. - make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
  169. make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
  170. - make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
  171. make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
  172. # DEBUG_AOT only on JIT/AOT mode
  173. - make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS
  174. make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
  175. - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
  176. make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
  177. # TODO: DEBUG_AOT on JIT
  178. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  179. make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
  180. - make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
  181. make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
  182. - make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
  183. make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
  184. - make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
  185. make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
  186. # MINI_LOADER only on INTERP mode
  187. - make_options_run_mode: $AOT_BUILD_OPTIONS
  188. make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
  189. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  190. make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
  191. - make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
  192. make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
  193. - make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
  194. make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
  195. - make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
  196. make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
  197. # Fast-JIT and Multi-Tier-JIT mode don't support android(X86-32)
  198. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  199. platform: android
  200. - make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
  201. platform: android
  202. include:
  203. - os: ubuntu-22.04
  204. llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
  205. steps:
  206. - name: checkout
  207. uses: actions/checkout@v4
  208. # only download llvm cache when needed
  209. - name: Get LLVM libraries
  210. id: retrieve_llvm_libs
  211. if: endsWith(matrix.make_options_run_mode, '_JIT_BUILD_OPTIONS')
  212. uses: actions/cache@v4
  213. with:
  214. path: |
  215. ./core/deps/llvm/build/bin
  216. ./core/deps/llvm/build/include
  217. ./core/deps/llvm/build/lib
  218. ./core/deps/llvm/build/libexec
  219. ./core/deps/llvm/build/share
  220. key: ${{ matrix.llvm_cache_key }}
  221. - name: Quit if cache miss
  222. if: endsWith(matrix.make_options_run_mode, '_JIT_BUILD_OPTIONS') && (steps.retrieve_llvm_libs.outputs.cache-hit != 'true')
  223. run: echo "::error::can not get prebuilt llvm libraries" && exit 1
  224. - name: Build iwasm
  225. run: |
  226. mkdir build && cd build
  227. cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }}
  228. cmake --build . --config Release --parallel 4
  229. working-directory: product-mini/platforms/${{ matrix.platform }}
  230. - name: Build and run unit tests
  231. run: |
  232. mkdir build-unittests && cd build-unittests
  233. cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }}
  234. cmake --build . --config Release --parallel 4
  235. ctest
  236. working-directory: tests/unit
  237. build_samples_wasm_c_api:
  238. needs:
  239. [
  240. build_iwasm,
  241. build_llvm_libraries_on_ubuntu_2204,
  242. build_wamrc,
  243. ]
  244. runs-on: ${{ matrix.os }}
  245. strategy:
  246. fail-fast: false
  247. matrix:
  248. make_options: [
  249. # Running mode
  250. $AOT_BUILD_OPTIONS,
  251. $CLASSIC_INTERP_BUILD_OPTIONS,
  252. $FAST_INTERP_BUILD_OPTIONS,
  253. $FAST_JIT_BUILD_OPTIONS,
  254. $LLVM_LAZY_JIT_BUILD_OPTIONS,
  255. $LLVM_EAGER_JIT_BUILD_OPTIONS,
  256. $MULTI_TIER_JIT_BUILD_OPTIONS,
  257. ]
  258. os: [ubuntu-22.04]
  259. wasi_sdk_release:
  260. [
  261. "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz",
  262. ]
  263. wabt_release:
  264. [
  265. "https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-ubuntu.tar.gz",
  266. ]
  267. include:
  268. - os: ubuntu-22.04
  269. llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
  270. steps:
  271. - name: checkout
  272. uses: actions/checkout@v4
  273. - name: Get LLVM libraries
  274. id: retrieve_llvm_libs
  275. if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS'))
  276. uses: actions/cache@v4
  277. with:
  278. path: |
  279. ./core/deps/llvm/build/bin
  280. ./core/deps/llvm/build/include
  281. ./core/deps/llvm/build/lib
  282. ./core/deps/llvm/build/libexec
  283. ./core/deps/llvm/build/share
  284. key: ${{ matrix.llvm_cache_key }}
  285. - name: Quit if cache miss
  286. if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS')) && (steps.retrieve_llvm_libs.outputs.cache-hit != 'true')
  287. run: echo "::error::can not get prebuilt llvm libraries" && exit 1
  288. - name: download and install wabt
  289. run: |
  290. cd /opt
  291. sudo wget ${{ matrix.wabt_release }}
  292. sudo tar -xzf wabt-1.0.31-*.tar.gz
  293. sudo mv wabt-1.0.31 wabt
  294. - name: Build wamrc
  295. if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS'))
  296. run: |
  297. mkdir build && cd build
  298. cmake ..
  299. cmake --build . --config Release --parallel 4
  300. working-directory: wamr-compiler
  301. - name: Build Sample [wasm-c-api]
  302. run: |
  303. VERBOSE=1
  304. cmake -S . -B build ${{ matrix.make_options }}
  305. cmake --build build --config Debug --parallel 4
  306. ctest --test-dir build --output-on-failure
  307. working-directory: samples/wasm-c-api
  308. build_samples_others:
  309. needs:
  310. [
  311. build_iwasm,
  312. build_llvm_libraries_on_ubuntu_2204,
  313. build_wamrc,
  314. ]
  315. runs-on: ${{ matrix.os }}
  316. strategy:
  317. matrix:
  318. os: [ubuntu-22.04]
  319. wasi_sdk_release:
  320. [
  321. "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz",
  322. ]
  323. wabt_release:
  324. [
  325. "https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-ubuntu.tar.gz",
  326. ]
  327. include:
  328. - os: ubuntu-22.04
  329. llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
  330. steps:
  331. - name: checkout
  332. uses: actions/checkout@v4
  333. - name: download and install wasi-sdk
  334. run: |
  335. cd /opt
  336. sudo wget ${{ matrix.wasi_sdk_release }}
  337. sudo tar -xzf wasi-sdk-*.tar.gz
  338. sudo mv wasi-sdk-20.0 wasi-sdk
  339. - name: download and install wabt
  340. run: |
  341. cd /opt
  342. sudo wget ${{ matrix.wabt_release }}
  343. sudo tar -xzf wabt-1.0.31-*.tar.gz
  344. sudo mv wabt-1.0.31 wabt
  345. - name: Get LLVM libraries
  346. id: retrieve_llvm_libs
  347. uses: actions/cache@v4
  348. with:
  349. path: |
  350. ./core/deps/llvm/build/bin
  351. ./core/deps/llvm/build/include
  352. ./core/deps/llvm/build/lib
  353. ./core/deps/llvm/build/libexec
  354. ./core/deps/llvm/build/share
  355. key: ${{ matrix.llvm_cache_key }}
  356. - name: Build wamrc
  357. run: |
  358. mkdir build && cd build
  359. cmake ..
  360. cmake --build . --config Release --parallel 4
  361. working-directory: wamr-compiler
  362. - name: Build Sample [basic]
  363. run: |
  364. cd samples/basic
  365. ./build.sh
  366. ./run.sh
  367. - name: Build Sample [file]
  368. run: |
  369. cd samples/file
  370. mkdir build && cd build
  371. cmake ..
  372. cmake --build . --config Debug --parallel 4
  373. ./src/iwasm -f wasm-app/file.wasm -d .
  374. - name: Build Sample [multi-thread]
  375. run: |
  376. cd samples/multi-thread
  377. mkdir build && cd build
  378. cmake ..
  379. cmake --build . --config Debug --parallel 4
  380. ./iwasm wasm-apps/test.wasm
  381. - name: Build Sample [multi-module]
  382. run: |
  383. cd samples/multi-module
  384. mkdir build && cd build
  385. cmake .. -DWAMR_BUILD_AOT=1
  386. cmake --build . --config Debug --parallel 4
  387. ./multi_module mC.wasm
  388. ./multi_module mC.aot
  389. - name: Build Sample [spawn-thread]
  390. run: |
  391. cd samples/spawn-thread
  392. mkdir build && cd build
  393. cmake ..
  394. cmake --build . --config Debug --parallel 4
  395. ./spawn_thread
  396. - name: Build Sample [ref-types]
  397. run: |
  398. cd samples/ref-types
  399. mkdir build && cd build
  400. cmake ..
  401. cmake --build . --config Debug --parallel 4
  402. ./hello
  403. - name: Build Sample [simple]
  404. run: |
  405. ./build.sh -p host-interp
  406. python3 ./sample_test_run.py $(pwd)/out
  407. exit $?
  408. working-directory: ./samples/simple
  409. - name: Build Sample [wasi-threads]
  410. run: |
  411. cd samples/wasi-threads
  412. mkdir build && cd build
  413. cmake ..
  414. cmake --build . --config Debug --parallel 4
  415. ./iwasm wasm-apps/no_pthread.wasm
  416. - name: Build Sample [shared-module]
  417. run: |
  418. cd samples/shared-module
  419. ./build.sh
  420. ./run.sh
  421. - name: Build Sample [terminate]
  422. run: |
  423. cd samples/terminate
  424. ./build.sh
  425. ./run.sh
  426. test:
  427. needs:
  428. [
  429. build_iwasm,
  430. build_llvm_libraries_on_ubuntu_2204,
  431. build_wamrc,
  432. ]
  433. runs-on: ${{ matrix.os }}
  434. strategy:
  435. fail-fast: false
  436. matrix:
  437. os: [ubuntu-22.04]
  438. running_mode:
  439. [
  440. "classic-interp",
  441. "fast-interp",
  442. "jit",
  443. "aot",
  444. "fast-jit",
  445. "multi-tier-jit",
  446. ]
  447. test_option:
  448. [
  449. $DEFAULT_TEST_OPTIONS,
  450. $MULTI_MODULES_TEST_OPTIONS,
  451. $SIMD_TEST_OPTIONS,
  452. $THREADS_TEST_OPTIONS,
  453. $WASI_TEST_OPTIONS,
  454. ]
  455. wasi_sdk_release:
  456. [
  457. "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz",
  458. ]
  459. include:
  460. - os: ubuntu-22.04
  461. llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
  462. ubuntu_version: "22.04"
  463. - os: ubuntu-22.04
  464. llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
  465. running_mode: aot
  466. test_option: $WAMR_COMPILER_TEST_OPTIONS
  467. exclude:
  468. # uncompatiable modes and features
  469. # classic-interp and fast-interp don't support simd
  470. - running_mode: "classic-interp"
  471. test_option: $SIMD_TEST_OPTIONS
  472. - running_mode: "fast-interp"
  473. test_option: $SIMD_TEST_OPTIONS
  474. # llvm jit doesn't support multi module
  475. - running_mode: "jit"
  476. test_option: $MULTI_MODULES_TEST_OPTIONS
  477. # fast-jit doesn't support multi module, simd
  478. - running_mode: "fast-jit"
  479. test_option: $MULTI_MODULES_TEST_OPTIONS
  480. - running_mode: "fast-jit"
  481. test_option: $SIMD_TEST_OPTIONS
  482. # multi-tier-jit doesn't support multi module, simd
  483. - running_mode: "multi-tier-jit"
  484. test_option: $MULTI_MODULES_TEST_OPTIONS
  485. - running_mode: "multi-tier-jit"
  486. test_option: $SIMD_TEST_OPTIONS
  487. steps:
  488. - name: checkout
  489. uses: actions/checkout@v4
  490. - name: download and install wasi-sdk
  491. if: matrix.test_option == '$WASI_TEST_OPTIONS'
  492. run: |
  493. cd /opt
  494. sudo wget ${{ matrix.wasi_sdk_release }}
  495. sudo tar -xzf wasi-sdk-*.tar.gz
  496. sudo mv wasi-sdk-20.0 wasi-sdk
  497. # It is a temporary solution until new wasi-sdk that includes bug fixes is released
  498. - name: build wasi-libc from source
  499. if: matrix.test_option == '$WASI_TEST_OPTIONS'
  500. run: |
  501. git clone https://github.com/WebAssembly/wasi-libc
  502. cd wasi-libc
  503. make -j AR=/opt/wasi-sdk/bin/llvm-ar NM=/opt/wasi-sdk/bin/llvm-nm CC=/opt/wasi-sdk/bin/clang THREAD_MODEL=posix
  504. echo "SYSROOT_PATH=$PWD/sysroot" >> $GITHUB_ENV
  505. - name: set env variable(if llvm are used)
  506. if: matrix.running_mode == 'aot' || matrix.running_mode == 'jit' || matrix.running_mode == 'multi-tier-jit'
  507. run: echo "USE_LLVM=true" >> $GITHUB_ENV
  508. - name: set env variable(if x86_32 test needed)
  509. if: >
  510. (matrix.test_option == '$DEFAULT_TEST_OPTIONS' || matrix.test_option == '$THREADS_TEST_OPTIONS'
  511. || matrix.test_option == '$WASI_TEST_OPTIONS')
  512. && matrix.running_mode != 'fast-jit' && matrix.running_mode != 'jit' && matrix.running_mode != 'multi-tier-jit'
  513. run: echo "TEST_ON_X86_32=true" >> $GITHUB_ENV
  514. #only download llvm libraries in jit and aot mode
  515. - name: Get LLVM libraries
  516. if: env.USE_LLVM == 'true'
  517. id: retrieve_llvm_libs
  518. uses: actions/cache@v4
  519. with:
  520. path: |
  521. ./core/deps/llvm/build/bin
  522. ./core/deps/llvm/build/include
  523. ./core/deps/llvm/build/lib
  524. ./core/deps/llvm/build/libexec
  525. ./core/deps/llvm/build/share
  526. key: ${{ matrix.llvm_cache_key }}
  527. - name: Quit if cache miss
  528. if: env.USE_LLVM == 'true' && steps.retrieve_llvm_libs.outputs.cache-hit != 'true'
  529. run: echo "::error::can not get prebuilt llvm libraries" && exit 1
  530. - name: install jq JSON processor
  531. if: matrix.running_mode == 'aot' && matrix.test_option == '$WASI_TEST_OPTIONS'
  532. run: sudo apt-get update && sudo apt install -y jq
  533. - name: Build WASI thread tests
  534. if: matrix.test_option == '$WASI_TEST_OPTIONS'
  535. run: bash build.sh --sysroot "$SYSROOT_PATH"
  536. working-directory: ./core/iwasm/libraries/lib-wasi-threads/test/
  537. - name: build socket api tests
  538. if: matrix.test_option == '$WASI_TEST_OPTIONS'
  539. run: bash build.sh
  540. working-directory: ./core/iwasm/libraries/lib-socket/test/
  541. - name: run tests
  542. timeout-minutes: 30
  543. run: ./test_wamr.sh ${{ matrix.test_option }} -t ${{ matrix.running_mode }}
  544. working-directory: ./tests/wamr-test-suites
  545. #only install x32 support libraries when to run x86_32 cases
  546. - name: install x32 support libraries
  547. if: env.TEST_ON_X86_32 == 'true'
  548. run:
  549. # Add another apt repository as some packages cannot
  550. # be downloaded with the github default repository
  551. sudo curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/apt/trusted.gpg.d/microsoft.asc &&
  552. sudo apt-add-repository https://packages.microsoft.com/ubuntu/${{ matrix.ubuntu_version }}/prod &&
  553. sudo apt-get update &&
  554. sudo apt install -y g++-multilib lib32gcc-9-dev
  555. - name: run tests x86_32
  556. timeout-minutes: 30
  557. if: env.TEST_ON_X86_32 == 'true'
  558. run: ./test_wamr.sh ${{ env.X86_32_TARGET_TEST_OPTIONS }} ${{ matrix.test_option }} -t ${{ matrix.running_mode }}
  559. working-directory: ./tests/wamr-test-suites
  560. test-wamr-ide:
  561. needs:
  562. [
  563. build_iwasm
  564. ]
  565. runs-on: ubuntu-22.04
  566. env:
  567. PYTHON_VERSION: '3.10'
  568. 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
  569. steps:
  570. - name: checkout
  571. uses: actions/checkout@v4
  572. - name: install dependencies
  573. run: |
  574. rustup target add wasm32-wasi
  575. sudo apt update && sudo apt-get install -y lld ninja-build
  576. npm install
  577. working-directory: test-tools/wamr-ide/VSCode-Extension
  578. - name: build iwasm with source debugging feature
  579. run: |
  580. mkdir build
  581. cd build
  582. cmake .. -DWAMR_BUILD_DEBUG_INTERP=1
  583. make
  584. working-directory: product-mini/platforms/linux
  585. - name: Cache LLDB
  586. id: cache-lldb
  587. uses: actions/cache@v4
  588. env:
  589. cache-name: cache-lldb-vscode
  590. with:
  591. path: test-tools/wamr-ide/VSCode-Extension/resource/debug/linux
  592. key: ${{ env.cache-name }}-${{ hashFiles('build-scripts/lldb_wasm.patch') }}-${{ env.PYTHON_UBUNTU_STANDALONE_BUILD }}
  593. - if: ${{ steps.cache-lldb.outputs.cache-hit != 'true' }}
  594. name: get stand-alone python ubuntu
  595. run: |
  596. wget ${{ env.PYTHON_UBUNTU_STANDALONE_BUILD }} -O python.tar.gz
  597. tar -xvf python.tar.gz
  598. working-directory: core/deps
  599. - if: ${{ steps.cache-lldb.outputs.cache-hit != 'true' }}
  600. name: download llvm
  601. run: |
  602. wget https://github.com/llvm/llvm-project/archive/1f27fe6128769f00197925c3b8f6abb9d0e5cd2e.zip
  603. unzip -q 1f27fe6128769f00197925c3b8f6abb9d0e5cd2e.zip
  604. mv llvm-project-1f27fe6128769f00197925c3b8f6abb9d0e5cd2e llvm-project
  605. working-directory: core/deps
  606. - if: ${{ steps.cache-lldb.outputs.cache-hit != 'true' }}
  607. name: apply wamr patch
  608. run: |
  609. git init
  610. git config user.email "action@github.com"
  611. git config user.name "github action"
  612. git apply ../../../build-scripts/lldb_wasm.patch
  613. working-directory: core/deps/llvm-project
  614. - if: ${{ steps.cache-lldb.outputs.cache-hit != 'true' }}
  615. name: build lldb ubuntu
  616. run: |
  617. echo "start to build lldb..."
  618. mkdir -p wamr-lldb
  619. cmake -S ./llvm -B build \
  620. -G Ninja \
  621. -DCMAKE_INSTALL_PREFIX=../wamr-lldb \
  622. -DCMAKE_BUILD_TYPE:STRING="Release" \
  623. -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
  624. -DLLVM_ENABLE_PROJECTS="clang;lldb" \
  625. -DLLVM_TARGETS_TO_BUILD:STRING="X86;WebAssembly" \
  626. -DLLVM_BUILD_BENCHMARKS:BOOL=OFF \
  627. -DLLVM_BUILD_DOCS:BOOL=OFF \
  628. -DLLVM_BUILD_EXAMPLES:BOOL=OFF \
  629. -DLLVM_BUILD_LLVM_DYLIB:BOOL=OFF \
  630. -DLLVM_BUILD_TESTS:BOOL=OFF \
  631. -DLLVM_INCLUDE_BENCHMARKS:BOOL=OFF \
  632. -DLLVM_INCLUDE_DOCS:BOOL=OFF \
  633. -DLLVM_INCLUDE_EXAMPLES:BOOL=OFF \
  634. -DLLVM_INCLUDE_TESTS:BOOL=OFF \
  635. -DLLVM_ENABLE_BINDINGS:BOOL=OFF \
  636. -DLLVM_ENABLE_LIBXML2:BOOL=ON \
  637. -DLLVM_ENABLE_LLD:BOOL=ON \
  638. -DLLDB_ENABLE_PYTHON:BOOL=ON \
  639. -DLLDB_EMBED_PYTHON_HOME=ON \
  640. -DLLDB_PYTHON_HOME=.. \
  641. -DLLDB_PYTHON_RELATIVE_PATH=lib/lldb-python \
  642. -DPython3_EXECUTABLE="$(pwd)/../python/bin/python${{ env.PYTHON_VERSION }}"
  643. cmake --build build --target lldb install --parallel $(nproc)
  644. working-directory: core/deps/llvm-project
  645. - if: ${{ steps.cache-lldb.outputs.cache-hit != 'true' }}
  646. name: copy lldb to extension folder
  647. run: |
  648. mkdir -p bin
  649. mkdir -p lib
  650. cp ../../../../../../core/deps/llvm-project/lldb/tools/lldb-vscode/package.json ./
  651. cp -r ../../../../../../core/deps/llvm-project/lldb/tools/lldb-vscode/syntaxes/ ./
  652. cp ../../../../../../core/deps/llvm-project/build/bin/lldb* bin
  653. cp ../../../../../../core/deps/llvm-project/build/lib/liblldb*.so lib
  654. cp ../../../../../../core/deps/llvm-project/build/lib/liblldb*.so.* lib
  655. cp -R ../../../../../../core/deps/llvm-project/build/lib/lldb-python lib
  656. cp -R ../../../../../../core/deps/python/lib/python* lib
  657. cp ../../../../../../core/deps/python/lib/libpython${{ env.PYTHON_VERSION }}.so.1.0 lib
  658. working-directory: test-tools/wamr-ide/VSCode-Extension/resource/debug/linux
  659. - name: run tests
  660. timeout-minutes: 5
  661. run: xvfb-run npm run test
  662. working-directory: test-tools/wamr-ide/VSCode-Extension