nightly_run.yml 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758
  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. jobs:
  42. build_llvm_libraries_on_ubuntu_2004:
  43. uses: ./.github/workflows/build_llvm_libraries.yml
  44. with:
  45. os: "ubuntu-20.04"
  46. arch: "X86"
  47. build_llvm_libraries_on_ubuntu_2204:
  48. uses: ./.github/workflows/build_llvm_libraries.yml
  49. with:
  50. os: "ubuntu-22.04"
  51. arch: "X86"
  52. build_wamrc:
  53. needs:
  54. [
  55. build_llvm_libraries_on_ubuntu_2004,
  56. ]
  57. runs-on: ${{ matrix.os }}
  58. strategy:
  59. matrix:
  60. include:
  61. - os: ubuntu-20.04
  62. llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2004.outputs.cache_key }}
  63. steps:
  64. - name: checkout
  65. uses: actions/checkout@v4
  66. # since jobs.id can't contain the dot character
  67. # it is hard to use `format` to assemble the cache key
  68. - name: Get LLVM libraries
  69. id: retrieve_llvm_libs
  70. uses: actions/cache@v4
  71. with:
  72. path: |
  73. ./core/deps/llvm/build/bin
  74. ./core/deps/llvm/build/include
  75. ./core/deps/llvm/build/lib
  76. ./core/deps/llvm/build/libexec
  77. ./core/deps/llvm/build/share
  78. key: ${{ matrix.llvm_cache_key }}
  79. - name: Quit if cache miss
  80. if: steps.retrieve_llvm_libs.outputs.cache-hit != 'true'
  81. run: echo "::error::can not get prebuilt llvm libraries" && exit 1
  82. - name: Build wamrc
  83. run: |
  84. mkdir build && cd build
  85. cmake ..
  86. cmake --build . --config Release --parallel 4
  87. working-directory: wamr-compiler
  88. build_iwasm:
  89. needs:
  90. [
  91. build_llvm_libraries_on_ubuntu_2004,
  92. ]
  93. runs-on: ${{ matrix.os }}
  94. strategy:
  95. matrix:
  96. make_options_run_mode: [
  97. # Running mode
  98. $AOT_BUILD_OPTIONS,
  99. $CLASSIC_INTERP_BUILD_OPTIONS,
  100. $FAST_INTERP_BUILD_OPTIONS,
  101. $FAST_JIT_BUILD_OPTIONS,
  102. $LLVM_LAZY_JIT_BUILD_OPTIONS,
  103. $LLVM_EAGER_JIT_BUILD_OPTIONS,
  104. $MULTI_TIER_JIT_BUILD_OPTIONS,
  105. ]
  106. make_options_feature: [
  107. # Features
  108. "-DWAMR_BUILD_CUSTOM_NAME_SECTION=1",
  109. "-DWAMR_BUILD_DEBUG_AOT=1",
  110. "-DWAMR_BUILD_DEBUG_INTERP=1",
  111. "-DWAMR_BUILD_DUMP_CALL_STACK=1",
  112. "-DWAMR_BUILD_LIB_PTHREAD=1",
  113. "-DWAMR_BUILD_LIB_WASI_THREADS=1",
  114. "-DWAMR_BUILD_LOAD_CUSTOM_SECTION=1",
  115. "-DWAMR_BUILD_MINI_LOADER=1",
  116. "-DWAMR_BUILD_MEMORY_PROFILING=1",
  117. "-DWAMR_BUILD_MULTI_MODULE=1",
  118. "-DWAMR_BUILD_PERF_PROFILING=1",
  119. "-DWAMR_BUILD_REF_TYPES=1",
  120. "-DWAMR_BUILD_SIMD=1",
  121. "-DWAMR_BUILD_TAIL_CALL=1",
  122. "-DWAMR_DISABLE_HW_BOUND_CHECK=1",
  123. "-DWAMR_BUILD_MEMORY64=1",
  124. ]
  125. os: [ubuntu-20.04]
  126. platform: [android, linux]
  127. exclude:
  128. # incompatible feature and platform
  129. # incompatible mode and feature
  130. # MULTI_MODULE only on INTERP mode and AOT mode
  131. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  132. make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
  133. - make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
  134. make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
  135. - make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
  136. make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
  137. - make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
  138. make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
  139. # SIMD only on JIT/AOT mode
  140. - make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS
  141. make_options_feature: "-DWAMR_BUILD_SIMD=1"
  142. - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
  143. make_options_feature: "-DWAMR_BUILD_SIMD=1"
  144. # DEBUG_INTERP only on CLASSIC INTERP mode
  145. - make_options_run_mode: $AOT_BUILD_OPTIONS
  146. make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
  147. - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
  148. make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
  149. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  150. make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
  151. - make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
  152. make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
  153. - make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
  154. make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
  155. - make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
  156. make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
  157. # DEBUG_AOT only on JIT/AOT mode
  158. - make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS
  159. make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
  160. - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
  161. make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
  162. # TODO: DEBUG_AOT on JIT
  163. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  164. make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
  165. - make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
  166. make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
  167. - make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
  168. make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
  169. - make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
  170. make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
  171. # MINI_LOADER only on INTERP mode
  172. - make_options_run_mode: $AOT_BUILD_OPTIONS
  173. make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
  174. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  175. make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
  176. - make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
  177. make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
  178. - make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
  179. make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
  180. - make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
  181. make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
  182. # Memory64 only on CLASSIC INTERP mode, and only on 64-bit platform
  183. - make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
  184. platform: android
  185. - make_options_run_mode: $AOT_BUILD_OPTIONS
  186. make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
  187. - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
  188. make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
  189. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  190. make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
  191. - make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
  192. make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
  193. - make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
  194. make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
  195. - make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
  196. make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
  197. # Fast-JIT and Multi-Tier-JIT mode don't support android
  198. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  199. platform: android
  200. - make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
  201. platform: android
  202. # LLVM JIT pre-built binary wasn't compiled by Android NDK
  203. # and isn't available for android
  204. - make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
  205. platform: android
  206. - make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
  207. platform: android
  208. include:
  209. - os: ubuntu-20.04
  210. llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2004.outputs.cache_key }}
  211. steps:
  212. - name: checkout
  213. uses: actions/checkout@v4
  214. # only download llvm cache when needed
  215. - name: Get LLVM libraries
  216. id: retrieve_llvm_libs
  217. if: endsWith(matrix.make_options_run_mode, '_JIT_BUILD_OPTIONS')
  218. uses: actions/cache@v4
  219. with:
  220. path: |
  221. ./core/deps/llvm/build/bin
  222. ./core/deps/llvm/build/include
  223. ./core/deps/llvm/build/lib
  224. ./core/deps/llvm/build/libexec
  225. ./core/deps/llvm/build/share
  226. key: ${{ matrix.llvm_cache_key }}
  227. - name: Quit if cache miss
  228. if: endsWith(matrix.make_options_run_mode, '_JIT_BUILD_OPTIONS') && (steps.retrieve_llvm_libs.outputs.cache-hit != 'true')
  229. run: echo "::error::can not get prebuilt llvm libraries" && exit 1
  230. - name: Build iwasm for linux
  231. if: matrix.platform == 'linux'
  232. run: |
  233. mkdir build && cd build
  234. cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }}
  235. cmake --build . --config Release --parallel 4
  236. working-directory: product-mini/platforms/${{ matrix.platform }}
  237. - name: Build iwasm for android
  238. if: matrix.platform == 'android'
  239. run: |
  240. mkdir build && cd build
  241. cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }} \
  242. -DWAMR_BUILD_TARGET=X86_64
  243. cmake --build . --config Release --parallel 4
  244. working-directory: product-mini/platforms/${{ matrix.platform }}
  245. build_iwasm_linux_gcc4_8:
  246. runs-on: ubuntu-latest
  247. container:
  248. image: ubuntu:14.04
  249. strategy:
  250. matrix:
  251. make_options_run_mode: [
  252. # Running mode
  253. $CLASSIC_INTERP_BUILD_OPTIONS,
  254. $FAST_INTERP_BUILD_OPTIONS,
  255. $FAST_JIT_BUILD_OPTIONS,
  256. ]
  257. make_options_feature: [
  258. # Features
  259. "-DWAMR_BUILD_CUSTOM_NAME_SECTION=1",
  260. "-DWAMR_BUILD_DEBUG_AOT=1",
  261. "-DWAMR_BUILD_DEBUG_INTERP=1",
  262. "-DWAMR_BUILD_DUMP_CALL_STACK=1",
  263. "-DWAMR_BUILD_LIB_PTHREAD=1",
  264. "-DWAMR_BUILD_LIB_WASI_THREADS=1",
  265. "-DWAMR_BUILD_LOAD_CUSTOM_SECTION=1",
  266. "-DWAMR_BUILD_MINI_LOADER=1",
  267. "-DWAMR_BUILD_MEMORY_PROFILING=1",
  268. "-DWAMR_BUILD_MULTI_MODULE=1",
  269. "-DWAMR_BUILD_PERF_PROFILING=1",
  270. "-DWAMR_BUILD_REF_TYPES=1",
  271. "-DWAMR_BUILD_SIMD=1",
  272. "-DWAMR_BUILD_TAIL_CALL=1",
  273. "-DWAMR_DISABLE_HW_BOUND_CHECK=1",
  274. "-DWAMR_BUILD_MEMORY64=1",
  275. ]
  276. exclude:
  277. # incompatible feature and platform
  278. # incompatible mode and feature
  279. # MULTI_MODULE only on INTERP mode and AOT mode
  280. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  281. make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
  282. # SIMD only on JIT/AOT mode
  283. - make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS
  284. make_options_feature: "-DWAMR_BUILD_SIMD=1"
  285. - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
  286. make_options_feature: "-DWAMR_BUILD_SIMD=1"
  287. # DEBUG_INTERP only on CLASSIC INTERP mode
  288. - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
  289. make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
  290. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  291. make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
  292. # DEBUG_AOT only on JIT/AOT mode
  293. - make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS
  294. make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
  295. - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
  296. make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
  297. # TODO: DEBUG_AOT on JIT
  298. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  299. make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
  300. # MINI_LOADER only on INTERP mode
  301. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  302. make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
  303. # Memory64 only on CLASSIC INTERP mode
  304. - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
  305. make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
  306. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  307. make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
  308. steps:
  309. - name: Install dependencies
  310. run: |
  311. apt update && apt install -y make g++-4.8 gcc-4.8 wget git
  312. - name: checkout
  313. run: |
  314. git clone https://github.com/${{ github.repository }} wamr
  315. - name: Install cmake
  316. run: |
  317. wget https://github.com/Kitware/CMake/releases/download/v3.26.1/cmake-3.26.1-linux-x86_64.tar.gz -O cmake.tar.gz
  318. tar xzf cmake.tar.gz
  319. cp cmake-3.26.1-linux-x86_64/bin/cmake /usr/local/bin
  320. cp -r cmake-3.26.1-linux-x86_64/share/cmake-3.26/ /usr/local/share/
  321. - name: Build iwasm
  322. run: |
  323. mkdir build && cd build
  324. cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }} -DCMAKE_C_COMPILER=gcc-4.8 -DCMAKE_CXX_COMPILER=g++-4.8
  325. cmake --build . --config Release --parallel 4
  326. working-directory: wamr/product-mini/platforms/linux
  327. build_samples_wasm_c_api:
  328. needs:
  329. [
  330. build_iwasm,
  331. build_llvm_libraries_on_ubuntu_2004,
  332. build_wamrc,
  333. ]
  334. runs-on: ${{ matrix.os }}
  335. strategy:
  336. fail-fast: false
  337. matrix:
  338. sanitizer: ["", "ubsan", "asan"]
  339. make_options: [
  340. # Running mode
  341. $AOT_BUILD_OPTIONS,
  342. $CLASSIC_INTERP_BUILD_OPTIONS,
  343. $FAST_INTERP_BUILD_OPTIONS,
  344. $FAST_JIT_BUILD_OPTIONS,
  345. $LLVM_LAZY_JIT_BUILD_OPTIONS,
  346. $LLVM_EAGER_JIT_BUILD_OPTIONS,
  347. $MULTI_TIER_JIT_BUILD_OPTIONS,
  348. ]
  349. os: [ubuntu-20.04]
  350. wasi_sdk_release:
  351. [
  352. "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz",
  353. ]
  354. wabt_release:
  355. [
  356. "https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-ubuntu.tar.gz",
  357. ]
  358. include:
  359. - os: ubuntu-20.04
  360. llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2004.outputs.cache_key }}
  361. exclude:
  362. - make_options: $MULTI_TIER_JIT_BUILD_OPTIONS
  363. sanitizer: asan
  364. steps:
  365. - name: checkout
  366. uses: actions/checkout@v4
  367. - name: Get LLVM libraries
  368. id: retrieve_llvm_libs
  369. if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS'))
  370. uses: actions/cache@v4
  371. with:
  372. path: |
  373. ./core/deps/llvm/build/bin
  374. ./core/deps/llvm/build/include
  375. ./core/deps/llvm/build/lib
  376. ./core/deps/llvm/build/libexec
  377. ./core/deps/llvm/build/share
  378. key: ${{ matrix.llvm_cache_key }}
  379. - name: Quit if cache miss
  380. if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS')) && (steps.retrieve_llvm_libs.outputs.cache-hit != 'true')
  381. run: echo "::error::can not get prebuilt llvm libraries" && exit 1
  382. - name: download and install wabt
  383. run: |
  384. cd /opt
  385. sudo wget ${{ matrix.wabt_release }}
  386. sudo tar -xzf wabt-1.0.31-*.tar.gz
  387. sudo mv wabt-1.0.31 wabt
  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:
  406. [
  407. build_iwasm,
  408. build_llvm_libraries_on_ubuntu_2004,
  409. build_wamrc,
  410. ]
  411. runs-on: ${{ matrix.os }}
  412. strategy:
  413. matrix:
  414. os: [ubuntu-20.04]
  415. wasi_sdk_release:
  416. [
  417. "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz",
  418. ]
  419. wabt_release:
  420. [
  421. "https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-ubuntu.tar.gz",
  422. ]
  423. include:
  424. - os: ubuntu-20.04
  425. llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2004.outputs.cache_key }}
  426. steps:
  427. - name: checkout
  428. uses: actions/checkout@v4
  429. - name: download and install wasi-sdk
  430. run: |
  431. cd /opt
  432. sudo wget ${{ matrix.wasi_sdk_release }}
  433. sudo tar -xzf wasi-sdk-*.tar.gz
  434. sudo ln -sf wasi-sdk-20.0 wasi-sdk
  435. - name: download and install wabt
  436. run: |
  437. cd /opt
  438. sudo wget ${{ matrix.wabt_release }}
  439. sudo tar -xzf wabt-1.0.31-*.tar.gz
  440. sudo ln -sf wabt-1.0.31 wabt
  441. - name: Get LLVM libraries
  442. id: retrieve_llvm_libs
  443. uses: actions/cache@v4
  444. with:
  445. path: |
  446. ./core/deps/llvm/build/bin
  447. ./core/deps/llvm/build/include
  448. ./core/deps/llvm/build/lib
  449. ./core/deps/llvm/build/libexec
  450. ./core/deps/llvm/build/share
  451. key: ${{ matrix.llvm_cache_key }}
  452. - name: Build wamrc
  453. run: |
  454. mkdir build && cd build
  455. cmake -D WAMR_BUILD_SANITIZER="${{matrix.sanitizer}}" ..
  456. cmake --build . --config Release --parallel 4
  457. working-directory: wamr-compiler
  458. - name: Build Sample [basic]
  459. run: |
  460. cd samples/basic
  461. ./build.sh
  462. ./run.sh
  463. - name: Build Sample [file]
  464. run: |
  465. cd samples/file
  466. mkdir build && cd build
  467. cmake ..
  468. cmake --build . --config Release --parallel 4
  469. ./src/iwasm -f wasm-app/file.wasm -d .
  470. - name: Build Sample [multi-thread]
  471. run: |
  472. cd samples/multi-thread
  473. mkdir build && cd build
  474. cmake ..
  475. cmake --build . --config Release --parallel 4
  476. ./iwasm wasm-apps/test.wasm
  477. - name: Build Sample [multi-module]
  478. run: |
  479. cd samples/multi-module
  480. mkdir build && cd build
  481. cmake .. -DWAMR_BUILD_AOT=1
  482. cmake --build . --config Release --parallel 4
  483. ./multi_module mC.wasm
  484. ./multi_module mC.aot
  485. - name: Build Sample [spawn-thread]
  486. run: |
  487. cd samples/spawn-thread
  488. mkdir build && cd build
  489. cmake ..
  490. cmake --build . --config Release --parallel 4
  491. ./spawn_thread
  492. - name: Build Sample [ref-types]
  493. run: |
  494. cd samples/ref-types
  495. mkdir build && cd build
  496. cmake ..
  497. cmake --build . --config Release --parallel 4
  498. ./hello
  499. - name: Build Sample [wasi-threads]
  500. run: |
  501. cd samples/wasi-threads
  502. mkdir build && cd build
  503. cmake ..
  504. cmake --build . --config Release --parallel 4
  505. ./iwasm wasm-apps/no_pthread.wasm
  506. - name: Build Sample [shared-module]
  507. run: |
  508. cd samples/shared-module
  509. ./build.sh
  510. ./run.sh
  511. - name: Build Sample [terminate]
  512. run: |
  513. cd samples/terminate
  514. ./build.sh
  515. ./run.sh
  516. - name: Build Sample [native-stack-overflow]
  517. run: |
  518. cd samples/native-stack-overflow
  519. ./build.sh
  520. ./run.sh test1
  521. ./run.sh test2
  522. - name: Build Sample [native-lib]
  523. run: |
  524. mkdir build && cd build
  525. cmake ..
  526. cmake --build . --config Release --parallel 4
  527. ./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
  528. working-directory: ./samples/native-lib
  529. - name: checkout wamr-app-framework
  530. run: git clone https://github.com/bytecodealliance/wamr-app-framework.git
  531. - name: download wamr-app-framework dependencies
  532. run: LVGL=0 LV_DRIVERS=0 ./download.sh
  533. working-directory: ./wamr-app-framework/deps
  534. - name: Build Sample [simple]
  535. run: |
  536. ./build.sh -p host-interp
  537. python3 ./sample_test_run.py $(pwd)/out
  538. exit $?
  539. working-directory: ./wamr-app-framework/samples/simple
  540. test:
  541. needs:
  542. [
  543. build_iwasm,
  544. build_llvm_libraries_on_ubuntu_2004,
  545. build_llvm_libraries_on_ubuntu_2204,
  546. build_wamrc,
  547. ]
  548. runs-on: ${{ matrix.os }}
  549. strategy:
  550. fail-fast: false
  551. matrix:
  552. os: [ubuntu-20.04, ubuntu-22.04]
  553. sanitizer: ["", "ubsan", "asan", "tsan"]
  554. running_mode:
  555. [
  556. "classic-interp",
  557. "fast-interp",
  558. "jit",
  559. "aot",
  560. "fast-jit",
  561. "multi-tier-jit",
  562. ]
  563. test_option:
  564. [
  565. $DEFAULT_TEST_OPTIONS,
  566. $MULTI_MODULES_TEST_OPTIONS,
  567. $SIMD_TEST_OPTIONS,
  568. $THREADS_TEST_OPTIONS,
  569. $WASI_TEST_OPTIONS,
  570. ]
  571. wasi_sdk_release:
  572. [
  573. "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz",
  574. ]
  575. include:
  576. - os: ubuntu-20.04
  577. llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2004.outputs.cache_key }}
  578. ubuntu_version: "20.04"
  579. - os: ubuntu-22.04
  580. llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
  581. ubuntu_version: "22.04"
  582. exclude:
  583. # incompatible modes and features
  584. - os: ubuntu-20.04
  585. sanitizer: tsan
  586. # asan works only for aot now
  587. - running_mode: "classic-interp"
  588. sanitizer: asan
  589. - running_mode: "fast-interp"
  590. sanitizer: asan
  591. - running_mode: "jit"
  592. sanitizer: asan
  593. - running_mode: "fast-jit"
  594. sanitizer: asan
  595. - running_mode: "multi-tier-jit"
  596. sanitizer: asan
  597. - running_mode: "classic-interp"
  598. sanitizer: tsan
  599. - running_mode: "jit"
  600. sanitizer: tsan
  601. - running_mode: "fast-jit"
  602. sanitizer: tsan
  603. - running_mode: "multi-tier-jit"
  604. sanitizer: tsan
  605. # classic-interp and fast-interp don't support simd
  606. - running_mode: "classic-interp"
  607. test_option: $SIMD_TEST_OPTIONS
  608. - running_mode: "fast-interp"
  609. test_option: $SIMD_TEST_OPTIONS
  610. # llvm jit doesn't support multi module
  611. - running_mode: "jit"
  612. test_option: $MULTI_MODULES_TEST_OPTIONS
  613. # fast-jit doesn't support multi module, simd
  614. - running_mode: "fast-jit"
  615. test_option: $MULTI_MODULES_TEST_OPTIONS
  616. - running_mode: "fast-jit"
  617. test_option: $SIMD_TEST_OPTIONS
  618. # multi-tier-jit doesn't support multi module, simd
  619. - running_mode: "multi-tier-jit"
  620. test_option: $MULTI_MODULES_TEST_OPTIONS
  621. - running_mode: "multi-tier-jit"
  622. test_option: $SIMD_TEST_OPTIONS
  623. steps:
  624. - name: checkout
  625. uses: actions/checkout@v4
  626. - name: download and install wasi-sdk
  627. if: matrix.test_option == '$WASI_TEST_OPTIONS'
  628. run: |
  629. cd /opt
  630. sudo wget ${{ matrix.wasi_sdk_release }}
  631. sudo tar -xzf wasi-sdk-*.tar.gz
  632. sudo mv wasi-sdk-20.0 wasi-sdk
  633. # It is a temporary solution until new wasi-sdk that includes bug fixes is released
  634. - name: build wasi-libc from source
  635. if: matrix.test_option == '$WASI_TEST_OPTIONS'
  636. run: |
  637. git clone https://github.com/WebAssembly/wasi-libc
  638. cd wasi-libc
  639. make -j AR=/opt/wasi-sdk/bin/llvm-ar NM=/opt/wasi-sdk/bin/llvm-nm CC=/opt/wasi-sdk/bin/clang THREAD_MODEL=posix
  640. echo "SYSROOT_PATH=$PWD/sysroot" >> $GITHUB_ENV
  641. - name: set env variable(if llvm are used)
  642. if: matrix.running_mode == 'aot' || matrix.running_mode == 'jit' || matrix.running_mode == 'multi-tier-jit'
  643. run: echo "USE_LLVM=true" >> $GITHUB_ENV
  644. - name: set env variable(if x86_32 test needed)
  645. if: >
  646. (matrix.test_option == '$DEFAULT_TEST_OPTIONS' || matrix.test_option == '$THREADS_TEST_OPTIONS'
  647. || matrix.test_option == '$WASI_TEST_OPTIONS')
  648. && matrix.running_mode != 'fast-jit' && matrix.running_mode != 'jit' && matrix.running_mode != 'multi-tier-jit'
  649. run: echo "TEST_ON_X86_32=true" >> $GITHUB_ENV
  650. - name: set additional tsan options
  651. run: |
  652. echo "TSAN_OPTIONS=suppressions=$PWD/tsan_suppressions.txt" >> $GITHUB_ENV
  653. sudo sysctl vm.mmap_rnd_bits=28
  654. working-directory: tests/wamr-test-suites
  655. #only download llvm libraries in jit and aot mode
  656. - name: Get LLVM libraries
  657. if: env.USE_LLVM == 'true'
  658. id: retrieve_llvm_libs
  659. uses: actions/cache@v4
  660. with:
  661. path: |
  662. ./core/deps/llvm/build/bin
  663. ./core/deps/llvm/build/include
  664. ./core/deps/llvm/build/lib
  665. ./core/deps/llvm/build/libexec
  666. ./core/deps/llvm/build/share
  667. key: ${{ matrix.llvm_cache_key }}
  668. - name: Quit if cache miss
  669. if: env.USE_LLVM == 'true' && steps.retrieve_llvm_libs.outputs.cache-hit != 'true'
  670. run: echo "::error::can not get prebuilt llvm libraries" && exit 1
  671. - name: install jq JSON processor
  672. if: matrix.running_mode == 'aot' && matrix.test_option == '$WASI_TEST_OPTIONS'
  673. run: sudo apt-get update && sudo apt install -y jq
  674. - name: install for wabt compilation
  675. run: sudo apt update && sudo apt install -y ninja-build
  676. - name: Build WASI thread tests
  677. if: matrix.test_option == '$WASI_TEST_OPTIONS'
  678. run: bash build.sh --sysroot "$SYSROOT_PATH"
  679. working-directory: ./core/iwasm/libraries/lib-wasi-threads/test/
  680. - name: Build WASI thread stress tests
  681. if: matrix.test_option == '$WASI_TEST_OPTIONS'
  682. run: bash build.sh --sysroot "$SYSROOT_PATH"
  683. working-directory: ./core/iwasm/libraries/lib-wasi-threads/stress-test/
  684. - name: build socket api tests
  685. if: matrix.test_option == '$WASI_TEST_OPTIONS'
  686. run: bash build.sh
  687. working-directory: ./core/iwasm/libraries/lib-socket/test/
  688. - name: run tests
  689. timeout-minutes: 40
  690. run: ./test_wamr.sh ${{ matrix.test_option }} -t ${{ matrix.running_mode }} -T "${{ matrix.sanitizer }}"
  691. working-directory: ./tests/wamr-test-suites
  692. #only install x32 support libraries when to run x86_32 cases
  693. - name: install x32 support libraries
  694. if: env.TEST_ON_X86_32 == 'true'
  695. run:
  696. # Add another apt repository as some packages cannot
  697. # be downloaded with the github default repository
  698. sudo curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/apt/trusted.gpg.d/microsoft.asc &&
  699. sudo apt-add-repository https://packages.microsoft.com/ubuntu/${{ matrix.ubuntu_version }}/prod &&
  700. sudo apt-get update &&
  701. sudo apt install -y g++-multilib lib32gcc-9-dev
  702. - name: run tests x86_32
  703. timeout-minutes: 40
  704. if: env.TEST_ON_X86_32 == 'true'
  705. run: ./test_wamr.sh ${{ env.X86_32_TARGET_TEST_OPTIONS }} ${{ matrix.test_option }} -t ${{ matrix.running_mode }}
  706. working-directory: ./tests/wamr-test-suites