nightly_run.yml 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714
  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@v4
  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@v4
  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_REF_TYPES=1",
  114. "-DWAMR_BUILD_SIMD=1",
  115. "-DWAMR_BUILD_TAIL_CALL=1",
  116. "-DWAMR_DISABLE_HW_BOUND_CHECK=1",
  117. "-DWAMR_BUILD_MEMORY64=1",
  118. "-DWAMR_BUILD_MULTI_MEMORY=1",
  119. "-DWAMR_BUILD_SHARED=1",
  120. "-DWAMR_BUILD_EXTENDED_CONST_EXPR=1",
  121. ]
  122. os: [ubuntu-22.04]
  123. platform: [android, linux]
  124. exclude:
  125. # incompatible feature and platform
  126. # incompatible mode and feature
  127. # MULTI_MODULE only on INTERP mode and AOT mode
  128. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  129. make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
  130. - make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
  131. make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
  132. - make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
  133. make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
  134. - make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
  135. make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
  136. # SIMD only on JIT/AOT mode
  137. - make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS
  138. make_options_feature: "-DWAMR_BUILD_SIMD=1"
  139. - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
  140. make_options_feature: "-DWAMR_BUILD_SIMD=1"
  141. # DEBUG_INTERP only on CLASSIC INTERP mode
  142. - make_options_run_mode: $AOT_BUILD_OPTIONS
  143. make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
  144. - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
  145. make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
  146. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  147. make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
  148. - make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
  149. make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
  150. - make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
  151. make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
  152. - make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
  153. make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
  154. # DEBUG_AOT only on JIT/AOT mode
  155. - make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS
  156. make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
  157. - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
  158. make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
  159. # TODO: DEBUG_AOT on JIT
  160. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  161. make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
  162. - make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
  163. make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
  164. - make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
  165. make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
  166. - make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
  167. make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
  168. # MINI_LOADER only on INTERP mode
  169. - make_options_run_mode: $AOT_BUILD_OPTIONS
  170. make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
  171. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  172. make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
  173. - make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
  174. make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
  175. - make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
  176. make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
  177. - make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
  178. make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
  179. # Memory64 only on CLASSIC INTERP and AOT mode, and only on 64-bit platform
  180. - make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
  181. platform: android
  182. - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
  183. make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
  184. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  185. make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
  186. - make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
  187. make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
  188. - make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
  189. make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
  190. - make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
  191. make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
  192. # Multi memory only on CLASSIC INTERP mode, and only on 64-bit platform
  193. - make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
  194. platform: android
  195. - make_options_run_mode: $AOT_BUILD_OPTIONS
  196. make_options_feature: "-DWAMR_BUILD_MULTI_MEMORY=1"
  197. - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
  198. make_options_feature: "-DWAMR_BUILD_MULTI_MEMORY=1"
  199. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  200. make_options_feature: "-DWAMR_BUILD_MULTI_MEMORY=1"
  201. - make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
  202. make_options_feature: "-DWAMR_BUILD_MULTI_MEMORY=1"
  203. - make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
  204. make_options_feature: "-DWAMR_BUILD_MULTI_MEMORY=1"
  205. - make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
  206. make_options_feature: "-DWAMR_BUILD_MULTI_MEMORY=1"
  207. # Fast-JIT and Multi-Tier-JIT mode don't support android
  208. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  209. platform: android
  210. - make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
  211. platform: android
  212. # LLVM JIT pre-built binary wasn't compiled by Android NDK
  213. # and isn't available for android
  214. - make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
  215. platform: android
  216. - make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
  217. platform: android
  218. include:
  219. - os: ubuntu-22.04
  220. llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu.outputs.cache_key }}
  221. steps:
  222. - name: checkout
  223. uses: actions/checkout@v4
  224. # only download llvm cache when needed
  225. - name: Get LLVM libraries
  226. id: retrieve_llvm_libs
  227. if: endsWith(matrix.make_options_run_mode, '_JIT_BUILD_OPTIONS')
  228. uses: actions/cache@v4
  229. with:
  230. path: |
  231. ./core/deps/llvm/build/bin
  232. ./core/deps/llvm/build/include
  233. ./core/deps/llvm/build/lib
  234. ./core/deps/llvm/build/libexec
  235. ./core/deps/llvm/build/share
  236. key: ${{ matrix.llvm_cache_key }}
  237. - name: Quit if cache miss
  238. if: endsWith(matrix.make_options_run_mode, '_JIT_BUILD_OPTIONS') && (steps.retrieve_llvm_libs.outputs.cache-hit != 'true')
  239. run: echo "::error::can not get prebuilt llvm libraries" && exit 1
  240. - name: Build iwasm for linux
  241. if: matrix.platform == 'linux'
  242. run: |
  243. mkdir build && cd build
  244. cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }}
  245. cmake --build . --config Release --parallel 4
  246. working-directory: product-mini/platforms/${{ matrix.platform }}
  247. - name: Build iwasm for android
  248. if: matrix.platform == 'android'
  249. run: |
  250. mkdir build && cd build
  251. cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }} \
  252. -DWAMR_BUILD_TARGET=X86_64
  253. cmake --build . --config Release --parallel 4
  254. working-directory: product-mini/platforms/${{ matrix.platform }}
  255. build_iwasm_linux_gcc4_8:
  256. runs-on: ubuntu-latest
  257. container:
  258. image: ubuntu:14.04
  259. strategy:
  260. matrix:
  261. make_options_run_mode: [
  262. # Running mode
  263. $CLASSIC_INTERP_BUILD_OPTIONS,
  264. $FAST_INTERP_BUILD_OPTIONS,
  265. $FAST_JIT_BUILD_OPTIONS,
  266. ]
  267. make_options_feature: [
  268. # Features
  269. "-DWAMR_BUILD_CUSTOM_NAME_SECTION=1",
  270. "-DWAMR_BUILD_DEBUG_AOT=1",
  271. "-DWAMR_BUILD_DEBUG_INTERP=1",
  272. "-DWAMR_BUILD_DUMP_CALL_STACK=1",
  273. "-DWAMR_BUILD_LIB_PTHREAD=1",
  274. "-DWAMR_BUILD_LIB_WASI_THREADS=1",
  275. "-DWAMR_BUILD_LOAD_CUSTOM_SECTION=1",
  276. "-DWAMR_BUILD_MINI_LOADER=1",
  277. "-DWAMR_BUILD_MEMORY_PROFILING=1",
  278. "-DWAMR_BUILD_MULTI_MODULE=1",
  279. "-DWAMR_BUILD_PERF_PROFILING=1",
  280. "-DWAMR_BUILD_REF_TYPES=1",
  281. "-DWAMR_BUILD_SIMD=1",
  282. "-DWAMR_BUILD_TAIL_CALL=1",
  283. "-DWAMR_DISABLE_HW_BOUND_CHECK=1",
  284. "-DWAMR_BUILD_MEMORY64=1",
  285. "-DWAMR_BUILD_MULTI_MEMORY=1",
  286. ]
  287. exclude:
  288. # incompatible feature and platform
  289. # incompatible mode and feature
  290. # MULTI_MODULE only on INTERP mode and AOT mode
  291. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  292. make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
  293. # SIMD only on JIT/AOT mode
  294. - make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS
  295. make_options_feature: "-DWAMR_BUILD_SIMD=1"
  296. - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
  297. make_options_feature: "-DWAMR_BUILD_SIMD=1"
  298. # DEBUG_INTERP only on CLASSIC INTERP mode
  299. - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
  300. make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
  301. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  302. make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
  303. # DEBUG_AOT only on JIT/AOT mode
  304. - make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS
  305. make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
  306. - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
  307. make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
  308. # TODO: DEBUG_AOT on JIT
  309. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  310. make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
  311. # MINI_LOADER only on INTERP mode
  312. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  313. make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
  314. # Memory64 only on CLASSIC INTERP mode
  315. - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
  316. make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
  317. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  318. make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
  319. # Memory64 only on CLASSIC INTERP mode
  320. - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
  321. make_options_feature: "-DWAMR_BUILD_MULTI_MEMORY=1"
  322. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  323. make_options_feature: "-DWAMR_BUILD_MULTI_MEMORY=1"
  324. steps:
  325. - name: Install dependencies
  326. run: |
  327. apt update && apt install -y make g++-4.8 gcc-4.8 wget git
  328. - name: checkout
  329. run: |
  330. git clone https://github.com/${{ github.repository }} wamr
  331. - name: Install cmake
  332. run: |
  333. wget https://github.com/Kitware/CMake/releases/download/v3.26.1/cmake-3.26.1-linux-x86_64.tar.gz -O cmake.tar.gz
  334. tar xzf cmake.tar.gz
  335. cp cmake-3.26.1-linux-x86_64/bin/cmake /usr/local/bin
  336. cp -r cmake-3.26.1-linux-x86_64/share/cmake-3.26/ /usr/local/share/
  337. - name: Build iwasm
  338. run: |
  339. mkdir build && cd build
  340. cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }} -DCMAKE_C_COMPILER=gcc-4.8 -DCMAKE_CXX_COMPILER=g++-4.8
  341. cmake --build . --config Release --parallel 4
  342. working-directory: wamr/product-mini/platforms/linux
  343. build_samples_wasm_c_api:
  344. needs: [build_iwasm, build_llvm_libraries_on_ubuntu, build_wamrc]
  345. runs-on: ${{ matrix.os }}
  346. strategy:
  347. fail-fast: false
  348. matrix:
  349. sanitizer: ["", "ubsan", "asan"]
  350. make_options: [
  351. # Running mode
  352. $AOT_BUILD_OPTIONS,
  353. $CLASSIC_INTERP_BUILD_OPTIONS,
  354. $FAST_INTERP_BUILD_OPTIONS,
  355. $FAST_JIT_BUILD_OPTIONS,
  356. $LLVM_LAZY_JIT_BUILD_OPTIONS,
  357. $LLVM_EAGER_JIT_BUILD_OPTIONS,
  358. $MULTI_TIER_JIT_BUILD_OPTIONS,
  359. ]
  360. os: [ubuntu-22.04]
  361. include:
  362. - os: ubuntu-22.04
  363. llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu.outputs.cache_key }}
  364. exclude:
  365. - make_options: $MULTI_TIER_JIT_BUILD_OPTIONS
  366. sanitizer: asan
  367. steps:
  368. - name: checkout
  369. uses: actions/checkout@v4
  370. - name: Get LLVM libraries
  371. id: retrieve_llvm_libs
  372. if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS'))
  373. uses: actions/cache@v4
  374. with:
  375. path: |
  376. ./core/deps/llvm/build/bin
  377. ./core/deps/llvm/build/include
  378. ./core/deps/llvm/build/lib
  379. ./core/deps/llvm/build/libexec
  380. ./core/deps/llvm/build/share
  381. key: ${{ matrix.llvm_cache_key }}
  382. - name: Quit if cache miss
  383. if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS')) && (steps.retrieve_llvm_libs.outputs.cache-hit != 'true')
  384. run: echo "::error::can not get prebuilt llvm libraries" && exit 1
  385. - name: install-wasi-sdk-wabt
  386. uses: ./.github/actions/install-wasi-sdk-wabt
  387. with:
  388. os: ${{ matrix.os }}
  389. - name: Build wamrc
  390. if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS'))
  391. run: |
  392. mkdir build && cd build
  393. cmake -D WAMR_BUILD_SANITIZER="${{matrix.sanitizer}}" ..
  394. cmake --build . --config Release --parallel 4
  395. working-directory: wamr-compiler
  396. - name: Build Sample [wasm-c-api]
  397. run: |
  398. VERBOSE=1
  399. cmake -S . -B build ${{ matrix.make_options }} \
  400. -D WAMR_BUILD_SANITIZER="${{matrix.sanitizer}}" \
  401. -D WAMR_BUILD_QUICK_AOT_ENTRY=0
  402. cmake --build build --config Release --parallel 4
  403. ctest --test-dir build --output-on-failure
  404. working-directory: samples/wasm-c-api
  405. build_samples_others:
  406. needs: [build_iwasm, build_llvm_libraries_on_ubuntu, build_wamrc]
  407. runs-on: ${{ matrix.os }}
  408. strategy:
  409. matrix:
  410. os: [ubuntu-22.04]
  411. include:
  412. - os: ubuntu-22.04
  413. llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu.outputs.cache_key }}
  414. steps:
  415. - name: checkout
  416. uses: actions/checkout@v4
  417. - name: install-wasi-sdk-wabt
  418. uses: ./.github/actions/install-wasi-sdk-wabt
  419. with:
  420. os: ${{ matrix.os }}
  421. - name: Get LLVM libraries
  422. id: retrieve_llvm_libs
  423. uses: actions/cache@v4
  424. with:
  425. path: |
  426. ./core/deps/llvm/build/bin
  427. ./core/deps/llvm/build/include
  428. ./core/deps/llvm/build/lib
  429. ./core/deps/llvm/build/libexec
  430. ./core/deps/llvm/build/share
  431. key: ${{ matrix.llvm_cache_key }}
  432. - name: Build wamrc
  433. run: |
  434. mkdir build && cd build
  435. cmake -D WAMR_BUILD_SANITIZER="${{matrix.sanitizer}}" ..
  436. cmake --build . --config Release --parallel 4
  437. working-directory: wamr-compiler
  438. - name: Build Sample [basic]
  439. run: |
  440. cd samples/basic
  441. ./build.sh
  442. ./run.sh
  443. - name: Build Sample [file]
  444. run: |
  445. cd samples/file
  446. mkdir build && cd build
  447. cmake ..
  448. cmake --build . --config Release --parallel 4
  449. ./src/iwasm -f wasm-app/file.wasm -d .
  450. - name: Build Sample [multi-thread]
  451. run: |
  452. cd samples/multi-thread
  453. mkdir build && cd build
  454. cmake ..
  455. cmake --build . --config Release --parallel 4
  456. ./iwasm wasm-apps/test.wasm
  457. - name: Build Sample [multi-module]
  458. run: |
  459. cd samples/multi-module
  460. mkdir build && cd build
  461. cmake .. -DWAMR_BUILD_AOT=1
  462. cmake --build . --config Release --parallel 4
  463. ./multi_module mC.wasm
  464. ./multi_module mC.aot
  465. - name: Build Sample [spawn-thread]
  466. run: |
  467. cd samples/spawn-thread
  468. mkdir build && cd build
  469. cmake ..
  470. cmake --build . --config Release --parallel 4
  471. ./spawn_thread
  472. - name: Build Sample [ref-types]
  473. run: |
  474. cd samples/ref-types
  475. mkdir build && cd build
  476. cmake ..
  477. cmake --build . --config Release --parallel 4
  478. ./hello
  479. - name: Build Sample [wasi-threads]
  480. run: |
  481. cd samples/wasi-threads
  482. mkdir build && cd build
  483. cmake ..
  484. cmake --build . --config Release --parallel 4
  485. ./iwasm wasm-apps/no_pthread.wasm
  486. - name: Build Sample [shared-module]
  487. run: |
  488. cd samples/shared-module
  489. ./build.sh
  490. ./run.sh
  491. - name: Build Sample [terminate]
  492. run: |
  493. cd samples/terminate
  494. ./build.sh
  495. ./run.sh
  496. - name: Build Sample [native-stack-overflow]
  497. run: |
  498. cd samples/native-stack-overflow
  499. ./build.sh
  500. ./run.sh test1
  501. ./run.sh test2
  502. - name: Build Sample [native-lib]
  503. run: |
  504. mkdir build && cd build
  505. cmake ..
  506. cmake --build . --config Release --parallel 4
  507. ./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
  508. working-directory: ./samples/native-lib
  509. # FIXME: un-comment me after fix cmake minimum issue
  510. # https://github.com/bytecodealliance/wamr-app-framework/pull/11
  511. # - name: checkout wamr-app-framework
  512. # run: git clone https://github.com/bytecodealliance/wamr-app-framework.git
  513. # - name: download wamr-app-framework dependencies
  514. # run: LVGL=0 LV_DRIVERS=0 ./download.sh
  515. # working-directory: ./wamr-app-framework/deps
  516. # - name: Build Sample [simple]
  517. # run: |
  518. # ./build.sh -p host-interp
  519. # python3 ./sample_test_run.py $(pwd)/out
  520. # exit $?
  521. # working-directory: ./wamr-app-framework/samples/simple
  522. - name: Build Sample [shared-heap]
  523. run: |
  524. cd samples/shared-heap
  525. mkdir build && cd build
  526. cmake ..
  527. cmake --build . --config Debug --parallel 4
  528. ./shared_heap_test
  529. ./shared_heap_test --aot
  530. test:
  531. needs: [build_iwasm, build_llvm_libraries_on_ubuntu, build_wamrc]
  532. runs-on: ${{ matrix.os }}
  533. strategy:
  534. fail-fast: false
  535. matrix:
  536. os: [ubuntu-22.04]
  537. sanitizer: ["", "ubsan", "asan", "tsan"]
  538. running_mode:
  539. [
  540. "classic-interp",
  541. "fast-interp",
  542. "jit",
  543. "aot",
  544. "fast-jit",
  545. "multi-tier-jit",
  546. ]
  547. test_option:
  548. [
  549. $DEFAULT_TEST_OPTIONS,
  550. $MULTI_MODULES_TEST_OPTIONS,
  551. $SIMD_TEST_OPTIONS,
  552. $EXTENDED_CONST_EXPR_TEST_OPTIONS,
  553. $THREADS_TEST_OPTIONS,
  554. $WASI_TEST_OPTIONS,
  555. ]
  556. include:
  557. - os: ubuntu-22.04
  558. llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu.outputs.cache_key }}
  559. ubuntu_version: "22.04"
  560. exclude:
  561. # asan works only for aot now
  562. - running_mode: "classic-interp"
  563. sanitizer: asan
  564. - running_mode: "fast-interp"
  565. sanitizer: asan
  566. - running_mode: "jit"
  567. sanitizer: asan
  568. - running_mode: "fast-jit"
  569. sanitizer: asan
  570. - running_mode: "multi-tier-jit"
  571. sanitizer: asan
  572. - running_mode: "classic-interp"
  573. sanitizer: tsan
  574. - running_mode: "jit"
  575. sanitizer: tsan
  576. - running_mode: "fast-jit"
  577. sanitizer: tsan
  578. - running_mode: "multi-tier-jit"
  579. sanitizer: tsan
  580. # simd128.h brings ubsan errors
  581. # like: negation of XXXcannot be represented in type 'long int';
  582. # cast to an unsigned type to negate this value to itself
  583. - running_mode: "fast-interp"
  584. sanitizer: ubsan
  585. steps:
  586. - name: checkout
  587. uses: actions/checkout@v4
  588. - name: install-wasi-sdk-wabt
  589. if: matrix.test_option == '$WASI_TEST_OPTIONS'
  590. uses: ./.github/actions/install-wasi-sdk-wabt
  591. with:
  592. os: ${{ matrix.os }}
  593. - name: set env variable(if llvm are used)
  594. if: matrix.running_mode == 'aot' || matrix.running_mode == 'jit' || matrix.running_mode == 'multi-tier-jit'
  595. run: echo "USE_LLVM=true" >> $GITHUB_ENV
  596. - name: set env variable(if x86_32 test needed)
  597. if: >
  598. (matrix.test_option == '$DEFAULT_TEST_OPTIONS' || matrix.test_option == '$THREADS_TEST_OPTIONS'
  599. || matrix.test_option == '$WASI_TEST_OPTIONS')
  600. && matrix.running_mode != 'fast-jit' && matrix.running_mode != 'jit' && matrix.running_mode != 'multi-tier-jit'
  601. run: echo "TEST_ON_X86_32=true" >> $GITHUB_ENV
  602. - name: set additional tsan options
  603. run: |
  604. echo "TSAN_OPTIONS=suppressions=$PWD/tsan_suppressions.txt" >> $GITHUB_ENV
  605. sudo sysctl vm.mmap_rnd_bits=28
  606. working-directory: tests/wamr-test-suites
  607. #only download llvm libraries in jit and aot mode
  608. - name: Get LLVM libraries
  609. if: env.USE_LLVM == 'true'
  610. id: retrieve_llvm_libs
  611. uses: actions/cache@v4
  612. with:
  613. path: |
  614. ./core/deps/llvm/build/bin
  615. ./core/deps/llvm/build/include
  616. ./core/deps/llvm/build/lib
  617. ./core/deps/llvm/build/libexec
  618. ./core/deps/llvm/build/share
  619. key: ${{ matrix.llvm_cache_key }}
  620. - name: Quit if cache miss
  621. if: env.USE_LLVM == 'true' && steps.retrieve_llvm_libs.outputs.cache-hit != 'true'
  622. run: echo "::error::can not get prebuilt llvm libraries" && exit 1
  623. - name: install jq JSON processor
  624. if: matrix.running_mode == 'aot' && matrix.test_option == '$WASI_TEST_OPTIONS'
  625. run: sudo apt-get update && sudo apt install -y jq
  626. - name: install for wabt compilation
  627. run: sudo apt update && sudo apt install -y ninja-build
  628. - name: Build WASI thread tests
  629. if: matrix.test_option == '$WASI_TEST_OPTIONS'
  630. run: bash build.sh
  631. working-directory: ./core/iwasm/libraries/lib-wasi-threads/test/
  632. - name: Build WASI thread stress tests
  633. if: matrix.test_option == '$WASI_TEST_OPTIONS'
  634. run: bash build.sh
  635. working-directory: ./core/iwasm/libraries/lib-wasi-threads/stress-test/
  636. - name: build socket api tests
  637. if: matrix.test_option == '$WASI_TEST_OPTIONS'
  638. run: bash build.sh
  639. working-directory: ./core/iwasm/libraries/lib-socket/test/
  640. - name: run tests
  641. timeout-minutes: 40
  642. run: ./test_wamr.sh ${{ matrix.test_option }} -t ${{ matrix.running_mode }} -T "${{ matrix.sanitizer }}"
  643. working-directory: ./tests/wamr-test-suites
  644. #only install x32 support libraries when to run x86_32 cases
  645. - name: install x32 support libraries
  646. if: env.TEST_ON_X86_32 == 'true'
  647. run:
  648. # Add another apt repository as some packages cannot
  649. # be downloaded with the github default repository
  650. sudo curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/apt/trusted.gpg.d/microsoft.asc &&
  651. sudo apt-add-repository https://packages.microsoft.com/ubuntu/${{ matrix.ubuntu_version }}/prod &&
  652. sudo apt-get update &&
  653. sudo apt install -y g++-multilib lib32gcc-9-dev
  654. - name: run tests x86_32
  655. timeout-minutes: 40
  656. if: env.TEST_ON_X86_32 == 'true'
  657. run: ./test_wamr.sh ${{ env.X86_32_TARGET_TEST_OPTIONS }} ${{ matrix.test_option }} -t ${{ matrix.running_mode }}
  658. working-directory: ./tests/wamr-test-suites