nightly_run.yml 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761
  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: checkout
  310. uses: actions/checkout@v3
  311. - name: Install dependencies
  312. uses: nick-fields/retry@v2
  313. with:
  314. timeout_minutes: 10
  315. max_attempts: 3
  316. command: apt update && apt install -y make g++-4.8 gcc-4.8 wget git
  317. on_retry_command: sudo rm -r /var/lib/apt/lists/*
  318. - name: Install cmake
  319. run: |
  320. wget https://github.com/Kitware/CMake/releases/download/v3.26.1/cmake-3.26.1-linux-x86_64.tar.gz -O cmake.tar.gz
  321. tar xzf cmake.tar.gz
  322. cp cmake-3.26.1-linux-x86_64/bin/cmake /usr/local/bin
  323. cp -r cmake-3.26.1-linux-x86_64/share/cmake-3.26/ /usr/local/share/
  324. - name: Build iwasm
  325. run: |
  326. mkdir build && cd build
  327. cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }} -DCMAKE_C_COMPILER=gcc-4.8 -DCMAKE_CXX_COMPILER=g++-4.8
  328. cmake --build . --config Release --parallel 4
  329. working-directory: product-mini/platforms/linux
  330. build_samples_wasm_c_api:
  331. needs:
  332. [
  333. build_iwasm,
  334. build_llvm_libraries_on_ubuntu_2004,
  335. build_wamrc,
  336. ]
  337. runs-on: ${{ matrix.os }}
  338. strategy:
  339. fail-fast: false
  340. matrix:
  341. sanitizer: ["", "ubsan", "asan"]
  342. make_options: [
  343. # Running mode
  344. $AOT_BUILD_OPTIONS,
  345. $CLASSIC_INTERP_BUILD_OPTIONS,
  346. $FAST_INTERP_BUILD_OPTIONS,
  347. $FAST_JIT_BUILD_OPTIONS,
  348. $LLVM_LAZY_JIT_BUILD_OPTIONS,
  349. $LLVM_EAGER_JIT_BUILD_OPTIONS,
  350. $MULTI_TIER_JIT_BUILD_OPTIONS,
  351. ]
  352. os: [ubuntu-20.04]
  353. wasi_sdk_release:
  354. [
  355. "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz",
  356. ]
  357. wabt_release:
  358. [
  359. "https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-ubuntu.tar.gz",
  360. ]
  361. include:
  362. - os: ubuntu-20.04
  363. llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2004.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: download and install wabt
  386. run: |
  387. cd /opt
  388. sudo wget ${{ matrix.wabt_release }}
  389. sudo tar -xzf wabt-1.0.31-*.tar.gz
  390. sudo mv wabt-1.0.31 wabt
  391. - name: Build wamrc
  392. if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS'))
  393. run: |
  394. mkdir build && cd build
  395. cmake -D WAMR_BUILD_SANITIZER="${{matrix.sanitizer}}" ..
  396. cmake --build . --config Release --parallel 4
  397. working-directory: wamr-compiler
  398. - name: Build Sample [wasm-c-api]
  399. run: |
  400. VERBOSE=1
  401. cmake -S . -B build ${{ matrix.make_options }} \
  402. -D WAMR_BUILD_SANITIZER="${{matrix.sanitizer}}" \
  403. -D WAMR_BUILD_QUICK_AOT_ENTRY=0
  404. cmake --build build --config Release --parallel 4
  405. ctest --test-dir build --output-on-failure
  406. working-directory: samples/wasm-c-api
  407. build_samples_others:
  408. needs:
  409. [
  410. build_iwasm,
  411. build_llvm_libraries_on_ubuntu_2004,
  412. build_wamrc,
  413. ]
  414. runs-on: ${{ matrix.os }}
  415. strategy:
  416. matrix:
  417. os: [ubuntu-20.04]
  418. wasi_sdk_release:
  419. [
  420. "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz",
  421. ]
  422. wabt_release:
  423. [
  424. "https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-ubuntu.tar.gz",
  425. ]
  426. include:
  427. - os: ubuntu-20.04
  428. llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2004.outputs.cache_key }}
  429. steps:
  430. - name: checkout
  431. uses: actions/checkout@v4
  432. - name: download and install wasi-sdk
  433. run: |
  434. cd /opt
  435. sudo wget ${{ matrix.wasi_sdk_release }}
  436. sudo tar -xzf wasi-sdk-*.tar.gz
  437. sudo ln -sf wasi-sdk-20.0 wasi-sdk
  438. - name: download and install wabt
  439. run: |
  440. cd /opt
  441. sudo wget ${{ matrix.wabt_release }}
  442. sudo tar -xzf wabt-1.0.31-*.tar.gz
  443. sudo ln -sf wabt-1.0.31 wabt
  444. - name: Get LLVM libraries
  445. id: retrieve_llvm_libs
  446. uses: actions/cache@v4
  447. with:
  448. path: |
  449. ./core/deps/llvm/build/bin
  450. ./core/deps/llvm/build/include
  451. ./core/deps/llvm/build/lib
  452. ./core/deps/llvm/build/libexec
  453. ./core/deps/llvm/build/share
  454. key: ${{ matrix.llvm_cache_key }}
  455. - name: Build wamrc
  456. run: |
  457. mkdir build && cd build
  458. cmake -D WAMR_BUILD_SANITIZER="${{matrix.sanitizer}}" ..
  459. cmake --build . --config Release --parallel 4
  460. working-directory: wamr-compiler
  461. - name: Build Sample [basic]
  462. run: |
  463. cd samples/basic
  464. ./build.sh
  465. ./run.sh
  466. - name: Build Sample [file]
  467. run: |
  468. cd samples/file
  469. mkdir build && cd build
  470. cmake ..
  471. cmake --build . --config Release --parallel 4
  472. ./src/iwasm -f wasm-app/file.wasm -d .
  473. - name: Build Sample [multi-thread]
  474. run: |
  475. cd samples/multi-thread
  476. mkdir build && cd build
  477. cmake ..
  478. cmake --build . --config Release --parallel 4
  479. ./iwasm wasm-apps/test.wasm
  480. - name: Build Sample [multi-module]
  481. run: |
  482. cd samples/multi-module
  483. mkdir build && cd build
  484. cmake .. -DWAMR_BUILD_AOT=1
  485. cmake --build . --config Release --parallel 4
  486. ./multi_module mC.wasm
  487. ./multi_module mC.aot
  488. - name: Build Sample [spawn-thread]
  489. run: |
  490. cd samples/spawn-thread
  491. mkdir build && cd build
  492. cmake ..
  493. cmake --build . --config Release --parallel 4
  494. ./spawn_thread
  495. - name: Build Sample [ref-types]
  496. run: |
  497. cd samples/ref-types
  498. mkdir build && cd build
  499. cmake ..
  500. cmake --build . --config Release --parallel 4
  501. ./hello
  502. - name: Build Sample [wasi-threads]
  503. run: |
  504. cd samples/wasi-threads
  505. mkdir build && cd build
  506. cmake ..
  507. cmake --build . --config Release --parallel 4
  508. ./iwasm wasm-apps/no_pthread.wasm
  509. - name: Build Sample [shared-module]
  510. run: |
  511. cd samples/shared-module
  512. ./build.sh
  513. ./run.sh
  514. - name: Build Sample [terminate]
  515. run: |
  516. cd samples/terminate
  517. ./build.sh
  518. ./run.sh
  519. - name: Build Sample [native-stack-overflow]
  520. run: |
  521. cd samples/native-stack-overflow
  522. ./build.sh
  523. ./run.sh test1
  524. ./run.sh test2
  525. - name: Build Sample [native-lib]
  526. run: |
  527. mkdir build && cd build
  528. cmake ..
  529. cmake --build . --config Release --parallel 4
  530. ./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
  531. working-directory: ./samples/native-lib
  532. - name: checkout wamr-app-framework
  533. run: git clone https://github.com/bytecodealliance/wamr-app-framework.git
  534. - name: download wamr-app-framework dependencies
  535. run: LVGL=0 LV_DRIVERS=0 ./download.sh
  536. working-directory: ./wamr-app-framework/deps
  537. - name: Build Sample [simple]
  538. run: |
  539. ./build.sh -p host-interp
  540. python3 ./sample_test_run.py $(pwd)/out
  541. exit $?
  542. working-directory: ./wamr-app-framework/samples/simple
  543. test:
  544. needs:
  545. [
  546. build_iwasm,
  547. build_llvm_libraries_on_ubuntu_2004,
  548. build_llvm_libraries_on_ubuntu_2204,
  549. build_wamrc,
  550. ]
  551. runs-on: ${{ matrix.os }}
  552. strategy:
  553. fail-fast: false
  554. matrix:
  555. os: [ubuntu-20.04, ubuntu-22.04]
  556. sanitizer: ["", "ubsan", "asan", "tsan"]
  557. running_mode:
  558. [
  559. "classic-interp",
  560. "fast-interp",
  561. "jit",
  562. "aot",
  563. "fast-jit",
  564. "multi-tier-jit",
  565. ]
  566. test_option:
  567. [
  568. $DEFAULT_TEST_OPTIONS,
  569. $MULTI_MODULES_TEST_OPTIONS,
  570. $SIMD_TEST_OPTIONS,
  571. $THREADS_TEST_OPTIONS,
  572. $WASI_TEST_OPTIONS,
  573. ]
  574. wasi_sdk_release:
  575. [
  576. "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz",
  577. ]
  578. include:
  579. - os: ubuntu-20.04
  580. llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2004.outputs.cache_key }}
  581. ubuntu_version: "20.04"
  582. - os: ubuntu-22.04
  583. llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
  584. ubuntu_version: "22.04"
  585. exclude:
  586. # incompatible modes and features
  587. - os: ubuntu-20.04
  588. sanitizer: tsan
  589. # asan works only for aot now
  590. - running_mode: "classic-interp"
  591. sanitizer: asan
  592. - running_mode: "fast-interp"
  593. sanitizer: asan
  594. - running_mode: "jit"
  595. sanitizer: asan
  596. - running_mode: "fast-jit"
  597. sanitizer: asan
  598. - running_mode: "multi-tier-jit"
  599. sanitizer: asan
  600. - running_mode: "classic-interp"
  601. sanitizer: tsan
  602. - running_mode: "jit"
  603. sanitizer: tsan
  604. - running_mode: "fast-jit"
  605. sanitizer: tsan
  606. - running_mode: "multi-tier-jit"
  607. sanitizer: tsan
  608. # classic-interp and fast-interp don't support simd
  609. - running_mode: "classic-interp"
  610. test_option: $SIMD_TEST_OPTIONS
  611. - running_mode: "fast-interp"
  612. test_option: $SIMD_TEST_OPTIONS
  613. # llvm jit doesn't support multi module
  614. - running_mode: "jit"
  615. test_option: $MULTI_MODULES_TEST_OPTIONS
  616. # fast-jit doesn't support multi module, simd
  617. - running_mode: "fast-jit"
  618. test_option: $MULTI_MODULES_TEST_OPTIONS
  619. - running_mode: "fast-jit"
  620. test_option: $SIMD_TEST_OPTIONS
  621. # multi-tier-jit doesn't support multi module, simd
  622. - running_mode: "multi-tier-jit"
  623. test_option: $MULTI_MODULES_TEST_OPTIONS
  624. - running_mode: "multi-tier-jit"
  625. test_option: $SIMD_TEST_OPTIONS
  626. steps:
  627. - name: checkout
  628. uses: actions/checkout@v4
  629. - name: download and install wasi-sdk
  630. if: matrix.test_option == '$WASI_TEST_OPTIONS'
  631. run: |
  632. cd /opt
  633. sudo wget ${{ matrix.wasi_sdk_release }}
  634. sudo tar -xzf wasi-sdk-*.tar.gz
  635. sudo mv wasi-sdk-20.0 wasi-sdk
  636. # It is a temporary solution until new wasi-sdk that includes bug fixes is released
  637. - name: build wasi-libc from source
  638. if: matrix.test_option == '$WASI_TEST_OPTIONS'
  639. run: |
  640. git clone https://github.com/WebAssembly/wasi-libc
  641. cd wasi-libc
  642. 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
  643. echo "SYSROOT_PATH=$PWD/sysroot" >> $GITHUB_ENV
  644. - name: set env variable(if llvm are used)
  645. if: matrix.running_mode == 'aot' || matrix.running_mode == 'jit' || matrix.running_mode == 'multi-tier-jit'
  646. run: echo "USE_LLVM=true" >> $GITHUB_ENV
  647. - name: set env variable(if x86_32 test needed)
  648. if: >
  649. (matrix.test_option == '$DEFAULT_TEST_OPTIONS' || matrix.test_option == '$THREADS_TEST_OPTIONS'
  650. || matrix.test_option == '$WASI_TEST_OPTIONS')
  651. && matrix.running_mode != 'fast-jit' && matrix.running_mode != 'jit' && matrix.running_mode != 'multi-tier-jit'
  652. run: echo "TEST_ON_X86_32=true" >> $GITHUB_ENV
  653. - name: set additional tsan options
  654. run: |
  655. echo "TSAN_OPTIONS=suppressions=$PWD/tsan_suppressions.txt" >> $GITHUB_ENV
  656. sudo sysctl vm.mmap_rnd_bits=28
  657. working-directory: tests/wamr-test-suites
  658. #only download llvm libraries in jit and aot mode
  659. - name: Get LLVM libraries
  660. if: env.USE_LLVM == 'true'
  661. id: retrieve_llvm_libs
  662. uses: actions/cache@v4
  663. with:
  664. path: |
  665. ./core/deps/llvm/build/bin
  666. ./core/deps/llvm/build/include
  667. ./core/deps/llvm/build/lib
  668. ./core/deps/llvm/build/libexec
  669. ./core/deps/llvm/build/share
  670. key: ${{ matrix.llvm_cache_key }}
  671. - name: Quit if cache miss
  672. if: env.USE_LLVM == 'true' && steps.retrieve_llvm_libs.outputs.cache-hit != 'true'
  673. run: echo "::error::can not get prebuilt llvm libraries" && exit 1
  674. - name: install jq JSON processor
  675. if: matrix.running_mode == 'aot' && matrix.test_option == '$WASI_TEST_OPTIONS'
  676. run: sudo apt-get update && sudo apt install -y jq
  677. - name: install for wabt compilation
  678. run: sudo apt update && sudo apt install -y ninja-build
  679. - name: Build WASI thread tests
  680. if: matrix.test_option == '$WASI_TEST_OPTIONS'
  681. run: bash build.sh --sysroot "$SYSROOT_PATH"
  682. working-directory: ./core/iwasm/libraries/lib-wasi-threads/test/
  683. - name: Build WASI thread stress tests
  684. if: matrix.test_option == '$WASI_TEST_OPTIONS'
  685. run: bash build.sh --sysroot "$SYSROOT_PATH"
  686. working-directory: ./core/iwasm/libraries/lib-wasi-threads/stress-test/
  687. - name: build socket api tests
  688. if: matrix.test_option == '$WASI_TEST_OPTIONS'
  689. run: bash build.sh
  690. working-directory: ./core/iwasm/libraries/lib-socket/test/
  691. - name: run tests
  692. timeout-minutes: 40
  693. run: ./test_wamr.sh ${{ matrix.test_option }} -t ${{ matrix.running_mode }} -T "${{ matrix.sanitizer }}"
  694. working-directory: ./tests/wamr-test-suites
  695. #only install x32 support libraries when to run x86_32 cases
  696. - name: install x32 support libraries
  697. if: env.TEST_ON_X86_32 == 'true'
  698. run:
  699. # Add another apt repository as some packages cannot
  700. # be downloaded with the github default repository
  701. sudo curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/apt/trusted.gpg.d/microsoft.asc &&
  702. sudo apt-add-repository https://packages.microsoft.com/ubuntu/${{ matrix.ubuntu_version }}/prod &&
  703. sudo apt-get update &&
  704. sudo apt install -y g++-multilib lib32gcc-9-dev
  705. - name: run tests x86_32
  706. timeout-minutes: 40
  707. if: env.TEST_ON_X86_32 == 'true'
  708. run: ./test_wamr.sh ${{ env.X86_32_TARGET_TEST_OPTIONS }} ${{ matrix.test_option }} -t ${{ matrix.running_mode }}
  709. working-directory: ./tests/wamr-test-suites