nightly_run.yml 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813
  1. # Copyright (C) 2023 Intel Corporation. All rights reserved.
  2. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  3. name: nightly_run
  4. on:
  5. pull_request:
  6. types:
  7. - opened
  8. - synchronize
  9. # running nightly pipeline if you're changing it
  10. # stress tests are run only in nightly at the moment, so running them in they are changed
  11. paths:
  12. - ".github/workflows/nightly_run.yml"
  13. - "core/iwasm/libraries/lib-wasi-threads/stress-test/**"
  14. # midnight UTC
  15. schedule:
  16. - cron: "0 0 * * *"
  17. # allow to be triggered manually
  18. workflow_dispatch:
  19. # Cancel any in-flight jobs for the same PR/branch so there's only one active
  20. # at a time
  21. concurrency:
  22. group: ${{ github.workflow }}-${{ github.ref }}
  23. cancel-in-progress: true
  24. env:
  25. # For BUILD
  26. 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"
  27. 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"
  28. 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"
  29. 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"
  30. 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"
  31. 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"
  32. 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"
  33. # For Spec Test
  34. DEFAULT_TEST_OPTIONS: "-s spec -b -P"
  35. EXTENDED_CONST_EXPR_TEST_OPTIONS: "-s spec -b -P -N"
  36. MULTI_MODULES_TEST_OPTIONS: "-s spec -b -P -M"
  37. SIMD_TEST_OPTIONS: "-s spec -b -P -S"
  38. THREADS_TEST_OPTIONS: "-s spec -b -P -p"
  39. X86_32_TARGET_TEST_OPTIONS: "-m x86_32"
  40. WASI_TEST_OPTIONS: "-s wasi_certification -w"
  41. permissions:
  42. contents: read
  43. jobs:
  44. build_llvm_libraries_on_ubuntu:
  45. permissions:
  46. contents: read
  47. actions: write
  48. uses: ./.github/workflows/build_llvm_libraries.yml
  49. with:
  50. os: "ubuntu-22.04"
  51. arch: "X86"
  52. build_wamrc:
  53. needs: build_llvm_libraries_on_ubuntu
  54. runs-on: ${{ matrix.os }}
  55. strategy:
  56. matrix:
  57. include:
  58. - os: ubuntu-22.04
  59. llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu.outputs.cache_key }}
  60. steps:
  61. - name: checkout
  62. uses: actions/checkout@v6.0.2
  63. # since jobs.id can't contain the dot character
  64. # it is hard to use `format` to assemble the cache key
  65. - name: Get LLVM libraries
  66. id: retrieve_llvm_libs
  67. uses: actions/cache@v5
  68. with:
  69. path: |
  70. ./core/deps/llvm/build/bin
  71. ./core/deps/llvm/build/include
  72. ./core/deps/llvm/build/lib
  73. ./core/deps/llvm/build/libexec
  74. ./core/deps/llvm/build/share
  75. key: ${{ matrix.llvm_cache_key }}
  76. - name: Quit if cache miss
  77. if: steps.retrieve_llvm_libs.outputs.cache-hit != 'true'
  78. run: echo "::error::can not get prebuilt llvm libraries" && exit 1
  79. - name: Build wamrc
  80. run: |
  81. mkdir build && cd build
  82. cmake ..
  83. cmake --build . --config Release --parallel 4
  84. working-directory: wamr-compiler
  85. build_iwasm:
  86. needs: build_llvm_libraries_on_ubuntu
  87. runs-on: ${{ matrix.os }}
  88. strategy:
  89. matrix:
  90. make_options_run_mode: [
  91. # Running mode
  92. $AOT_BUILD_OPTIONS,
  93. $CLASSIC_INTERP_BUILD_OPTIONS,
  94. $FAST_INTERP_BUILD_OPTIONS,
  95. $FAST_JIT_BUILD_OPTIONS,
  96. $LLVM_LAZY_JIT_BUILD_OPTIONS,
  97. $LLVM_EAGER_JIT_BUILD_OPTIONS,
  98. $MULTI_TIER_JIT_BUILD_OPTIONS,
  99. ]
  100. make_options_feature: [
  101. # Features
  102. "-DWAMR_BUILD_CUSTOM_NAME_SECTION=1",
  103. "-DWAMR_BUILD_DEBUG_AOT=1",
  104. "-DWAMR_BUILD_DEBUG_INTERP=1",
  105. "-DWAMR_BUILD_DUMP_CALL_STACK=1",
  106. "-DWAMR_BUILD_LIB_PTHREAD=1",
  107. "-DWAMR_BUILD_LIB_WASI_THREADS=1",
  108. "-DWAMR_BUILD_LOAD_CUSTOM_SECTION=1",
  109. "-DWAMR_BUILD_MINI_LOADER=1",
  110. "-DWAMR_BUILD_MEMORY_PROFILING=1",
  111. "-DWAMR_BUILD_MULTI_MODULE=1",
  112. "-DWAMR_BUILD_PERF_PROFILING=1",
  113. "-DWAMR_BUILD_TAIL_CALL=1",
  114. "-DWAMR_DISABLE_HW_BOUND_CHECK=1",
  115. "-DWAMR_BUILD_MEMORY64=1",
  116. "-DWAMR_BUILD_MULTI_MEMORY=1",
  117. "-DWAMR_BUILD_SHARED=1",
  118. "-DWAMR_BUILD_EXTENDED_CONST_EXPR=1",
  119. ]
  120. os: [ubuntu-22.04]
  121. platform: [android, linux]
  122. exclude:
  123. # incompatible feature and platform
  124. # incompatible mode and feature
  125. # MULTI_MODULE only on INTERP mode and AOT mode
  126. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  127. make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
  128. - make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
  129. make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
  130. - make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
  131. make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
  132. - make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
  133. make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
  134. # DEBUG_INTERP only on CLASSIC INTERP mode
  135. - make_options_run_mode: $AOT_BUILD_OPTIONS
  136. make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
  137. - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
  138. make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
  139. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  140. make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
  141. - make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
  142. make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
  143. - make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
  144. make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
  145. - make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
  146. make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
  147. # DEBUG_AOT only on JIT/AOT mode
  148. - make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS
  149. make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
  150. - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
  151. make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
  152. # TODO: DEBUG_AOT on JIT
  153. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  154. make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
  155. - make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
  156. make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
  157. - make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
  158. make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
  159. - make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
  160. make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
  161. # MINI_LOADER only on INTERP mode
  162. - make_options_run_mode: $AOT_BUILD_OPTIONS
  163. make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
  164. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  165. make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
  166. - make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
  167. make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
  168. - make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
  169. make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
  170. - make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
  171. make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
  172. # Memory64 only on CLASSIC INTERP and AOT mode, and only on 64-bit platform
  173. - make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
  174. platform: android
  175. - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
  176. make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
  177. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  178. make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
  179. - make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
  180. make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
  181. - make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
  182. make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
  183. - make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
  184. make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
  185. # Multi memory only on CLASSIC INTERP mode, and only on 64-bit platform
  186. - make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
  187. platform: android
  188. - make_options_run_mode: $AOT_BUILD_OPTIONS
  189. make_options_feature: "-DWAMR_BUILD_MULTI_MEMORY=1"
  190. - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
  191. make_options_feature: "-DWAMR_BUILD_MULTI_MEMORY=1"
  192. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  193. make_options_feature: "-DWAMR_BUILD_MULTI_MEMORY=1"
  194. - make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
  195. make_options_feature: "-DWAMR_BUILD_MULTI_MEMORY=1"
  196. - make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
  197. make_options_feature: "-DWAMR_BUILD_MULTI_MEMORY=1"
  198. - make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
  199. make_options_feature: "-DWAMR_BUILD_MULTI_MEMORY=1"
  200. # Fast-JIT and Multi-Tier-JIT mode don't support android
  201. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  202. platform: android
  203. - make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
  204. platform: android
  205. # LLVM JIT pre-built binary wasn't compiled by Android NDK
  206. # and isn't available for android
  207. - make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
  208. platform: android
  209. - make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
  210. platform: android
  211. include:
  212. - os: ubuntu-22.04
  213. llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu.outputs.cache_key }}
  214. # classic interp doesn't support SIMD
  215. - make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS
  216. extra_options: "-DWAMR_BUILD_SIMD=0"
  217. # fast jit doesn't support SIMD
  218. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  219. extra_options: "-DWAMR_BUILD_SIMD=0"
  220. # multi-tier jit doesn't support SIMD
  221. - make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
  222. extra_options: "-DWAMR_BUILD_SIMD=0"
  223. steps:
  224. - name: checkout
  225. uses: actions/checkout@v6.0.2
  226. # only download llvm cache when needed
  227. - name: Get LLVM libraries
  228. id: retrieve_llvm_libs
  229. if: endsWith(matrix.make_options_run_mode, '_JIT_BUILD_OPTIONS')
  230. uses: actions/cache@v5
  231. with:
  232. path: |
  233. ./core/deps/llvm/build/bin
  234. ./core/deps/llvm/build/include
  235. ./core/deps/llvm/build/lib
  236. ./core/deps/llvm/build/libexec
  237. ./core/deps/llvm/build/share
  238. key: ${{ matrix.llvm_cache_key }}
  239. - name: Quit if cache miss
  240. if: endsWith(matrix.make_options_run_mode, '_JIT_BUILD_OPTIONS') && (steps.retrieve_llvm_libs.outputs.cache-hit != 'true')
  241. run: echo "::error::can not get prebuilt llvm libraries" && exit 1
  242. - name: Build iwasm for linux
  243. if: matrix.platform == 'linux'
  244. run: |
  245. mkdir build && cd build
  246. cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }} ${{ matrix.extra_options }}
  247. cmake --build . --config Release --parallel 4
  248. working-directory: product-mini/platforms/${{ matrix.platform }}
  249. - name: Build iwasm for android
  250. if: matrix.platform == 'android'
  251. run: |
  252. mkdir build && cd build
  253. cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }} ${{ matrix.extra_options }} \
  254. -DWAMR_BUILD_TARGET=X86_64
  255. cmake --build . --config Release --parallel 4
  256. working-directory: product-mini/platforms/${{ matrix.platform }}
  257. build_unit_tests:
  258. needs: [build_llvm_libraries_on_ubuntu, build_wamrc]
  259. runs-on: ${{ matrix.os }}
  260. strategy:
  261. fail-fast: false
  262. matrix:
  263. os: [ubuntu-22.04]
  264. build_target: ["X86_64", "X86_32"]
  265. include:
  266. - os: ubuntu-22.04
  267. llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu.outputs.cache_key }}
  268. steps:
  269. - name: checkout
  270. uses: actions/checkout@v6.0.2
  271. with:
  272. submodules: recursive
  273. - name: Get LLVM libraries
  274. id: retrieve_llvm_libs
  275. uses: actions/cache@v5
  276. with:
  277. path: |
  278. ./core/deps/llvm/build/bin
  279. ./core/deps/llvm/build/include
  280. ./core/deps/llvm/build/lib
  281. ./core/deps/llvm/build/libexec
  282. ./core/deps/llvm/build/share
  283. key: ${{ matrix.llvm_cache_key }}
  284. - name: Quit if cache miss
  285. if: (steps.retrieve_llvm_libs.outputs.cache-hit != 'true')
  286. run: echo "::error::can not get prebuilt llvm libraries" && exit 1
  287. - name: install-wasi-sdk-wabt
  288. uses: ./.github/actions/install-wasi-sdk-wabt
  289. with:
  290. os: ${{ matrix.os }}
  291. - name: Build wamrc
  292. run: |
  293. mkdir build && cd build
  294. cmake ..
  295. cmake --build . --config Release --parallel 4
  296. working-directory: wamr-compiler
  297. - name: Install dependencies for X86_32
  298. if: matrix.build_target == 'X86_32'
  299. run: |
  300. sudo dpkg --add-architecture i386
  301. sudo apt-get update
  302. sudo apt-get install -y g++-multilib libzstd-dev:i386 zlib1g-dev:i386
  303. - name: Build and run unit tests
  304. run: |
  305. mkdir build && cd build
  306. cmake .. -DWAMR_BUILD_TARGET=${{ matrix.build_target }} -DFULL_TEST=ON
  307. cmake --build . --parallel 4
  308. ctest --output-on-failure
  309. working-directory: tests/unit
  310. build_iwasm_linux_gcc4_8:
  311. runs-on: ubuntu-latest
  312. container:
  313. image: ubuntu:14.04
  314. strategy:
  315. matrix:
  316. make_options_run_mode: [
  317. # Running mode
  318. $CLASSIC_INTERP_BUILD_OPTIONS,
  319. $FAST_INTERP_BUILD_OPTIONS,
  320. $FAST_JIT_BUILD_OPTIONS,
  321. ]
  322. make_options_feature: [
  323. # Features
  324. "-DWAMR_BUILD_CUSTOM_NAME_SECTION=1",
  325. "-DWAMR_BUILD_DEBUG_AOT=1",
  326. "-DWAMR_BUILD_DEBUG_INTERP=1",
  327. "-DWAMR_BUILD_DUMP_CALL_STACK=1",
  328. "-DWAMR_BUILD_LIB_PTHREAD=1",
  329. "-DWAMR_BUILD_LIB_WASI_THREADS=1",
  330. "-DWAMR_BUILD_LOAD_CUSTOM_SECTION=1",
  331. "-DWAMR_BUILD_MINI_LOADER=1",
  332. "-DWAMR_BUILD_MEMORY_PROFILING=1",
  333. "-DWAMR_BUILD_MULTI_MODULE=1",
  334. "-DWAMR_BUILD_PERF_PROFILING=1",
  335. "-DWAMR_BUILD_TAIL_CALL=1",
  336. "-DWAMR_DISABLE_HW_BOUND_CHECK=1",
  337. "-DWAMR_BUILD_MEMORY64=1",
  338. "-DWAMR_BUILD_MULTI_MEMORY=1",
  339. ]
  340. exclude:
  341. # incompatible feature and platform
  342. # incompatible mode and feature
  343. # MULTI_MODULE only on INTERP mode and AOT mode
  344. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  345. make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
  346. # SIMD only on JIT/AOT mode
  347. - make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS
  348. make_options_feature: "-DWAMR_BUILD_SIMD=1"
  349. - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
  350. make_options_feature: "-DWAMR_BUILD_SIMD=1"
  351. # DEBUG_INTERP only on CLASSIC INTERP mode
  352. - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
  353. make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
  354. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  355. make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
  356. # DEBUG_AOT only on JIT/AOT mode
  357. - make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS
  358. make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
  359. - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
  360. make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
  361. # TODO: DEBUG_AOT on JIT
  362. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  363. make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
  364. # MINI_LOADER only on INTERP mode
  365. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  366. make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
  367. # Memory64 only on CLASSIC INTERP mode
  368. - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
  369. make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
  370. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  371. make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
  372. # Memory64 only on CLASSIC INTERP mode
  373. - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
  374. make_options_feature: "-DWAMR_BUILD_MULTI_MEMORY=1"
  375. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  376. make_options_feature: "-DWAMR_BUILD_MULTI_MEMORY=1"
  377. include:
  378. # classic interp doesn't support SIMD
  379. - make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS
  380. extra_options: "-DWAMR_BUILD_SIMD=0"
  381. # fast jit doesn't support SIMD
  382. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  383. extra_options: "-DWAMR_BUILD_SIMD=0"
  384. steps:
  385. - name: Install dependencies
  386. run: |
  387. apt update && apt install -y make g++-4.8 gcc-4.8 wget git
  388. - name: checkout
  389. run: |
  390. git clone https://github.com/${{ github.repository }} wamr
  391. - name: Install cmake
  392. run: |
  393. wget https://github.com/Kitware/CMake/releases/download/v3.26.1/cmake-3.26.1-linux-x86_64.tar.gz -O cmake.tar.gz
  394. tar xzf cmake.tar.gz
  395. cp cmake-3.26.1-linux-x86_64/bin/cmake /usr/local/bin
  396. cp -r cmake-3.26.1-linux-x86_64/share/cmake-3.26/ /usr/local/share/
  397. - name: Build iwasm
  398. run: |
  399. mkdir build && cd build
  400. cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }} ${{ matrix.extra_options }} -DCMAKE_C_COMPILER=gcc-4.8 -DCMAKE_CXX_COMPILER=g++-4.8
  401. cmake --build . --config Release --parallel 4
  402. working-directory: wamr/product-mini/platforms/linux
  403. build_samples_wasm_c_api:
  404. needs: [build_iwasm, build_llvm_libraries_on_ubuntu, build_wamrc]
  405. runs-on: ${{ matrix.os }}
  406. strategy:
  407. fail-fast: false
  408. matrix:
  409. sanitizer: ["", "ubsan", "asan"]
  410. make_options: [
  411. # Running mode
  412. $AOT_BUILD_OPTIONS,
  413. $CLASSIC_INTERP_BUILD_OPTIONS,
  414. $FAST_INTERP_BUILD_OPTIONS,
  415. $FAST_JIT_BUILD_OPTIONS,
  416. $LLVM_LAZY_JIT_BUILD_OPTIONS,
  417. $LLVM_EAGER_JIT_BUILD_OPTIONS,
  418. $MULTI_TIER_JIT_BUILD_OPTIONS,
  419. ]
  420. os: [ubuntu-22.04]
  421. include:
  422. - os: ubuntu-22.04
  423. llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu.outputs.cache_key }}
  424. # classic interp doesn't support SIMD
  425. - make_options: $CLASSIC_INTERP_BUILD_OPTIONS
  426. extra_options: "-DWAMR_BUILD_SIMD=0"
  427. # fast jit doesn't support Multi-module and SIMD
  428. - make_options: $FAST_JIT_BUILD_OPTIONS
  429. extra_options: "-DWAMR_BUILD_SIMD=0 -DWAMR_BUILD_MULTI_MODULE=0"
  430. # multi-tier jit doesn't support Multi-module and SIMD
  431. - make_options: $MULTI_TIER_JIT_BUILD_OPTIONS
  432. extra_options: "-DWAMR_BUILD_SIMD=0 -DWAMR_BUILD_MULTI_MODULE=0"
  433. # LLVM JIT doesn't support Multi-module
  434. - make_options: $LLVM_LAZY_JIT_BUILD_OPTIONS
  435. extra_options: "-DWAMR_BUILD_MULTI_MODULE=0"
  436. - make_options: $LLVM_EAGER_JIT_BUILD_OPTIONS
  437. extra_options: "-DWAMR_BUILD_MULTI_MODULE=0"
  438. exclude:
  439. - make_options: $MULTI_TIER_JIT_BUILD_OPTIONS
  440. sanitizer: asan
  441. steps:
  442. - name: checkout
  443. uses: actions/checkout@v6.0.2
  444. - name: Get LLVM libraries
  445. id: retrieve_llvm_libs
  446. if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS'))
  447. uses: actions/cache@v5
  448. with:
  449. path: |
  450. ./core/deps/llvm/build/bin
  451. ./core/deps/llvm/build/include
  452. ./core/deps/llvm/build/lib
  453. ./core/deps/llvm/build/libexec
  454. ./core/deps/llvm/build/share
  455. key: ${{ matrix.llvm_cache_key }}
  456. - name: Quit if cache miss
  457. if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS')) && (steps.retrieve_llvm_libs.outputs.cache-hit != 'true')
  458. run: echo "::error::can not get prebuilt llvm libraries" && exit 1
  459. - name: install-wasi-sdk-wabt
  460. uses: ./.github/actions/install-wasi-sdk-wabt
  461. with:
  462. os: ${{ matrix.os }}
  463. - name: Build wamrc
  464. if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS'))
  465. run: |
  466. mkdir build && cd build
  467. cmake -D WAMR_BUILD_SANITIZER="${{matrix.sanitizer}}" ..
  468. cmake --build . --config Release --parallel 4
  469. working-directory: wamr-compiler
  470. - name: Build Sample [wasm-c-api]
  471. run: |
  472. VERBOSE=1
  473. cmake -S . -B build ${{ matrix.make_options }} ${{ matrix.extra_options }} \
  474. -D WAMR_BUILD_SANITIZER="${{matrix.sanitizer}}" \
  475. -D WAMR_BUILD_QUICK_AOT_ENTRY=0
  476. cmake --build build --config Release --parallel 4
  477. ctest --test-dir build --output-on-failure
  478. working-directory: samples/wasm-c-api
  479. build_samples_others:
  480. needs: [build_iwasm, build_llvm_libraries_on_ubuntu, build_wamrc]
  481. runs-on: ${{ matrix.os }}
  482. strategy:
  483. matrix:
  484. os: [ubuntu-22.04]
  485. include:
  486. - os: ubuntu-22.04
  487. llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu.outputs.cache_key }}
  488. steps:
  489. - name: checkout
  490. uses: actions/checkout@v6.0.2
  491. - name: install-wasi-sdk-wabt
  492. uses: ./.github/actions/install-wasi-sdk-wabt
  493. with:
  494. os: ${{ matrix.os }}
  495. - name: Get LLVM libraries
  496. id: retrieve_llvm_libs
  497. uses: actions/cache@v5
  498. with:
  499. path: |
  500. ./core/deps/llvm/build/bin
  501. ./core/deps/llvm/build/include
  502. ./core/deps/llvm/build/lib
  503. ./core/deps/llvm/build/libexec
  504. ./core/deps/llvm/build/share
  505. key: ${{ matrix.llvm_cache_key }}
  506. - name: Build wamrc
  507. run: |
  508. mkdir build && cd build
  509. cmake -D WAMR_BUILD_SANITIZER="${{matrix.sanitizer}}" ..
  510. cmake --build . --config Release --parallel 4
  511. working-directory: wamr-compiler
  512. - name: Build Sample [basic]
  513. run: |
  514. cd samples/basic
  515. ./build.sh
  516. ./run.sh
  517. - name: Build Sample [file]
  518. run: |
  519. cd samples/file
  520. mkdir build && cd build
  521. cmake ..
  522. cmake --build . --config Release --parallel 4
  523. ./src/iwasm -f wasm-app/file.wasm -d .
  524. - name: Build Sample [multi-thread]
  525. run: |
  526. cd samples/multi-thread
  527. mkdir build && cd build
  528. cmake ..
  529. cmake --build . --config Release --parallel 4
  530. ./iwasm wasm-apps/test.wasm
  531. - name: Build Sample [multi-module]
  532. run: |
  533. cd samples/multi-module
  534. mkdir build && cd build
  535. cmake .. -DWAMR_BUILD_AOT=1
  536. cmake --build . --config Release --parallel 4
  537. ./multi_module mC.wasm
  538. ./multi_module mC.aot
  539. - name: Build Sample [spawn-thread]
  540. run: |
  541. cd samples/spawn-thread
  542. mkdir build && cd build
  543. cmake ..
  544. cmake --build . --config Release --parallel 4
  545. ./spawn_thread
  546. - name: Build Sample [ref-types]
  547. run: |
  548. cd samples/ref-types
  549. mkdir build && cd build
  550. cmake ..
  551. cmake --build . --config Release --parallel 4
  552. ./hello
  553. - name: Build Sample [wasi-threads]
  554. run: |
  555. cd samples/wasi-threads
  556. mkdir build && cd build
  557. cmake ..
  558. cmake --build . --config Release --parallel 4
  559. ./iwasm wasm-apps/no_pthread.wasm
  560. - name: Build Sample [shared-module]
  561. run: |
  562. cd samples/shared-module
  563. ./build.sh
  564. ./run.sh
  565. - name: Build Sample [terminate]
  566. run: |
  567. cd samples/terminate
  568. ./build.sh
  569. ./run.sh
  570. - name: Build Sample [native-stack-overflow]
  571. run: |
  572. cd samples/native-stack-overflow
  573. ./build.sh
  574. ./run.sh test1
  575. ./run.sh test2
  576. - name: Build Sample [native-lib]
  577. run: |
  578. mkdir build && cd build
  579. cmake ..
  580. cmake --build . --config Release --parallel 4
  581. ./iwasm --native-lib=./libtest_add.so --native-lib=./libtest_sqrt.so --native-lib=./libtest_hello.so --native-lib=./libtest_hello2.so wasm-app/test.wasm
  582. working-directory: ./samples/native-lib
  583. # FIXME: un-comment me after fix cmake minimum issue
  584. # https://github.com/bytecodealliance/wamr-app-framework/pull/11
  585. # - name: checkout wamr-app-framework
  586. # run: git clone https://github.com/bytecodealliance/wamr-app-framework.git
  587. # - name: download wamr-app-framework dependencies
  588. # run: LVGL=0 LV_DRIVERS=0 ./download.sh
  589. # working-directory: ./wamr-app-framework/deps
  590. # - name: Build Sample [simple]
  591. # run: |
  592. # ./build.sh -p host-interp
  593. # python3 ./sample_test_run.py $(pwd)/out
  594. # exit $?
  595. # working-directory: ./wamr-app-framework/samples/simple
  596. - name: Build Sample [shared-heap]
  597. run: |
  598. cd samples/shared-heap
  599. mkdir build && cd build
  600. cmake ..
  601. cmake --build . --config Debug --parallel 4
  602. ./shared_heap_test
  603. ./shared_heap_test --aot
  604. - name: Build Sample [import-func-callback]
  605. run: |
  606. cd samples/import-func-callback
  607. mkdir build && cd build
  608. cmake ..
  609. cmake --build . --config Release --parallel 4
  610. ./import-func-callback
  611. - name: Build Sample [custom_section]
  612. run: |
  613. cd samples/custom-section
  614. ./build.sh
  615. ./run.sh
  616. ./build.sh --aot
  617. ./run.sh --aot
  618. test:
  619. needs: [build_iwasm, build_llvm_libraries_on_ubuntu, build_wamrc]
  620. runs-on: ${{ matrix.os }}
  621. strategy:
  622. fail-fast: false
  623. matrix:
  624. os: [ubuntu-22.04]
  625. sanitizer: ["", "ubsan", "asan", "tsan"]
  626. running_mode:
  627. [
  628. "classic-interp",
  629. "fast-interp",
  630. "jit",
  631. "aot",
  632. "fast-jit",
  633. "multi-tier-jit",
  634. ]
  635. test_option:
  636. [
  637. $DEFAULT_TEST_OPTIONS,
  638. $MULTI_MODULES_TEST_OPTIONS,
  639. $SIMD_TEST_OPTIONS,
  640. $EXTENDED_CONST_EXPR_TEST_OPTIONS,
  641. $THREADS_TEST_OPTIONS,
  642. $WASI_TEST_OPTIONS,
  643. ]
  644. include:
  645. - os: ubuntu-22.04
  646. llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu.outputs.cache_key }}
  647. ubuntu_version: "22.04"
  648. exclude:
  649. # asan works only for aot now
  650. - running_mode: "classic-interp"
  651. sanitizer: asan
  652. - running_mode: "fast-interp"
  653. sanitizer: asan
  654. - running_mode: "jit"
  655. sanitizer: asan
  656. - running_mode: "fast-jit"
  657. sanitizer: asan
  658. - running_mode: "multi-tier-jit"
  659. sanitizer: asan
  660. - running_mode: "classic-interp"
  661. sanitizer: tsan
  662. - running_mode: "jit"
  663. sanitizer: tsan
  664. - running_mode: "fast-jit"
  665. sanitizer: tsan
  666. - running_mode: "multi-tier-jit"
  667. sanitizer: tsan
  668. # simd128.h brings ubsan errors
  669. # like: negation of XXXcannot be represented in type 'long int';
  670. # cast to an unsigned type to negate this value to itself
  671. - running_mode: "fast-interp"
  672. sanitizer: ubsan
  673. steps:
  674. - name: checkout
  675. uses: actions/checkout@v6.0.2
  676. - name: install-wasi-sdk-wabt
  677. if: matrix.test_option == '$WASI_TEST_OPTIONS'
  678. uses: ./.github/actions/install-wasi-sdk-wabt
  679. with:
  680. os: ${{ matrix.os }}
  681. - name: set env variable(if llvm are used)
  682. if: matrix.running_mode == 'aot' || matrix.running_mode == 'jit' || matrix.running_mode == 'multi-tier-jit'
  683. run: echo "USE_LLVM=true" >> $GITHUB_ENV
  684. - name: set env variable(if x86_32 test needed)
  685. if: >
  686. (matrix.test_option == '$DEFAULT_TEST_OPTIONS' || matrix.test_option == '$THREADS_TEST_OPTIONS'
  687. || matrix.test_option == '$WASI_TEST_OPTIONS')
  688. && matrix.running_mode != 'fast-jit' && matrix.running_mode != 'jit' && matrix.running_mode != 'multi-tier-jit'
  689. run: echo "TEST_ON_X86_32=true" >> $GITHUB_ENV
  690. - name: set additional tsan options
  691. run: |
  692. echo "TSAN_OPTIONS=suppressions=$PWD/tsan_suppressions.txt" >> $GITHUB_ENV
  693. sudo sysctl vm.mmap_rnd_bits=28
  694. working-directory: tests/wamr-test-suites
  695. #only download llvm libraries in jit and aot mode
  696. - name: Get LLVM libraries
  697. if: env.USE_LLVM == 'true'
  698. id: retrieve_llvm_libs
  699. uses: actions/cache@v5
  700. with:
  701. path: |
  702. ./core/deps/llvm/build/bin
  703. ./core/deps/llvm/build/include
  704. ./core/deps/llvm/build/lib
  705. ./core/deps/llvm/build/libexec
  706. ./core/deps/llvm/build/share
  707. key: ${{ matrix.llvm_cache_key }}
  708. - name: Quit if cache miss
  709. if: env.USE_LLVM == 'true' && steps.retrieve_llvm_libs.outputs.cache-hit != 'true'
  710. run: echo "::error::can not get prebuilt llvm libraries" && exit 1
  711. - name: install jq JSON processor
  712. if: matrix.running_mode == 'aot' && matrix.test_option == '$WASI_TEST_OPTIONS'
  713. run: sudo apt-get update && sudo apt install -y jq
  714. - name: install for wabt compilation
  715. run: sudo apt update && sudo apt install -y ninja-build
  716. - name: Build WASI thread tests
  717. if: matrix.test_option == '$WASI_TEST_OPTIONS'
  718. run: bash build.sh
  719. working-directory: ./core/iwasm/libraries/lib-wasi-threads/test/
  720. - name: Build WASI thread stress tests
  721. if: matrix.test_option == '$WASI_TEST_OPTIONS'
  722. run: bash build.sh
  723. working-directory: ./core/iwasm/libraries/lib-wasi-threads/stress-test/
  724. - name: build socket api tests
  725. if: matrix.test_option == '$WASI_TEST_OPTIONS'
  726. run: bash build.sh
  727. working-directory: ./core/iwasm/libraries/lib-socket/test/
  728. - name: run tests
  729. timeout-minutes: 40
  730. run: ./test_wamr.sh ${{ matrix.test_option }} -t ${{ matrix.running_mode }} -T "${{ matrix.sanitizer }}"
  731. working-directory: ./tests/wamr-test-suites
  732. #only install x32 support libraries when to run x86_32 cases
  733. - name: install x32 support libraries
  734. if: env.TEST_ON_X86_32 == 'true'
  735. run:
  736. # Add another apt repository as some packages cannot
  737. # be downloaded with the github default repository
  738. sudo curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/apt/trusted.gpg.d/microsoft.asc &&
  739. sudo apt-add-repository https://packages.microsoft.com/ubuntu/${{ matrix.ubuntu_version }}/prod &&
  740. sudo apt-get update &&
  741. sudo apt install -y g++-multilib lib32gcc-9-dev
  742. - name: run tests x86_32
  743. timeout-minutes: 40
  744. if: env.TEST_ON_X86_32 == 'true'
  745. run: ./test_wamr.sh ${{ env.X86_32_TARGET_TEST_OPTIONS }} ${{ matrix.test_option }} -t ${{ matrix.running_mode }}
  746. working-directory: ./tests/wamr-test-suites