nightly_run.yml 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627
  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. paths:
  11. - ".github/workflows/nightly_run.yml"
  12. # midnight UTC
  13. schedule:
  14. - cron: "0 0 * * *"
  15. # allow to be triggered manually
  16. workflow_dispatch:
  17. # Cancel any in-flight jobs for the same PR/branch so there's only one active
  18. # at a time
  19. concurrency:
  20. group: ${{ github.workflow }}-${{ github.ref }}
  21. cancel-in-progress: true
  22. env:
  23. # For BUILD
  24. 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"
  25. 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"
  26. 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"
  27. 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"
  28. 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"
  29. 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"
  30. 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"
  31. # For Spec Test
  32. DEFAULT_TEST_OPTIONS: "-s spec -b -P"
  33. MULTI_MODULES_TEST_OPTIONS: "-s spec -b -M -P"
  34. SIMD_TEST_OPTIONS: "-s spec -b -S -P"
  35. THREADS_TEST_OPTIONS: "-s spec -b -p -P"
  36. X86_32_TARGET_TEST_OPTIONS: "-m x86_32 -P"
  37. WASI_TEST_OPTIONS: "-s wasi_certification -w"
  38. jobs:
  39. build_llvm_libraries_on_ubuntu_2004:
  40. uses: ./.github/workflows/build_llvm_libraries.yml
  41. with:
  42. os: "ubuntu-20.04"
  43. arch: "X86"
  44. build_wamrc:
  45. needs:
  46. [build_llvm_libraries_on_ubuntu_2004]
  47. runs-on: ${{ matrix.os }}
  48. strategy:
  49. matrix:
  50. include:
  51. - os: ubuntu-20.04
  52. llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2004.outputs.cache_key }}
  53. steps:
  54. - name: checkout
  55. uses: actions/checkout@v3
  56. # since jobs.id can't contain the dot character
  57. # it is hard to use `format` to assemble the cache key
  58. - name: Get LLVM libraries
  59. id: retrieve_llvm_libs
  60. uses: actions/cache@v3
  61. with:
  62. path: |
  63. ./core/deps/llvm/build/bin
  64. ./core/deps/llvm/build/include
  65. ./core/deps/llvm/build/lib
  66. ./core/deps/llvm/build/libexec
  67. ./core/deps/llvm/build/share
  68. key: ${{ matrix.llvm_cache_key }}
  69. - name: Quit if cache miss
  70. if: steps.retrieve_llvm_libs.outputs.cache-hit != 'true'
  71. run: echo "::error::can not get prebuilt llvm libraries" && exit 1
  72. - name: Build wamrc
  73. run: |
  74. mkdir build && cd build
  75. cmake ..
  76. cmake --build . --config Release --parallel 4
  77. working-directory: wamr-compiler
  78. build_iwasm:
  79. needs:
  80. [build_llvm_libraries_on_ubuntu_2004]
  81. runs-on: ${{ matrix.os }}
  82. strategy:
  83. matrix:
  84. make_options_run_mode: [
  85. # Running mode
  86. $AOT_BUILD_OPTIONS,
  87. $CLASSIC_INTERP_BUILD_OPTIONS,
  88. $FAST_INTERP_BUILD_OPTIONS,
  89. $FAST_JIT_BUILD_OPTIONS,
  90. $LLVM_LAZY_JIT_BUILD_OPTIONS,
  91. $LLVM_EAGER_JIT_BUILD_OPTIONS,
  92. $MULTI_TIER_JIT_BUILD_OPTIONS,
  93. ]
  94. make_options_feature: [
  95. # Features
  96. "-DWAMR_BUILD_CUSTOM_NAME_SECTION=1",
  97. "-DWAMR_BUILD_DEBUG_AOT=1",
  98. "-DWAMR_BUILD_DEBUG_INTERP=1",
  99. "-DWAMR_BUILD_DUMP_CALL_STACK=1",
  100. "-DWAMR_BUILD_LIB_PTHREAD=1",
  101. "-DWAMR_BUILD_LIB_WASI_THREADS=1",
  102. "-DWAMR_BUILD_LOAD_CUSTOM_SECTION=1",
  103. "-DWAMR_BUILD_MINI_LOADER=1",
  104. "-DWAMR_BUILD_MEMORY_PROFILING=1",
  105. "-DWAMR_BUILD_MULTI_MODULE=1",
  106. "-DWAMR_BUILD_PERF_PROFILING=1",
  107. "-DWAMR_BUILD_REF_TYPES=1",
  108. "-DWAMR_BUILD_SIMD=1",
  109. "-DWAMR_BUILD_TAIL_CALL=1",
  110. "-DWAMR_DISABLE_HW_BOUND_CHECK=1",
  111. ]
  112. os: [ubuntu-20.04]
  113. platform: [android, linux]
  114. exclude:
  115. # uncompatiable feature and platform
  116. # uncompatiable mode and feature
  117. # MULTI_MODULE only on INTERP mode
  118. - make_options_run_mode: $AOT_BUILD_OPTIONS
  119. make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
  120. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  121. make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
  122. - make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
  123. make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
  124. - make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
  125. make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
  126. - make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
  127. make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
  128. # SIMD only on JIT/AOT mode
  129. - make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS
  130. make_options_feature: "-DWAMR_BUILD_SIMD=1"
  131. - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
  132. make_options_feature: "-DWAMR_BUILD_SIMD=1"
  133. # DEBUG_INTERP only on CLASSIC INTERP mode
  134. - make_options_run_mode: $AOT_BUILD_OPTIONS
  135. make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
  136. - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
  137. make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
  138. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  139. make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
  140. - make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
  141. make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
  142. - make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
  143. make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
  144. - make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
  145. make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
  146. # DEBUG_AOT only on JIT/AOT mode
  147. - make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS
  148. make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
  149. - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
  150. make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
  151. # TODO: DEBUG_AOT on JIT
  152. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  153. make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
  154. - make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
  155. make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
  156. - make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
  157. make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
  158. - make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
  159. make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
  160. # MINI_LOADER only on INTERP mode
  161. - make_options_run_mode: $AOT_BUILD_OPTIONS
  162. make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
  163. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  164. make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
  165. - make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
  166. make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
  167. - make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
  168. make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
  169. - make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
  170. make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
  171. # Fast-JIT and Multi-Tier-JIT mode don't support android(X86-32)
  172. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  173. platform: android
  174. - make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
  175. platform: android
  176. include:
  177. - os: ubuntu-20.04
  178. llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2004.outputs.cache_key }}
  179. steps:
  180. - name: checkout
  181. uses: actions/checkout@v3
  182. # only download llvm cache when needed
  183. - name: Get LLVM libraries
  184. id: retrieve_llvm_libs
  185. if: endsWith(matrix.make_options_run_mode, '_JIT_BUILD_OPTIONS')
  186. uses: actions/cache@v3
  187. with:
  188. path: |
  189. ./core/deps/llvm/build/bin
  190. ./core/deps/llvm/build/include
  191. ./core/deps/llvm/build/lib
  192. ./core/deps/llvm/build/libexec
  193. ./core/deps/llvm/build/share
  194. key: ${{ matrix.llvm_cache_key }}
  195. - name: Quit if cache miss
  196. if: endsWith(matrix.make_options_run_mode, '_JIT_BUILD_OPTIONS') && (steps.retrieve_llvm_libs.outputs.cache-hit != 'true')
  197. run: echo "::error::can not get prebuilt llvm libraries" && exit 1
  198. - name: Build iwasm
  199. run: |
  200. mkdir build && cd build
  201. cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }}
  202. cmake --build . --config Release --parallel 4
  203. working-directory: product-mini/platforms/${{ matrix.platform }}
  204. build_iwasm_linux_gcc4_8:
  205. runs-on: ubuntu-latest
  206. container:
  207. image: ubuntu:14.04
  208. strategy:
  209. matrix:
  210. make_options_run_mode: [
  211. # Running mode
  212. $CLASSIC_INTERP_BUILD_OPTIONS,
  213. $FAST_INTERP_BUILD_OPTIONS,
  214. $FAST_JIT_BUILD_OPTIONS,
  215. ]
  216. make_options_feature: [
  217. # Features
  218. "-DWAMR_BUILD_CUSTOM_NAME_SECTION=1",
  219. "-DWAMR_BUILD_DEBUG_AOT=1",
  220. "-DWAMR_BUILD_DEBUG_INTERP=1",
  221. "-DWAMR_BUILD_DUMP_CALL_STACK=1",
  222. "-DWAMR_BUILD_LIB_PTHREAD=1",
  223. "-DWAMR_BUILD_LIB_WASI_THREADS=1",
  224. "-DWAMR_BUILD_LOAD_CUSTOM_SECTION=1",
  225. "-DWAMR_BUILD_MINI_LOADER=1",
  226. "-DWAMR_BUILD_MEMORY_PROFILING=1",
  227. "-DWAMR_BUILD_MULTI_MODULE=1",
  228. "-DWAMR_BUILD_PERF_PROFILING=1",
  229. "-DWAMR_BUILD_REF_TYPES=1",
  230. "-DWAMR_BUILD_SIMD=1",
  231. "-DWAMR_BUILD_TAIL_CALL=1",
  232. "-DWAMR_DISABLE_HW_BOUND_CHECK=1",
  233. ]
  234. exclude:
  235. # uncompatiable feature and platform
  236. # uncompatiable mode and feature
  237. # MULTI_MODULE only on INTERP mode
  238. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  239. make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
  240. # SIMD only on JIT/AOT mode
  241. - make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS
  242. make_options_feature: "-DWAMR_BUILD_SIMD=1"
  243. - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
  244. make_options_feature: "-DWAMR_BUILD_SIMD=1"
  245. # DEBUG_INTERP only on CLASSIC INTERP mode
  246. - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
  247. make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
  248. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  249. make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
  250. # DEBUG_AOT only on JIT/AOT mode
  251. - make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS
  252. make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
  253. - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
  254. make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
  255. # TODO: DEBUG_AOT on JIT
  256. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  257. make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
  258. # MINI_LOADER only on INTERP mode
  259. - make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
  260. make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
  261. steps:
  262. - name: checkout
  263. uses: actions/checkout@v3
  264. - name: Install dependencies
  265. uses: nick-fields/retry@v2
  266. with:
  267. timeout_minutes: 10
  268. max_attempts: 3
  269. command: apt update && apt install -y make g++-4.8 gcc-4.8 wget git
  270. on_retry_command: sudo rm -r /var/lib/apt/lists/*
  271. - name: Install cmake
  272. run: |
  273. wget https://github.com/Kitware/CMake/releases/download/v3.26.1/cmake-3.26.1-linux-x86_64.tar.gz -O cmake.tar.gz
  274. tar xzf cmake.tar.gz
  275. cp cmake-3.26.1-linux-x86_64/bin/cmake /usr/local/bin
  276. cp -r cmake-3.26.1-linux-x86_64/share/cmake-3.26/ /usr/local/share/
  277. - name: Build iwasm
  278. run: |
  279. mkdir build && cd build
  280. cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }} -DCMAKE_C_COMPILER=gcc-4.8 -DCMAKE_CXX_COMPILER=g++-4.8
  281. cmake --build . --config Release --parallel 4
  282. working-directory: product-mini/platforms/linux
  283. build_samples_wasm_c_api:
  284. needs:
  285. [
  286. build_iwasm,
  287. build_llvm_libraries_on_ubuntu_2004,
  288. build_wamrc,
  289. ]
  290. runs-on: ${{ matrix.os }}
  291. strategy:
  292. fail-fast: false
  293. matrix:
  294. sanitizer: ["", "ubsan", "asan"]
  295. make_options: [
  296. # Running mode
  297. $AOT_BUILD_OPTIONS,
  298. $CLASSIC_INTERP_BUILD_OPTIONS,
  299. $FAST_INTERP_BUILD_OPTIONS,
  300. $FAST_JIT_BUILD_OPTIONS,
  301. $LLVM_LAZY_JIT_BUILD_OPTIONS,
  302. $LLVM_EAGER_JIT_BUILD_OPTIONS,
  303. $MULTI_TIER_JIT_BUILD_OPTIONS,
  304. ]
  305. os: [ubuntu-20.04]
  306. wasi_sdk_release:
  307. [
  308. "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz",
  309. ]
  310. wabt_release:
  311. [
  312. "https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-ubuntu.tar.gz",
  313. ]
  314. include:
  315. - os: ubuntu-20.04
  316. llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2004.outputs.cache_key }}
  317. exclude:
  318. - make_options: $MULTI_TIER_JIT_BUILD_OPTIONS
  319. sanitizer: asan
  320. steps:
  321. - name: checkout
  322. uses: actions/checkout@v3
  323. - name: Get LLVM libraries
  324. id: retrieve_llvm_libs
  325. if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS'))
  326. uses: actions/cache@v3
  327. with:
  328. path: |
  329. ./core/deps/llvm/build/bin
  330. ./core/deps/llvm/build/include
  331. ./core/deps/llvm/build/lib
  332. ./core/deps/llvm/build/libexec
  333. ./core/deps/llvm/build/share
  334. key: ${{ matrix.llvm_cache_key }}
  335. - name: Quit if cache miss
  336. if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS')) && (steps.retrieve_llvm_libs.outputs.cache-hit != 'true')
  337. run: echo "::error::can not get prebuilt llvm libraries" && exit 1
  338. - name: download and install wabt
  339. run: |
  340. cd /opt
  341. sudo wget ${{ matrix.wabt_release }}
  342. sudo tar -xzf wabt-1.0.31-*.tar.gz
  343. sudo mv wabt-1.0.31 wabt
  344. - name: Build wamrc
  345. if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS'))
  346. run: |
  347. mkdir build && cd build
  348. cmake -D WAMR_BUILD_SANITIZER="${{matrix.sanitizer}}" ..
  349. cmake --build . --config Release --parallel 4
  350. working-directory: wamr-compiler
  351. - name: Build Sample [wasm-c-api]
  352. run: |
  353. VERBOSE=1
  354. cmake -S . -B build ${{ matrix.make_options }} -D WAMR_BUILD_SANITIZER="${{matrix.sanitizer}}"
  355. cmake --build build --config Release --parallel 4
  356. ctest --test-dir build --output-on-failure
  357. working-directory: samples/wasm-c-api
  358. build_samples_others:
  359. needs: [build_iwasm]
  360. runs-on: ${{ matrix.os }}
  361. strategy:
  362. matrix:
  363. os: [ubuntu-20.04]
  364. wasi_sdk_release:
  365. [
  366. "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz",
  367. ]
  368. wabt_release:
  369. [
  370. "https://github.com/WebAssembly/wabt/releases/download/1.0.31/wabt-1.0.31-ubuntu.tar.gz",
  371. ]
  372. steps:
  373. - name: checkout
  374. uses: actions/checkout@v3
  375. - name: download and install wasi-sdk
  376. run: |
  377. cd /opt
  378. sudo wget ${{ matrix.wasi_sdk_release }}
  379. sudo tar -xzf wasi-sdk-*.tar.gz
  380. sudo mv wasi-sdk-20.0 wasi-sdk
  381. - name: download and install wabt
  382. run: |
  383. cd /opt
  384. sudo wget ${{ matrix.wabt_release }}
  385. sudo tar -xzf wabt-1.0.31-*.tar.gz
  386. sudo mv wabt-1.0.31 wabt
  387. - name: Build Sample [basic]
  388. run: |
  389. cd samples/basic
  390. ./build.sh
  391. ./run.sh
  392. - name: Build Sample [file]
  393. run: |
  394. cd samples/file
  395. mkdir build && cd build
  396. cmake ..
  397. cmake --build . --config Release --parallel 4
  398. ./src/iwasm -f wasm-app/file.wasm -d .
  399. - name: Build Sample [multi-thread]
  400. run: |
  401. cd samples/multi-thread
  402. mkdir build && cd build
  403. cmake ..
  404. cmake --build . --config Release --parallel 4
  405. ./iwasm wasm-apps/test.wasm
  406. - name: Build Sample [multi-module]
  407. run: |
  408. cd samples/multi-module
  409. mkdir build && cd build
  410. cmake ..
  411. cmake --build . --config Release --parallel 4
  412. ./multi_module
  413. - name: Build Sample [spawn-thread]
  414. run: |
  415. cd samples/spawn-thread
  416. mkdir build && cd build
  417. cmake ..
  418. cmake --build . --config Release --parallel 4
  419. ./spawn_thread
  420. - name: Build Sample [ref-types]
  421. run: |
  422. cd samples/ref-types
  423. mkdir build && cd build
  424. cmake ..
  425. cmake --build . --config Release --parallel 4
  426. ./hello
  427. - name: Build Sample [simple]
  428. run: |
  429. ./build.sh -p host-interp
  430. python3 ./sample_test_run.py $(pwd)/out
  431. exit $?
  432. working-directory: ./samples/simple
  433. - name: Build Sample [wasi-threads]
  434. run: |
  435. cd samples/wasi-threads
  436. mkdir build && cd build
  437. cmake ..
  438. cmake --build . --config Release --parallel 4
  439. ./iwasm wasm-apps/no_pthread.wasm
  440. test:
  441. needs:
  442. [
  443. build_iwasm,
  444. build_llvm_libraries_on_ubuntu_2004,
  445. build_wamrc,
  446. ]
  447. runs-on: ${{ matrix.os }}
  448. strategy:
  449. fail-fast: false
  450. matrix:
  451. os: [ubuntu-20.04]
  452. sanitizer: ["", "ubsan", "asan"]
  453. running_mode:
  454. [
  455. "classic-interp",
  456. "fast-interp",
  457. "jit",
  458. "aot",
  459. "fast-jit",
  460. "multi-tier-jit",
  461. ]
  462. test_option:
  463. [
  464. $DEFAULT_TEST_OPTIONS,
  465. $MULTI_MODULES_TEST_OPTIONS,
  466. $SIMD_TEST_OPTIONS,
  467. $THREADS_TEST_OPTIONS,
  468. $WASI_TEST_OPTIONS,
  469. ]
  470. wasi_sdk_release:
  471. [
  472. "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz",
  473. ]
  474. include:
  475. - os: ubuntu-20.04
  476. llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2004.outputs.cache_key }}
  477. ubuntu_version: "20.04"
  478. exclude:
  479. # uncompatiable modes and features
  480. - os: ubuntu-20.04
  481. sanitizer: asan
  482. # asan works only for aot now
  483. - running_mode: "classic-interp"
  484. sanitizer: asan
  485. - running_mode: "fast-interp"
  486. sanitizer: asan
  487. - running_mode: "jit"
  488. sanitizer: asan
  489. - running_mode: "fast-jit"
  490. sanitizer: asan
  491. - running_mode: "multi-tier-jit"
  492. sanitizer: asan
  493. # classic-interp and fast-interp don't support simd
  494. - running_mode: "classic-interp"
  495. test_option: $SIMD_TEST_OPTIONS
  496. - running_mode: "fast-interp"
  497. test_option: $SIMD_TEST_OPTIONS
  498. # aot and jit don't support multi module
  499. - running_mode: "aot"
  500. test_option: $MULTI_MODULES_TEST_OPTIONS
  501. - running_mode: "jit"
  502. test_option: $MULTI_MODULES_TEST_OPTIONS
  503. # fast-jit doesn't support multi module, simd
  504. - running_mode: "fast-jit"
  505. test_option: $MULTI_MODULES_TEST_OPTIONS
  506. - running_mode: "fast-jit"
  507. test_option: $SIMD_TEST_OPTIONS
  508. # multi-tier-jit doesn't support multi module, simd
  509. - running_mode: "multi-tier-jit"
  510. test_option: $MULTI_MODULES_TEST_OPTIONS
  511. - running_mode: "multi-tier-jit"
  512. test_option: $SIMD_TEST_OPTIONS
  513. steps:
  514. - name: checkout
  515. uses: actions/checkout@v3
  516. - name: download and install wasi-sdk
  517. if: matrix.test_option == '$WASI_TEST_OPTIONS'
  518. run: |
  519. cd /opt
  520. sudo wget ${{ matrix.wasi_sdk_release }}
  521. sudo tar -xzf wasi-sdk-*.tar.gz
  522. sudo mv wasi-sdk-20.0 wasi-sdk
  523. # It is a temporary solution until new wasi-sdk that includes bug fixes is released
  524. - name: build wasi-libc from source
  525. if: matrix.test_option == '$WASI_TEST_OPTIONS'
  526. run: |
  527. git clone https://github.com/WebAssembly/wasi-libc
  528. cd wasi-libc
  529. 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
  530. echo "SYSROOT_PATH=$PWD/sysroot" >> $GITHUB_ENV
  531. - name: set env variable(if llvm are used)
  532. if: matrix.running_mode == 'aot' || matrix.running_mode == 'jit' || matrix.running_mode == 'multi-tier-jit'
  533. run: echo "USE_LLVM=true" >> $GITHUB_ENV
  534. - name: set env variable(if x86_32 test needed)
  535. if: >
  536. (matrix.test_option == '$DEFAULT_TEST_OPTIONS' || matrix.test_option == '$THREADS_TEST_OPTIONS'
  537. || matrix.test_option == '$WASI_TEST_OPTIONS')
  538. && matrix.running_mode != 'fast-jit' && matrix.running_mode != 'jit' && matrix.running_mode != 'multi-tier-jit'
  539. run: echo "TEST_ON_X86_32=true" >> $GITHUB_ENV
  540. - name: set sanitizer
  541. run: echo "WAMR_BUILD_SANITIZER=${{ matrix.sanitizer }}" >> $GITHUB_ENV
  542. #only download llvm libraries in jit and aot mode
  543. - name: Get LLVM libraries
  544. if: env.USE_LLVM == 'true'
  545. id: retrieve_llvm_libs
  546. uses: actions/cache@v3
  547. with:
  548. path: |
  549. ./core/deps/llvm/build/bin
  550. ./core/deps/llvm/build/include
  551. ./core/deps/llvm/build/lib
  552. ./core/deps/llvm/build/libexec
  553. ./core/deps/llvm/build/share
  554. key: ${{ matrix.llvm_cache_key }}
  555. - name: Quit if cache miss
  556. if: env.USE_LLVM == 'true' && steps.retrieve_llvm_libs.outputs.cache-hit != 'true'
  557. run: echo "::error::can not get prebuilt llvm libraries" && exit 1
  558. - name: install jq JSON processor
  559. if: matrix.running_mode == 'aot' && matrix.test_option == '$WASI_TEST_OPTIONS'
  560. run: sudo apt-get update && sudo apt install -y jq
  561. - name: Build WASI thread tests
  562. if: matrix.test_option == '$WASI_TEST_OPTIONS'
  563. run: bash build.sh --sysroot "$SYSROOT_PATH"
  564. working-directory: ./core/iwasm/libraries/lib-wasi-threads/test/
  565. - name: build socket api tests
  566. if: matrix.test_option == '$WASI_TEST_OPTIONS'
  567. run: bash build.sh
  568. working-directory: ./core/iwasm/libraries/lib-socket/test/
  569. - name: run tests
  570. timeout-minutes: 40
  571. run: ./test_wamr.sh ${{ matrix.test_option }} -t ${{ matrix.running_mode }}
  572. working-directory: ./tests/wamr-test-suites
  573. #only install x32 support libraries when to run x86_32 cases
  574. - name: install x32 support libraries
  575. if: env.TEST_ON_X86_32 == 'true'
  576. run:
  577. # Add another apt repository as some packages cannot
  578. # be downloaded with the github default repository
  579. sudo curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/apt/trusted.gpg.d/microsoft.asc &&
  580. sudo apt-add-repository https://packages.microsoft.com/ubuntu/${{ matrix.ubuntu_version }}/prod &&
  581. sudo apt-get update &&
  582. sudo apt install -y g++-multilib lib32gcc-9-dev
  583. - name: run tests x86_32
  584. timeout-minutes: 40
  585. if: env.TEST_ON_X86_32 == 'true'
  586. run: ./test_wamr.sh ${{ env.X86_32_TARGET_TEST_OPTIONS }} ${{ matrix.test_option }} -t ${{ matrix.running_mode }}
  587. working-directory: ./tests/wamr-test-suites