nightly_run.yml 31 KB

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