linux.yml 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. # Copyright (C) 2019 Intel Corporation. All rights reserved.
  2. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  3. name: Linux
  4. # Controls when the action will run. Triggers the workflow on push or pull request
  5. # events but only for the main branch
  6. on:
  7. # triggers on every branch
  8. push:
  9. paths-ignore:
  10. - 'doc/**'
  11. # triggers on every PR
  12. pull_request:
  13. paths-ignore:
  14. - 'doc/**'
  15. jobs:
  16. build_llvm_libraries:
  17. runs-on: ${{ matrix.os }}
  18. strategy:
  19. matrix:
  20. os: [ubuntu-18.04, ubuntu-20.04]
  21. steps:
  22. - name: checkout
  23. uses: actions/checkout@v2
  24. - name: Cache LLVM libraries
  25. id: cache_llvm
  26. uses: actions/cache@v2
  27. env:
  28. cache-name: llvm_libraries
  29. with:
  30. path: ./core/deps/llvm/build/LLVM-13.0.0-Linux.tar.gz
  31. key: ${{ matrix.os }}-build-${{env.cache-name}}
  32. restore-keys: ${{ matrix.os }}-build-${{env.cache-name}}
  33. - name: Build llvm and clang from source
  34. id: build_llvm
  35. if: steps.cache_llvm.outputs.cache-hit != 'true'
  36. run: |
  37. cd wamr-compiler
  38. ./build_llvm.sh
  39. cd ../core/deps/llvm/build/
  40. make package
  41. build_wamrc:
  42. needs: build_llvm_libraries
  43. runs-on: ${{ matrix.os }}
  44. strategy:
  45. matrix:
  46. os: [ubuntu-18.04, ubuntu-20.04]
  47. steps:
  48. - name: checkout
  49. uses: actions/checkout@v2
  50. - name: Get LLVM libraries
  51. id: cache_llvm
  52. uses: actions/cache@v2
  53. env:
  54. cache-name: llvm_libraries
  55. with:
  56. path: ./core/deps/llvm/build/LLVM-13.0.0-Linux.tar.gz
  57. key: ${{ matrix.os }}-build-${{env.cache-name}}
  58. restore-keys: ${{ matrix.os }}-build-${{env.cache-name}}
  59. - name: Quit if cache miss
  60. if: steps.cache_llvm.outputs.cache-hit != 'true'
  61. run: exit 1
  62. - name: Extract the LLVM package
  63. run: tar xf LLVM-13.0.0-Linux.tar.gz --strip-components=1
  64. working-directory: ./core/deps/llvm/build
  65. - name: Build wamrc
  66. run: |
  67. mkdir build && cd build
  68. cmake .. && make -j $(nproc)
  69. working-directory: wamr-compiler
  70. - name: Upload Wamrc
  71. uses: actions/upload-artifact@v2
  72. with:
  73. name: wamrc_bin-${{ matrix.os }}
  74. path: ./wamr-compiler/build/wamrc
  75. retention-days: 1
  76. build_iwasm:
  77. needs: build_llvm_libraries
  78. runs-on: ${{ matrix.os }}
  79. strategy:
  80. matrix:
  81. make_options: [
  82. # Running mode
  83. "-DWAMR_BUILD_INERP=1 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_AOT=0 -DWAMR_BUILD_FAST_INTERP=1",
  84. "-DWAMR_BUILD_INERP=1 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_AOT=0 -DWAMR_BUILD_FAST_INTERP=0",
  85. "-DWAMR_BUILD_INERP=0 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_AOT=0",
  86. "-DWAMR_BUILD_INERP=0 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_AOT=1",
  87. # Features
  88. "-DWAMR_BUILD_CUSTOM_NAME_SECTION=1",
  89. "-DWAMR_BUILD_LIB_PTHREAD=1",
  90. "-DWAMR_BUILD_MEMORY_PROFILING=1",
  91. "-DWAMR_BUILD_MULTI_MODULE=1",
  92. "-DWAMR_BUILD_REF_TYPES=1",
  93. "-DWAMR_BUILD_SIMD=1",
  94. "-DWAMR_BUILD_TAIL_CALL=1",
  95. "-DWAMR_DISABLE_HW_BOUND_CHECK=1",
  96. ]
  97. os: [ubuntu-18.04, ubuntu-20.04]
  98. platform: [linux, android]
  99. steps:
  100. - name: checkout
  101. uses: actions/checkout@v2
  102. - name: Get LLVM libraries
  103. id: cache_llvm
  104. uses: actions/cache@v2
  105. env:
  106. cache-name: llvm_libraries
  107. with:
  108. path: ./core/deps/llvm/build/LLVM-13.0.0-Linux.tar.gz
  109. key: ${{ matrix.os }}-build-${{env.cache-name}}
  110. restore-keys: ${{ matrix.os }}-build-${{env.cache-name}}
  111. - name: Quit if cache miss
  112. if: steps.cache_llvm.outputs.cache-hit != 'true'
  113. run: exit 1
  114. - name: Extract the LLVM package
  115. run: tar xf LLVM-13.0.0-Linux.tar.gz --strip-components=1
  116. working-directory: ./core/deps/llvm/build
  117. - name: Build iwasm
  118. run: |
  119. mkdir build && cd build
  120. cmake .. ${{ matrix.make_options }} && make -j $(nproc)
  121. cd .. && rm -rf build
  122. working-directory: product-mini/platforms/${{ matrix.platform }}
  123. build_samples:
  124. needs: [build_llvm_libraries, build_wamrc]
  125. runs-on: ${{ matrix.os }}
  126. strategy:
  127. matrix:
  128. os: [ubuntu-18.04, ubuntu-20.04]
  129. make_options: [
  130. # Running mode
  131. "-DWAMR_BUILD_INERP=1 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_AOT=0 -DWAMR_BUILD_FAST_INTERP=1",
  132. "-DWAMR_BUILD_INERP=1 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_AOT=0 -DWAMR_BUILD_FAST_INTERP=0",
  133. "-DWAMR_BUILD_INERP=0 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_AOT=0",
  134. "-DWAMR_BUILD_INERP=0 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_AOT=1",
  135. ]
  136. steps:
  137. - name: checkout
  138. uses: actions/checkout@v2
  139. - name: Get LLVM libraries
  140. id: cache_llvm
  141. uses: actions/cache@v2
  142. env:
  143. cache-name: llvm_libraries
  144. with:
  145. path: ./core/deps/llvm/build/LLVM-13.0.0-Linux.tar.gz
  146. key: ${{ matrix.os }}-build-${{env.cache-name}}
  147. restore-keys: ${{ matrix.os }}-build-${{env.cache-name}}
  148. - name: Quit if cache miss
  149. if: steps.cache_llvm.outputs.cache-hit != 'true'
  150. run: exit 1
  151. - name: Extract the LLVM package
  152. run: tar xf LLVM-13.0.0-Linux.tar.gz --strip-components=1
  153. working-directory: ./core/deps/llvm/build
  154. - name: Download Wamrc
  155. uses: actions/download-artifact@v2
  156. with:
  157. name: wamrc_bin-${{ matrix.os }}
  158. path: ./wamr-compiler/build
  159. - name: Give execution rights
  160. run: chmod a+x ./wamr-compiler/build/wamrc
  161. - name: download and install wasi-sdk
  162. run: |
  163. cd /opt
  164. wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-linux.tar.gz
  165. tar -xzf wasi-sdk-12.0-linux.tar.gz
  166. mv wasi-sdk-12.0 wasi-sdk
  167. rm wasi-sdk-12.0-linux.tar.gz
  168. - name: download and install wabt
  169. run: |
  170. cd /opt
  171. wget https://github.com/WebAssembly/wabt/releases/download/1.0.23/wabt-1.0.23-ubuntu.tar.gz
  172. tar -xzf wabt-1.0.23-ubuntu.tar.gz
  173. mv wabt-1.0.23 wabt
  174. rm wabt-1.0.23-ubuntu.tar.gz
  175. - name: Build Sample [wasm-c-api]
  176. run: |
  177. cd samples/wasm-c-api
  178. mkdir build && cd build
  179. cmake .. ${{ matrix.make_options }}
  180. make -j $(nproc)
  181. ./callback
  182. ./callback_chain
  183. ./global
  184. ./hello
  185. ./hostref
  186. ./memory
  187. ./reflect
  188. ./table
  189. ./trap
  190. cd .. && rm -r build
  191. - name: Build Sample [basic]
  192. run: |
  193. cd samples/basic
  194. ./build.sh
  195. ./run.sh
  196. - name: Build Sample [multi-thread]
  197. run: |
  198. cd samples/multi-thread
  199. mkdir build && cd build
  200. cmake ..
  201. make -j $(nproc)
  202. ./iwasm wasm-apps/test.wasm
  203. - name: Build Sample [multi-module]
  204. run: |
  205. cd samples/multi-module
  206. mkdir build && cd build
  207. cmake ..
  208. make -j $(nproc)
  209. ./multi_module
  210. - name: Build Sample [spawn-thread]
  211. run: |
  212. cd samples/spawn-thread
  213. mkdir build && cd build
  214. cmake ..
  215. make -j $(nproc)
  216. ./spawn_thread
  217. - name: Build Sample [ref-types]
  218. run: |
  219. cd samples/ref-types
  220. mkdir build && cd build
  221. cmake ..
  222. make -j $(nproc)
  223. ./hello