compilation_on_android_ubuntu.yml 28 KB

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