nightly_run.yml 31 KB

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