nightly_run.yml 29 KB

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