compilation_on_android_ubuntu.yml 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767
  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@v5
  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 .. -DCMAKE_C_FLAGS="-Werror"
  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@v5
  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 .. -DCMAKE_C_FLAGS="-Werror" ${{ 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 .. -DCMAKE_C_FLAGS="-Werror" ${{ 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@v5
  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_regression_tests:
  350. needs:
  351. [build_llvm_libraries_on_ubuntu_2204]
  352. runs-on: ${{ matrix.os }}
  353. strategy:
  354. matrix:
  355. os: [ubuntu-22.04]
  356. include:
  357. - os: ubuntu-22.04
  358. llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
  359. steps:
  360. - name: checkout
  361. uses: actions/checkout@v5
  362. - name: Get LLVM libraries
  363. id: retrieve_llvm_libs
  364. uses: actions/cache@v4
  365. with:
  366. path: |
  367. ./core/deps/llvm/build/bin
  368. ./core/deps/llvm/build/include
  369. ./core/deps/llvm/build/lib
  370. ./core/deps/llvm/build/libexec
  371. ./core/deps/llvm/build/share
  372. key: ${{ matrix.llvm_cache_key }}
  373. - name: Quit if cache miss
  374. if: (steps.retrieve_llvm_libs.outputs.cache-hit != 'true')
  375. run: echo "::error::can not get prebuilt llvm libraries" && exit 1
  376. - name: Build wamrc and iwasm
  377. run: |
  378. ./build_wamr.sh
  379. working-directory: tests/regression/ba-issues
  380. - name: Run regression tests
  381. run: |
  382. python run.py
  383. working-directory: tests/regression/ba-issues
  384. build_samples_wasm_c_api:
  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. make_options: [
  396. # Running mode
  397. $AOT_BUILD_OPTIONS,
  398. $CLASSIC_INTERP_BUILD_OPTIONS,
  399. $FAST_INTERP_BUILD_OPTIONS,
  400. $FAST_JIT_BUILD_OPTIONS,
  401. $LLVM_LAZY_JIT_BUILD_OPTIONS,
  402. $LLVM_EAGER_JIT_BUILD_OPTIONS,
  403. $MULTI_TIER_JIT_BUILD_OPTIONS,
  404. ]
  405. os: [ubuntu-22.04]
  406. include:
  407. - os: ubuntu-22.04
  408. llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
  409. steps:
  410. - name: checkout
  411. uses: actions/checkout@v5
  412. - name: Get LLVM libraries
  413. id: retrieve_llvm_libs
  414. if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS'))
  415. uses: actions/cache@v4
  416. with:
  417. path: |
  418. ./core/deps/llvm/build/bin
  419. ./core/deps/llvm/build/include
  420. ./core/deps/llvm/build/lib
  421. ./core/deps/llvm/build/libexec
  422. ./core/deps/llvm/build/share
  423. key: ${{ matrix.llvm_cache_key }}
  424. - name: Quit if cache miss
  425. if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS')) && (steps.retrieve_llvm_libs.outputs.cache-hit != 'true')
  426. run: echo "::error::can not get prebuilt llvm libraries" && exit 1
  427. - name: install-wasi-sdk-wabt
  428. uses: ./.github/actions/install-wasi-sdk-wabt
  429. with:
  430. os: ${{ matrix.os }}
  431. - name: Build wamrc
  432. if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS'))
  433. run: |
  434. mkdir build && cd build
  435. cmake ..
  436. cmake --build . --config Release --parallel 4
  437. working-directory: wamr-compiler
  438. - name: Build Sample [wasm-c-api]
  439. run: |
  440. VERBOSE=1
  441. cmake -S . -B build ${{ matrix.make_options }}
  442. cmake --build build --config Debug --parallel 4
  443. ctest --test-dir build --output-on-failure
  444. working-directory: samples/wasm-c-api
  445. - name: Build Sample [printversion]
  446. run: |
  447. ./test.sh
  448. working-directory: samples/printversion
  449. build_samples_others:
  450. needs:
  451. [
  452. build_iwasm,
  453. build_llvm_libraries_on_ubuntu_2204,
  454. build_wamrc,
  455. ]
  456. runs-on: ${{ matrix.os }}
  457. strategy:
  458. matrix:
  459. os: [ubuntu-22.04]
  460. include:
  461. - os: ubuntu-22.04
  462. llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
  463. steps:
  464. - name: checkout
  465. uses: actions/checkout@v5
  466. - name: Get LLVM libraries
  467. id: retrieve_llvm_libs
  468. uses: actions/cache@v4
  469. with:
  470. path: |
  471. ./core/deps/llvm/build/bin
  472. ./core/deps/llvm/build/include
  473. ./core/deps/llvm/build/lib
  474. ./core/deps/llvm/build/libexec
  475. ./core/deps/llvm/build/share
  476. key: ${{ matrix.llvm_cache_key }}
  477. - name: install-wasi-sdk-wabt
  478. uses: ./.github/actions/install-wasi-sdk-wabt
  479. with:
  480. os: ${{ matrix.os }}
  481. - name: Build wamrc
  482. run: |
  483. mkdir build && cd build
  484. cmake ..
  485. cmake --build . --config Release --parallel 4
  486. working-directory: wamr-compiler
  487. - name: Build Sample [basic]
  488. run: |
  489. cd samples/basic
  490. ./build.sh
  491. ./run.sh
  492. - name: Build Sample [file]
  493. run: |
  494. cd samples/file
  495. mkdir build && cd build
  496. cmake ..
  497. cmake --build . --config Debug --parallel 4
  498. ./src/iwasm -f wasm-app/file.wasm -d .
  499. - name: Build Sample [multi-thread]
  500. run: |
  501. cd samples/multi-thread
  502. mkdir build && cd build
  503. cmake ..
  504. cmake --build . --config Debug --parallel 4
  505. ./iwasm wasm-apps/test.wasm
  506. - name: Build Sample [multi-module]
  507. run: |
  508. cd samples/multi-module
  509. mkdir build && cd build
  510. cmake .. -DWAMR_BUILD_AOT=1
  511. cmake --build . --config Debug --parallel 4
  512. ./multi_module mC.wasm
  513. ./multi_module mC.aot
  514. - name: Build Sample [spawn-thread]
  515. run: |
  516. cd samples/spawn-thread
  517. mkdir build && cd build
  518. cmake ..
  519. cmake --build . --config Debug --parallel 4
  520. ./spawn_thread
  521. - name: Build Sample [ref-types]
  522. run: |
  523. cd samples/ref-types
  524. mkdir build && cd build
  525. cmake ..
  526. cmake --build . --config Debug --parallel 4
  527. ./hello
  528. - name: Build Sample [wasi-threads]
  529. run: |
  530. cd samples/wasi-threads
  531. mkdir build && cd build
  532. cmake ..
  533. cmake --build . --config Debug --parallel 4
  534. ./iwasm wasm-apps/no_pthread.wasm
  535. - name: Build Sample [shared-module]
  536. run: |
  537. cd samples/shared-module
  538. ./build.sh
  539. ./run.sh
  540. - name: Build Sample [terminate]
  541. run: |
  542. cd samples/terminate
  543. ./build.sh
  544. ./run.sh
  545. - name: Build Sample [debug-tools]
  546. run: |
  547. cd samples/debug-tools
  548. mkdir build && cd build
  549. cmake ..
  550. cmake --build . --config Debug --parallel 4
  551. ./iwasm wasm-apps/trap.wasm | grep "#" > call_stack.txt
  552. ./iwasm wasm-apps/trap.aot | grep "#" > call_stack_aot.txt
  553. bash -x ../symbolicate.sh
  554. - name: Build Sample [native-stack-overflow]
  555. run: |
  556. cd samples/native-stack-overflow
  557. ./build.sh
  558. ./run.sh test1
  559. ./run.sh test2
  560. - name: Build Sample [shared-heap]
  561. run: |
  562. cd samples/shared-heap
  563. mkdir build && cd build
  564. cmake ..
  565. cmake --build . --config Debug --parallel 4
  566. ./shared_heap_test
  567. ./shared_heap_test --aot
  568. test:
  569. needs:
  570. [
  571. build_iwasm,
  572. build_llvm_libraries_on_ubuntu_2204,
  573. build_wamrc,
  574. ]
  575. runs-on: ${{ matrix.os }}
  576. strategy:
  577. fail-fast: false
  578. matrix:
  579. os: [ubuntu-22.04]
  580. running_mode:
  581. [
  582. "classic-interp",
  583. "fast-interp",
  584. "jit",
  585. "aot",
  586. "fast-jit",
  587. "multi-tier-jit",
  588. ]
  589. test_option:
  590. [
  591. $DEFAULT_TEST_OPTIONS,
  592. $MULTI_MODULES_TEST_OPTIONS,
  593. $SIMD_TEST_OPTIONS,
  594. $THREADS_TEST_OPTIONS,
  595. $WASI_TEST_OPTIONS,
  596. $GC_TEST_OPTIONS,
  597. $MEMORY64_TEST_OPTIONS,
  598. $MULTI_MEMORY_TEST_OPTIONS,
  599. $EXTENDED_CONST_EXPR_TEST_OPTIONS,
  600. ]
  601. include:
  602. - os: ubuntu-22.04
  603. llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
  604. ubuntu_version: "22.04"
  605. - os: ubuntu-22.04
  606. llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
  607. running_mode: aot
  608. test_option: $WAMR_COMPILER_TEST_OPTIONS
  609. steps:
  610. - name: checkout
  611. uses: actions/checkout@v5
  612. - name: Set-up OCaml
  613. uses: ocaml/setup-ocaml@v3
  614. if: matrix.test_option == '$GC_TEST_OPTIONS'
  615. with:
  616. ocaml-compiler: 4.13
  617. - name: Set-up Ocamlbuild
  618. if: matrix.test_option == '$GC_TEST_OPTIONS'
  619. run: opam install ocamlbuild dune menhir
  620. - name: download and install wasi-sdk
  621. if: matrix.test_option == '$WASI_TEST_OPTIONS'
  622. uses: ./.github/actions/install-wasi-sdk-wabt
  623. with:
  624. os: ${{ matrix.os }}
  625. - name: set env variable(if llvm are used)
  626. if: matrix.running_mode == 'aot' || matrix.running_mode == 'jit' || matrix.running_mode == 'multi-tier-jit'
  627. run: echo "USE_LLVM=true" >> $GITHUB_ENV
  628. - name: set env variable(if x86_32 test needed)
  629. if: >
  630. ((matrix.test_option == '$DEFAULT_TEST_OPTIONS' || matrix.test_option == '$THREADS_TEST_OPTIONS'
  631. || matrix.test_option == '$WASI_TEST_OPTIONS' || matrix.test_option == '$GC_TEST_OPTIONS')
  632. && matrix.test_option != '$MEMORY64_TEST_OPTIONS'
  633. && matrix.running_mode != 'fast-jit' && matrix.running_mode != 'jit' && matrix.running_mode != 'multi-tier-jit')
  634. run: echo "TEST_ON_X86_32=true" >> $GITHUB_ENV
  635. #only download llvm libraries in jit and aot mode
  636. - name: Get LLVM libraries
  637. if: env.USE_LLVM == 'true'
  638. id: retrieve_llvm_libs
  639. uses: actions/cache@v4
  640. with:
  641. path: |
  642. ./core/deps/llvm/build/bin
  643. ./core/deps/llvm/build/include
  644. ./core/deps/llvm/build/lib
  645. ./core/deps/llvm/build/libexec
  646. ./core/deps/llvm/build/share
  647. key: ${{ matrix.llvm_cache_key }}
  648. - name: Quit if cache miss
  649. if: env.USE_LLVM == 'true' && steps.retrieve_llvm_libs.outputs.cache-hit != 'true'
  650. run: echo "::error::can not get prebuilt llvm libraries" && exit 1
  651. - name: install jq JSON processor
  652. if: matrix.running_mode == 'aot' && matrix.test_option == '$WASI_TEST_OPTIONS'
  653. run: sudo apt-get update && sudo apt install -y jq
  654. - name: Build WASI thread tests
  655. if: matrix.test_option == '$WASI_TEST_OPTIONS'
  656. run: bash build.sh
  657. working-directory: ./core/iwasm/libraries/lib-wasi-threads/test/
  658. - name: build socket api tests
  659. if: matrix.test_option == '$WASI_TEST_OPTIONS'
  660. run: bash build.sh
  661. working-directory: ./core/iwasm/libraries/lib-socket/test/
  662. - name: run tests
  663. timeout-minutes: 30
  664. if: matrix.test_option != '$GC_TEST_OPTIONS'
  665. run: ./test_wamr.sh ${{ matrix.test_option }} -t ${{ matrix.running_mode }}
  666. working-directory: ./tests/wamr-test-suites
  667. - name: run gc tests
  668. timeout-minutes: 20
  669. if: matrix.test_option == '$GC_TEST_OPTIONS'
  670. run: |
  671. eval $(opam env)
  672. ./test_wamr.sh ${{ matrix.test_option }} -t ${{ matrix.running_mode }}
  673. working-directory: ./tests/wamr-test-suites
  674. #only install x32 support libraries when to run x86_32 cases
  675. - name: install x32 support libraries
  676. if: env.TEST_ON_X86_32 == 'true'
  677. run:
  678. # Add another apt repository as some packages cannot
  679. # be downloaded with the github default repository
  680. sudo curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/apt/trusted.gpg.d/microsoft.asc &&
  681. sudo apt-add-repository https://packages.microsoft.com/ubuntu/${{ matrix.ubuntu_version }}/prod &&
  682. sudo apt-get update &&
  683. sudo apt install -y g++-multilib lib32gcc-9-dev
  684. - name: run tests x86_32
  685. timeout-minutes: 30
  686. if: env.TEST_ON_X86_32 == 'true' && matrix.test_option != '$GC_TEST_OPTIONS'
  687. run: ./test_wamr.sh ${{ env.X86_32_TARGET_TEST_OPTIONS }} ${{ matrix.test_option }} -t ${{ matrix.running_mode }}
  688. working-directory: ./tests/wamr-test-suites
  689. - name: run gc tests x86_32
  690. timeout-minutes: 20
  691. if: env.TEST_ON_X86_32 == 'true' && matrix.test_option == '$GC_TEST_OPTIONS'
  692. run: |
  693. eval $(opam env)
  694. ./test_wamr.sh ${{ env.X86_32_TARGET_TEST_OPTIONS }} ${{ matrix.test_option }} -t ${{ matrix.running_mode }}
  695. working-directory: ./tests/wamr-test-suites