compilation_on_android_ubuntu.yml 25 KB

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