nightly_run.yml 26 KB

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