compilation_on_android_ubuntu.yml 28 KB

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