compilation_on_android_ubuntu.yml 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726
  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. - "tests/unit/**"
  21. - "wamr-compiler/**"
  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. - "tests/unit/**"
  39. - "wamr-compiler/**"
  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 -S -b -P"
  65. GC_TEST_OPTIONS: "-s spec -G -b -P"
  66. MEMORY64_TEST_OPTIONS: "-s spec -W -b -P"
  67. MULTI_MEMORY_TEST_OPTIONS: "-s spec -E -b -P"
  68. EXTENDED_CONST_EXPR_TEST_OPTIONS: "-s spec -N -b -P"
  69. permissions:
  70. contents: read
  71. jobs:
  72. check_version_h:
  73. permissions:
  74. contents: read
  75. actions: write
  76. uses: ./.github/workflows/check_version_h.yml
  77. build_llvm_libraries_on_ubuntu_2204:
  78. permissions:
  79. contents: read
  80. actions: write
  81. uses: ./.github/workflows/build_llvm_libraries.yml
  82. with:
  83. os: "ubuntu-22.04"
  84. arch: "X86"
  85. build_wamrc:
  86. needs:
  87. [build_llvm_libraries_on_ubuntu_2204]
  88. runs-on: ${{ matrix.os }}
  89. strategy:
  90. matrix:
  91. include:
  92. - os: ubuntu-22.04
  93. llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
  94. steps:
  95. - name: checkout
  96. uses: actions/checkout@v4
  97. # since jobs.id can't contain the dot character
  98. # it is hard to use `format` to assemble the cache key
  99. - name: Get LLVM libraries
  100. id: retrieve_llvm_libs
  101. uses: actions/cache@v4
  102. with:
  103. path: |
  104. ./core/deps/llvm/build/bin
  105. ./core/deps/llvm/build/include
  106. ./core/deps/llvm/build/lib
  107. ./core/deps/llvm/build/libexec
  108. ./core/deps/llvm/build/share
  109. key: ${{ matrix.llvm_cache_key }}
  110. - name: Quit if cache miss
  111. if: steps.retrieve_llvm_libs.outputs.cache-hit != 'true'
  112. run: echo "::error::can not get prebuilt llvm libraries" && exit 1
  113. - name: Build wamrc
  114. run: |
  115. mkdir build && cd build
  116. cmake ..
  117. cmake --build . --config Release --parallel 4
  118. working-directory: wamr-compiler
  119. build_iwasm:
  120. needs:
  121. [build_llvm_libraries_on_ubuntu_2204]
  122. runs-on: ${{ matrix.os }}
  123. strategy:
  124. matrix:
  125. make_options_run_mode: [
  126. # Running mode
  127. $AOT_BUILD_OPTIONS,
  128. $CLASSIC_INTERP_BUILD_OPTIONS,
  129. $FAST_INTERP_BUILD_OPTIONS,
  130. $FAST_JIT_BUILD_OPTIONS,
  131. $LLVM_LAZY_JIT_BUILD_OPTIONS,
  132. $LLVM_EAGER_JIT_BUILD_OPTIONS,
  133. $MULTI_TIER_JIT_BUILD_OPTIONS,
  134. ]
  135. make_options_feature: [
  136. # Features
  137. "-DWAMR_BUILD_CUSTOM_NAME_SECTION=1",
  138. "-DWAMR_BUILD_DEBUG_AOT=1",
  139. "-DWAMR_BUILD_DEBUG_INTERP=1",
  140. "-DWAMR_BUILD_DUMP_CALL_STACK=1",
  141. "-DWAMR_BUILD_LIB_PTHREAD=1",
  142. "-DWAMR_BUILD_LIB_WASI_THREADS=1",
  143. "-DWAMR_BUILD_LOAD_CUSTOM_SECTION=1",
  144. "-DWAMR_BUILD_MINI_LOADER=1",
  145. "-DWAMR_BUILD_MEMORY_PROFILING=1",
  146. "-DWAMR_BUILD_MULTI_MODULE=1",
  147. "-DWAMR_BUILD_PERF_PROFILING=1",
  148. "-DWAMR_BUILD_REF_TYPES=1",
  149. "-DWAMR_BUILD_SIMD=1",
  150. "-DWAMR_BUILD_LIB_SIMDE=1",
  151. "-DWAMR_BUILD_TAIL_CALL=1",
  152. "-DWAMR_DISABLE_HW_BOUND_CHECK=1",
  153. "-DWAMR_BUILD_MEMORY64=1",
  154. "-DWAMR_BUILD_MULTI_MEMORY=1",
  155. "-DWAMR_BUILD_SHARED=1",
  156. "-DWAMR_BUILD_EXTENDED_CONST_EXPR=1",
  157. ]
  158. os: [ubuntu-22.04]
  159. platform: [android, linux]
  160. exclude:
  161. # incompatible feature and platform
  162. # incompatible mode and feature
  163. # MULTI_MODULE only on INTERP mode and AOT mode
  164. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  165. make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
  166. - make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
  167. make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
  168. - make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
  169. make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
  170. - make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
  171. make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
  172. # SIMD only on JIT/AOT/fast interpreter mode
  173. - make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS
  174. make_options_feature: "-DWAMR_BUILD_SIMD=1"
  175. # DEBUG_INTERP only on CLASSIC INTERP mode
  176. - make_options_run_mode: $AOT_BUILD_OPTIONS
  177. make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
  178. - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
  179. make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
  180. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  181. make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
  182. - make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
  183. make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
  184. - make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
  185. make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
  186. - make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
  187. make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
  188. # DEBUG_AOT only on JIT/AOT mode
  189. - make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS
  190. make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
  191. - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
  192. make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
  193. # TODO: DEBUG_AOT on JIT
  194. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  195. make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
  196. - make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
  197. make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
  198. - make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
  199. make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
  200. - make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
  201. make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
  202. # MINI_LOADER only on INTERP mode
  203. - make_options_run_mode: $AOT_BUILD_OPTIONS
  204. make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
  205. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  206. make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
  207. - make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
  208. make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
  209. - make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
  210. make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
  211. - make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
  212. make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
  213. # Memory64 only on CLASSIC INTERP and AOT mode, and only on 64-bit platform
  214. - make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
  215. platform: android
  216. - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
  217. make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
  218. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  219. make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
  220. - make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
  221. make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
  222. - make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
  223. make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
  224. - make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
  225. make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
  226. # Multi memory only on CLASSIC INTERP mode, and only on 64-bit platform
  227. - make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
  228. platform: android
  229. - make_options_run_mode: $AOT_BUILD_OPTIONS
  230. make_options_feature: "-DWAMR_BUILD_MULTI_MEMORY=1"
  231. - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
  232. make_options_feature: "-DWAMR_BUILD_MULTI_MEMORY=1"
  233. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  234. make_options_feature: "-DWAMR_BUILD_MULTI_MEMORY=1"
  235. - make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
  236. make_options_feature: "-DWAMR_BUILD_MULTI_MEMORY=1"
  237. - make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
  238. make_options_feature: "-DWAMR_BUILD_MULTI_MEMORY=1"
  239. - make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
  240. make_options_feature: "-DWAMR_BUILD_MULTI_MEMORY=1"
  241. # Fast-JIT and Multi-Tier-JIT mode don't support android
  242. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  243. platform: android
  244. - make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
  245. platform: android
  246. # LLVM JIT pre-built binary wasn't compiled by Android NDK
  247. # and isn't available for android
  248. - make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
  249. platform: android
  250. - make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
  251. platform: android
  252. # android does not support WAMR_BUILD_SHARED in its CMakeLists.txt.
  253. - make_options_feature: "-DWAMR_BUILD_SHARED=1"
  254. platform: android
  255. include:
  256. - os: ubuntu-22.04
  257. llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
  258. steps:
  259. - name: checkout
  260. uses: actions/checkout@v4
  261. # only download llvm cache when needed
  262. - name: Get LLVM libraries
  263. id: retrieve_llvm_libs
  264. if: endsWith(matrix.make_options_run_mode, '_JIT_BUILD_OPTIONS')
  265. uses: actions/cache@v4
  266. with:
  267. path: |
  268. ./core/deps/llvm/build/bin
  269. ./core/deps/llvm/build/include
  270. ./core/deps/llvm/build/lib
  271. ./core/deps/llvm/build/libexec
  272. ./core/deps/llvm/build/share
  273. key: ${{ matrix.llvm_cache_key }}
  274. - name: Quit if cache miss
  275. if: endsWith(matrix.make_options_run_mode, '_JIT_BUILD_OPTIONS') && (steps.retrieve_llvm_libs.outputs.cache-hit != 'true')
  276. run: echo "::error::can not get prebuilt llvm libraries" && exit 1
  277. - name: Build iwasm for linux
  278. if: matrix.platform == 'linux'
  279. run: |
  280. mkdir build && cd build
  281. cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }}
  282. cmake --build . --config Release --parallel 4
  283. working-directory: product-mini/platforms/${{ matrix.platform }}
  284. - name: Build iwasm for android
  285. if: matrix.platform == 'android'
  286. run: |
  287. mkdir build && cd build
  288. cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }} \
  289. -DWAMR_BUILD_TARGET=X86_64
  290. cmake --build . --config Release --parallel 4
  291. working-directory: product-mini/platforms/${{ matrix.platform }}
  292. build_unit_tests:
  293. needs:
  294. [
  295. build_llvm_libraries_on_ubuntu_2204,
  296. build_wamrc
  297. ]
  298. runs-on: ${{ matrix.os }}
  299. strategy:
  300. fail-fast: false
  301. matrix:
  302. os: [ubuntu-22.04]
  303. build_target: [
  304. "X86_64",
  305. "X86_32",
  306. ]
  307. include:
  308. - os: ubuntu-22.04
  309. llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
  310. steps:
  311. - name: checkout
  312. uses: actions/checkout@v4
  313. - name: Get LLVM libraries
  314. id: retrieve_llvm_libs
  315. uses: actions/cache@v4
  316. with:
  317. path: |
  318. ./core/deps/llvm/build/bin
  319. ./core/deps/llvm/build/include
  320. ./core/deps/llvm/build/lib
  321. ./core/deps/llvm/build/libexec
  322. ./core/deps/llvm/build/share
  323. key: ${{ matrix.llvm_cache_key }}
  324. - name: Quit if cache miss
  325. if: (steps.retrieve_llvm_libs.outputs.cache-hit != 'true')
  326. run: echo "::error::can not get prebuilt llvm libraries" && exit 1
  327. - name: install-wasi-sdk-wabt
  328. uses: ./.github/actions/install-wasi-sdk-wabt
  329. with:
  330. os: ${{ matrix.os }}
  331. - name: Build wamrc
  332. run: |
  333. mkdir build && cd build
  334. cmake ..
  335. cmake --build . --config Release --parallel 4
  336. working-directory: wamr-compiler
  337. - name: Install dependencies for X86_32
  338. if: matrix.build_target == 'X86_32'
  339. run: |
  340. sudo apt-get update
  341. sudo apt-get install -y g++-multilib
  342. - name: Build and run unit tests
  343. run: |
  344. mkdir build && cd build
  345. cmake .. -DWAMR_BUILD_TARGET=${{ matrix.build_target }}
  346. cmake --build . --config Release --parallel 4
  347. ctest
  348. working-directory: tests/unit
  349. build_samples_wasm_c_api:
  350. needs:
  351. [
  352. build_iwasm,
  353. build_llvm_libraries_on_ubuntu_2204,
  354. build_wamrc,
  355. ]
  356. runs-on: ${{ matrix.os }}
  357. strategy:
  358. fail-fast: false
  359. matrix:
  360. make_options: [
  361. # Running mode
  362. $AOT_BUILD_OPTIONS,
  363. $CLASSIC_INTERP_BUILD_OPTIONS,
  364. $FAST_INTERP_BUILD_OPTIONS,
  365. $FAST_JIT_BUILD_OPTIONS,
  366. $LLVM_LAZY_JIT_BUILD_OPTIONS,
  367. $LLVM_EAGER_JIT_BUILD_OPTIONS,
  368. $MULTI_TIER_JIT_BUILD_OPTIONS,
  369. ]
  370. os: [ubuntu-22.04]
  371. include:
  372. - os: ubuntu-22.04
  373. llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
  374. steps:
  375. - name: checkout
  376. uses: actions/checkout@v4
  377. - name: Get LLVM libraries
  378. id: retrieve_llvm_libs
  379. if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS'))
  380. uses: actions/cache@v4
  381. with:
  382. path: |
  383. ./core/deps/llvm/build/bin
  384. ./core/deps/llvm/build/include
  385. ./core/deps/llvm/build/lib
  386. ./core/deps/llvm/build/libexec
  387. ./core/deps/llvm/build/share
  388. key: ${{ matrix.llvm_cache_key }}
  389. - name: Quit if cache miss
  390. if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS')) && (steps.retrieve_llvm_libs.outputs.cache-hit != 'true')
  391. run: echo "::error::can not get prebuilt llvm libraries" && exit 1
  392. - name: install-wasi-sdk-wabt
  393. uses: ./.github/actions/install-wasi-sdk-wabt
  394. with:
  395. os: ${{ matrix.os }}
  396. - name: Build wamrc
  397. if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS'))
  398. run: |
  399. mkdir build && cd build
  400. cmake ..
  401. cmake --build . --config Release --parallel 4
  402. working-directory: wamr-compiler
  403. - name: Build Sample [wasm-c-api]
  404. run: |
  405. VERBOSE=1
  406. cmake -S . -B build ${{ matrix.make_options }}
  407. cmake --build build --config Debug --parallel 4
  408. ctest --test-dir build --output-on-failure
  409. working-directory: samples/wasm-c-api
  410. - name: Build Sample [printversion]
  411. run: |
  412. ./test.sh
  413. working-directory: samples/printversion
  414. build_samples_others:
  415. needs:
  416. [
  417. build_iwasm,
  418. build_llvm_libraries_on_ubuntu_2204,
  419. build_wamrc,
  420. ]
  421. runs-on: ${{ matrix.os }}
  422. strategy:
  423. matrix:
  424. os: [ubuntu-22.04]
  425. include:
  426. - os: ubuntu-22.04
  427. llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
  428. steps:
  429. - name: checkout
  430. uses: actions/checkout@v4
  431. - name: Get LLVM libraries
  432. id: retrieve_llvm_libs
  433. uses: actions/cache@v4
  434. with:
  435. path: |
  436. ./core/deps/llvm/build/bin
  437. ./core/deps/llvm/build/include
  438. ./core/deps/llvm/build/lib
  439. ./core/deps/llvm/build/libexec
  440. ./core/deps/llvm/build/share
  441. key: ${{ matrix.llvm_cache_key }}
  442. - name: install-wasi-sdk-wabt
  443. uses: ./.github/actions/install-wasi-sdk-wabt
  444. with:
  445. os: ${{ matrix.os }}
  446. - name: Build wamrc
  447. run: |
  448. mkdir build && cd build
  449. cmake ..
  450. cmake --build . --config Release --parallel 4
  451. working-directory: wamr-compiler
  452. - name: Build Sample [basic]
  453. run: |
  454. cd samples/basic
  455. ./build.sh
  456. ./run.sh
  457. - name: Build Sample [file]
  458. run: |
  459. cd samples/file
  460. mkdir build && cd build
  461. cmake ..
  462. cmake --build . --config Debug --parallel 4
  463. ./src/iwasm -f wasm-app/file.wasm -d .
  464. - name: Build Sample [multi-thread]
  465. run: |
  466. cd samples/multi-thread
  467. mkdir build && cd build
  468. cmake ..
  469. cmake --build . --config Debug --parallel 4
  470. ./iwasm wasm-apps/test.wasm
  471. - name: Build Sample [multi-module]
  472. run: |
  473. cd samples/multi-module
  474. mkdir build && cd build
  475. cmake .. -DWAMR_BUILD_AOT=1
  476. cmake --build . --config Debug --parallel 4
  477. ./multi_module mC.wasm
  478. ./multi_module mC.aot
  479. - name: Build Sample [spawn-thread]
  480. run: |
  481. cd samples/spawn-thread
  482. mkdir build && cd build
  483. cmake ..
  484. cmake --build . --config Debug --parallel 4
  485. ./spawn_thread
  486. - name: Build Sample [ref-types]
  487. run: |
  488. cd samples/ref-types
  489. mkdir build && cd build
  490. cmake ..
  491. cmake --build . --config Debug --parallel 4
  492. ./hello
  493. - name: Build Sample [wasi-threads]
  494. run: |
  495. cd samples/wasi-threads
  496. mkdir build && cd build
  497. cmake ..
  498. cmake --build . --config Debug --parallel 4
  499. ./iwasm wasm-apps/no_pthread.wasm
  500. - name: Build Sample [shared-module]
  501. run: |
  502. cd samples/shared-module
  503. ./build.sh
  504. ./run.sh
  505. - name: Build Sample [terminate]
  506. run: |
  507. cd samples/terminate
  508. ./build.sh
  509. ./run.sh
  510. - name: Build Sample [debug-tools]
  511. run: |
  512. cd samples/debug-tools
  513. mkdir build && cd build
  514. cmake ..
  515. cmake --build . --config Debug --parallel 4
  516. ./iwasm wasm-apps/trap.wasm | grep "#" > call_stack.txt
  517. ./iwasm wasm-apps/trap.aot | grep "#" > call_stack_aot.txt
  518. bash -x ../symbolicate.sh
  519. - name: Build Sample [native-stack-overflow]
  520. run: |
  521. cd samples/native-stack-overflow
  522. ./build.sh
  523. ./run.sh test1
  524. ./run.sh test2
  525. - name: Build Sample [shared-heap]
  526. run: |
  527. cd samples/shared-heap
  528. mkdir build && cd build
  529. cmake ..
  530. cmake --build . --config Debug --parallel 4
  531. ./shared_heap_test
  532. ./shared_heap_test --aot
  533. test:
  534. needs:
  535. [
  536. build_iwasm,
  537. build_llvm_libraries_on_ubuntu_2204,
  538. build_wamrc,
  539. ]
  540. runs-on: ${{ matrix.os }}
  541. strategy:
  542. fail-fast: false
  543. matrix:
  544. os: [ubuntu-22.04]
  545. running_mode:
  546. [
  547. "classic-interp",
  548. "fast-interp",
  549. "jit",
  550. "aot",
  551. "fast-jit",
  552. "multi-tier-jit",
  553. ]
  554. test_option:
  555. [
  556. $DEFAULT_TEST_OPTIONS,
  557. $MULTI_MODULES_TEST_OPTIONS,
  558. $SIMD_TEST_OPTIONS,
  559. $THREADS_TEST_OPTIONS,
  560. $WASI_TEST_OPTIONS,
  561. $GC_TEST_OPTIONS,
  562. $MEMORY64_TEST_OPTIONS,
  563. $MULTI_MEMORY_TEST_OPTIONS,
  564. $EXTENDED_CONST_EXPR_TEST_OPTIONS,
  565. ]
  566. include:
  567. - os: ubuntu-22.04
  568. llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
  569. ubuntu_version: "22.04"
  570. - os: ubuntu-22.04
  571. llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
  572. running_mode: aot
  573. test_option: $WAMR_COMPILER_TEST_OPTIONS
  574. steps:
  575. - name: checkout
  576. uses: actions/checkout@v4
  577. - name: Set-up OCaml
  578. uses: ocaml/setup-ocaml@v3
  579. if: matrix.test_option == '$GC_TEST_OPTIONS'
  580. with:
  581. ocaml-compiler: 4.13
  582. - name: Set-up Ocamlbuild
  583. if: matrix.test_option == '$GC_TEST_OPTIONS'
  584. run: opam install ocamlbuild dune menhir
  585. - name: download and install wasi-sdk
  586. if: matrix.test_option == '$WASI_TEST_OPTIONS'
  587. uses: ./.github/actions/install-wasi-sdk-wabt
  588. with:
  589. os: ${{ matrix.os }}
  590. - name: set env variable(if llvm are used)
  591. if: matrix.running_mode == 'aot' || matrix.running_mode == 'jit' || matrix.running_mode == 'multi-tier-jit'
  592. run: echo "USE_LLVM=true" >> $GITHUB_ENV
  593. - name: set env variable(if x86_32 test needed)
  594. if: >
  595. ((matrix.test_option == '$DEFAULT_TEST_OPTIONS' || matrix.test_option == '$THREADS_TEST_OPTIONS'
  596. || matrix.test_option == '$WASI_TEST_OPTIONS' || matrix.test_option == '$GC_TEST_OPTIONS')
  597. && matrix.test_option != '$MEMORY64_TEST_OPTIONS'
  598. && matrix.running_mode != 'fast-jit' && matrix.running_mode != 'jit' && matrix.running_mode != 'multi-tier-jit')
  599. run: echo "TEST_ON_X86_32=true" >> $GITHUB_ENV
  600. #only download llvm libraries in jit and aot mode
  601. - name: Get LLVM libraries
  602. if: env.USE_LLVM == 'true'
  603. id: retrieve_llvm_libs
  604. uses: actions/cache@v4
  605. with:
  606. path: |
  607. ./core/deps/llvm/build/bin
  608. ./core/deps/llvm/build/include
  609. ./core/deps/llvm/build/lib
  610. ./core/deps/llvm/build/libexec
  611. ./core/deps/llvm/build/share
  612. key: ${{ matrix.llvm_cache_key }}
  613. - name: Quit if cache miss
  614. if: env.USE_LLVM == 'true' && steps.retrieve_llvm_libs.outputs.cache-hit != 'true'
  615. run: echo "::error::can not get prebuilt llvm libraries" && exit 1
  616. - name: install jq JSON processor
  617. if: matrix.running_mode == 'aot' && matrix.test_option == '$WASI_TEST_OPTIONS'
  618. run: sudo apt-get update && sudo apt install -y jq
  619. - name: Build WASI thread tests
  620. if: matrix.test_option == '$WASI_TEST_OPTIONS'
  621. run: bash build.sh
  622. working-directory: ./core/iwasm/libraries/lib-wasi-threads/test/
  623. - name: build socket api tests
  624. if: matrix.test_option == '$WASI_TEST_OPTIONS'
  625. run: bash build.sh
  626. working-directory: ./core/iwasm/libraries/lib-socket/test/
  627. - name: run tests
  628. timeout-minutes: 30
  629. if: matrix.test_option != '$GC_TEST_OPTIONS'
  630. run: ./test_wamr.sh ${{ matrix.test_option }} -t ${{ matrix.running_mode }}
  631. working-directory: ./tests/wamr-test-suites
  632. - name: run gc tests
  633. timeout-minutes: 20
  634. if: matrix.test_option == '$GC_TEST_OPTIONS'
  635. run: |
  636. eval $(opam env)
  637. ./test_wamr.sh ${{ matrix.test_option }} -t ${{ matrix.running_mode }}
  638. working-directory: ./tests/wamr-test-suites
  639. #only install x32 support libraries when to run x86_32 cases
  640. - name: install x32 support libraries
  641. if: env.TEST_ON_X86_32 == 'true'
  642. run:
  643. # Add another apt repository as some packages cannot
  644. # be downloaded with the github default repository
  645. sudo curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/apt/trusted.gpg.d/microsoft.asc &&
  646. sudo apt-add-repository https://packages.microsoft.com/ubuntu/${{ matrix.ubuntu_version }}/prod &&
  647. sudo apt-get update &&
  648. sudo apt install -y g++-multilib lib32gcc-9-dev
  649. - name: run tests x86_32
  650. timeout-minutes: 30
  651. if: env.TEST_ON_X86_32 == 'true' && matrix.test_option != '$GC_TEST_OPTIONS'
  652. run: ./test_wamr.sh ${{ env.X86_32_TARGET_TEST_OPTIONS }} ${{ matrix.test_option }} -t ${{ matrix.running_mode }}
  653. working-directory: ./tests/wamr-test-suites
  654. - name: run gc tests x86_32
  655. timeout-minutes: 20
  656. if: env.TEST_ON_X86_32 == 'true' && matrix.test_option == '$GC_TEST_OPTIONS'
  657. run: |
  658. eval $(opam env)
  659. ./test_wamr.sh ${{ env.X86_32_TARGET_TEST_OPTIONS }} ${{ matrix.test_option }} -t ${{ matrix.running_mode }}
  660. working-directory: ./tests/wamr-test-suites