nightly_run.yml 29 KB

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