nightly_run.yml 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687
  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@v3
  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@v3
  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@v3
  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@v3
  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@v3
  332. - name: Get LLVM libraries
  333. id: retrieve_llvm_libs
  334. if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS'))
  335. uses: actions/cache@v3
  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 }} -D WAMR_BUILD_SANITIZER="${{matrix.sanitizer}}"
  364. cmake --build build --config Release --parallel 4
  365. ctest --test-dir build --output-on-failure
  366. working-directory: samples/wasm-c-api
  367. build_samples_others:
  368. needs:
  369. [
  370. build_iwasm,
  371. build_llvm_libraries_on_ubuntu_2004,
  372. build_wamrc,
  373. ]
  374. runs-on: ${{ matrix.os }}
  375. strategy:
  376. matrix:
  377. os: [ubuntu-20.04]
  378. wasi_sdk_release:
  379. [
  380. "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz",
  381. ]
  382. wabt_release:
  383. [
  384. "https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-ubuntu.tar.gz",
  385. ]
  386. include:
  387. - os: ubuntu-20.04
  388. llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2004.outputs.cache_key }}
  389. steps:
  390. - name: checkout
  391. uses: actions/checkout@v3
  392. - name: download and install wasi-sdk
  393. run: |
  394. cd /opt
  395. sudo wget ${{ matrix.wasi_sdk_release }}
  396. sudo tar -xzf wasi-sdk-*.tar.gz
  397. sudo mv wasi-sdk-20.0 wasi-sdk
  398. - name: download and install wabt
  399. run: |
  400. cd /opt
  401. sudo wget ${{ matrix.wabt_release }}
  402. sudo tar -xzf wabt-1.0.31-*.tar.gz
  403. sudo mv wabt-1.0.31 wabt
  404. - name: Get LLVM libraries
  405. id: retrieve_llvm_libs
  406. uses: actions/cache@v3
  407. with:
  408. path: |
  409. ./core/deps/llvm/build/bin
  410. ./core/deps/llvm/build/include
  411. ./core/deps/llvm/build/lib
  412. ./core/deps/llvm/build/libexec
  413. ./core/deps/llvm/build/share
  414. key: ${{ matrix.llvm_cache_key }}
  415. - name: Build wamrc
  416. run: |
  417. mkdir build && cd build
  418. cmake -D WAMR_BUILD_SANITIZER="${{matrix.sanitizer}}" ..
  419. cmake --build . --config Release --parallel 4
  420. working-directory: wamr-compiler
  421. - name: Build Sample [basic]
  422. run: |
  423. cd samples/basic
  424. ./build.sh
  425. ./run.sh
  426. - name: Build Sample [file]
  427. run: |
  428. cd samples/file
  429. mkdir build && cd build
  430. cmake ..
  431. cmake --build . --config Release --parallel 4
  432. ./src/iwasm -f wasm-app/file.wasm -d .
  433. - name: Build Sample [multi-thread]
  434. run: |
  435. cd samples/multi-thread
  436. mkdir build && cd build
  437. cmake ..
  438. cmake --build . --config Release --parallel 4
  439. ./iwasm wasm-apps/test.wasm
  440. - name: Build Sample [multi-module]
  441. run: |
  442. cd samples/multi-module
  443. mkdir build && cd build
  444. cmake .. -DWAMR_BUILD_AOT=1
  445. cmake --build . --config Release --parallel 4
  446. ./multi_module mC.wasm
  447. ./multi_module mC.aot
  448. - name: Build Sample [spawn-thread]
  449. run: |
  450. cd samples/spawn-thread
  451. mkdir build && cd build
  452. cmake ..
  453. cmake --build . --config Release --parallel 4
  454. ./spawn_thread
  455. - name: Build Sample [ref-types]
  456. run: |
  457. cd samples/ref-types
  458. mkdir build && cd build
  459. cmake ..
  460. cmake --build . --config Release --parallel 4
  461. ./hello
  462. - name: Build Sample [simple]
  463. run: |
  464. ./build.sh -p host-interp
  465. python3 ./sample_test_run.py $(pwd)/out
  466. exit $?
  467. working-directory: ./samples/simple
  468. - name: Build Sample [wasi-threads]
  469. run: |
  470. cd samples/wasi-threads
  471. mkdir build && cd build
  472. cmake ..
  473. cmake --build . --config Release --parallel 4
  474. ./iwasm wasm-apps/no_pthread.wasm
  475. - name: Build Sample [shared-module]
  476. run: |
  477. cd samples/shared-module
  478. ./build.sh
  479. ./run.sh
  480. test:
  481. needs:
  482. [
  483. build_iwasm,
  484. build_llvm_libraries_on_ubuntu_2004,
  485. build_llvm_libraries_on_ubuntu_2204,
  486. build_wamrc,
  487. ]
  488. runs-on: ${{ matrix.os }}
  489. strategy:
  490. fail-fast: false
  491. matrix:
  492. os: [ubuntu-20.04, ubuntu-22.04]
  493. sanitizer: ["", "ubsan", "asan", "tsan"]
  494. running_mode:
  495. [
  496. "classic-interp",
  497. "fast-interp",
  498. "jit",
  499. "aot",
  500. "fast-jit",
  501. "multi-tier-jit",
  502. ]
  503. test_option:
  504. [
  505. $DEFAULT_TEST_OPTIONS,
  506. $MULTI_MODULES_TEST_OPTIONS,
  507. $SIMD_TEST_OPTIONS,
  508. $THREADS_TEST_OPTIONS,
  509. $WASI_TEST_OPTIONS,
  510. ]
  511. wasi_sdk_release:
  512. [
  513. "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz",
  514. ]
  515. include:
  516. - os: ubuntu-20.04
  517. llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2004.outputs.cache_key }}
  518. ubuntu_version: "20.04"
  519. - os: ubuntu-22.04
  520. llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
  521. ubuntu_version: "22.04"
  522. exclude:
  523. # uncompatiable modes and features
  524. - os: ubuntu-20.04
  525. sanitizer: tsan
  526. # asan works only for aot now
  527. - running_mode: "classic-interp"
  528. sanitizer: asan
  529. - running_mode: "fast-interp"
  530. sanitizer: asan
  531. - running_mode: "jit"
  532. sanitizer: asan
  533. - running_mode: "fast-jit"
  534. sanitizer: asan
  535. - running_mode: "multi-tier-jit"
  536. sanitizer: asan
  537. - running_mode: "classic-interp"
  538. sanitizer: tsan
  539. - running_mode: "jit"
  540. sanitizer: tsan
  541. - running_mode: "fast-jit"
  542. sanitizer: tsan
  543. - running_mode: "multi-tier-jit"
  544. sanitizer: tsan
  545. # classic-interp and fast-interp don't support simd
  546. - running_mode: "classic-interp"
  547. test_option: $SIMD_TEST_OPTIONS
  548. - running_mode: "fast-interp"
  549. test_option: $SIMD_TEST_OPTIONS
  550. # llvm jit doesn't support multi module
  551. - running_mode: "jit"
  552. test_option: $MULTI_MODULES_TEST_OPTIONS
  553. # fast-jit doesn't support multi module, simd
  554. - running_mode: "fast-jit"
  555. test_option: $MULTI_MODULES_TEST_OPTIONS
  556. - running_mode: "fast-jit"
  557. test_option: $SIMD_TEST_OPTIONS
  558. # multi-tier-jit doesn't support multi module, simd
  559. - running_mode: "multi-tier-jit"
  560. test_option: $MULTI_MODULES_TEST_OPTIONS
  561. - running_mode: "multi-tier-jit"
  562. test_option: $SIMD_TEST_OPTIONS
  563. steps:
  564. - name: checkout
  565. uses: actions/checkout@v3
  566. - name: download and install wasi-sdk
  567. if: matrix.test_option == '$WASI_TEST_OPTIONS'
  568. run: |
  569. cd /opt
  570. sudo wget ${{ matrix.wasi_sdk_release }}
  571. sudo tar -xzf wasi-sdk-*.tar.gz
  572. sudo mv wasi-sdk-20.0 wasi-sdk
  573. # It is a temporary solution until new wasi-sdk that includes bug fixes is released
  574. - name: build wasi-libc from source
  575. if: matrix.test_option == '$WASI_TEST_OPTIONS'
  576. run: |
  577. git clone https://github.com/WebAssembly/wasi-libc
  578. cd wasi-libc
  579. 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
  580. echo "SYSROOT_PATH=$PWD/sysroot" >> $GITHUB_ENV
  581. - name: set env variable(if llvm are used)
  582. if: matrix.running_mode == 'aot' || matrix.running_mode == 'jit' || matrix.running_mode == 'multi-tier-jit'
  583. run: echo "USE_LLVM=true" >> $GITHUB_ENV
  584. - name: set env variable(if x86_32 test needed)
  585. if: >
  586. (matrix.test_option == '$DEFAULT_TEST_OPTIONS' || matrix.test_option == '$THREADS_TEST_OPTIONS'
  587. || matrix.test_option == '$WASI_TEST_OPTIONS')
  588. && matrix.running_mode != 'fast-jit' && matrix.running_mode != 'jit' && matrix.running_mode != 'multi-tier-jit'
  589. run: echo "TEST_ON_X86_32=true" >> $GITHUB_ENV
  590. - name: set additional tsan options
  591. run: echo "TSAN_OPTIONS=suppressions=$PWD/tsan_suppressions.txt" >> $GITHUB_ENV
  592. working-directory: tests/wamr-test-suites
  593. #only download llvm libraries in jit and aot mode
  594. - name: Get LLVM libraries
  595. if: env.USE_LLVM == 'true'
  596. id: retrieve_llvm_libs
  597. uses: actions/cache@v3
  598. with:
  599. path: |
  600. ./core/deps/llvm/build/bin
  601. ./core/deps/llvm/build/include
  602. ./core/deps/llvm/build/lib
  603. ./core/deps/llvm/build/libexec
  604. ./core/deps/llvm/build/share
  605. key: ${{ matrix.llvm_cache_key }}
  606. - name: Quit if cache miss
  607. if: env.USE_LLVM == 'true' && steps.retrieve_llvm_libs.outputs.cache-hit != 'true'
  608. run: echo "::error::can not get prebuilt llvm libraries" && exit 1
  609. - name: install jq JSON processor
  610. if: matrix.running_mode == 'aot' && matrix.test_option == '$WASI_TEST_OPTIONS'
  611. run: sudo apt-get update && sudo apt install -y jq
  612. - name: Build WASI thread tests
  613. if: matrix.test_option == '$WASI_TEST_OPTIONS'
  614. run: bash build.sh --sysroot "$SYSROOT_PATH"
  615. working-directory: ./core/iwasm/libraries/lib-wasi-threads/test/
  616. - name: Build WASI thread stress tests
  617. if: matrix.test_option == '$WASI_TEST_OPTIONS'
  618. run: bash build.sh --sysroot "$SYSROOT_PATH"
  619. working-directory: ./core/iwasm/libraries/lib-wasi-threads/stress-test/
  620. - name: build socket api tests
  621. if: matrix.test_option == '$WASI_TEST_OPTIONS'
  622. run: bash build.sh
  623. working-directory: ./core/iwasm/libraries/lib-socket/test/
  624. - name: run tests
  625. timeout-minutes: 40
  626. run: ./test_wamr.sh ${{ matrix.test_option }} -t ${{ matrix.running_mode }} -T "${{ matrix.sanitizer }}"
  627. working-directory: ./tests/wamr-test-suites
  628. #only install x32 support libraries when to run x86_32 cases
  629. - name: install x32 support libraries
  630. if: env.TEST_ON_X86_32 == 'true'
  631. run:
  632. # Add another apt repository as some packages cannot
  633. # be downloaded with the github default repository
  634. sudo curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/apt/trusted.gpg.d/microsoft.asc &&
  635. sudo apt-add-repository https://packages.microsoft.com/ubuntu/${{ matrix.ubuntu_version }}/prod &&
  636. sudo apt-get update &&
  637. sudo apt install -y g++-multilib lib32gcc-9-dev
  638. - name: run tests x86_32
  639. timeout-minutes: 40
  640. if: env.TEST_ON_X86_32 == 'true'
  641. run: ./test_wamr.sh ${{ env.X86_32_TARGET_TEST_OPTIONS }} ${{ matrix.test_option }} -t ${{ matrix.running_mode }}
  642. working-directory: ./tests/wamr-test-suites