compilation_on_android_ubuntu.yml 28 KB

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