compilation_on_android_ubuntu.yml 25 KB

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