compilation_on_android_ubuntu.yml 25 KB

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