# Copyright (C) 2019 Intel Corporation. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception name: Linux # Controls when the action will run. Triggers the workflow on push or pull request # events but only for the main branch on: # triggers on every branch push: paths-ignore: - 'doc/**' # triggers on every PR pull_request: paths-ignore: - 'doc/**' jobs: build_llvm_libraries: runs-on: ${{ matrix.os }} strategy: matrix: os: [ubuntu-18.04, ubuntu-20.04] steps: - name: checkout uses: actions/checkout@v2 - name: Cache LLVM libraries id: cache_llvm uses: actions/cache@v2 env: cache-name: llvm_libraries with: path: ./core/deps/llvm/build/LLVM-13.0.0-Linux.tar.gz key: ${{ matrix.os }}-build-${{env.cache-name}} restore-keys: ${{ matrix.os }}-build-${{env.cache-name}} - name: Build llvm and clang from source id: build_llvm if: steps.cache_llvm.outputs.cache-hit != 'true' run: | cd wamr-compiler ./build_llvm.sh cd ../core/deps/llvm/build/ make package build_wamrc: needs: build_llvm_libraries runs-on: ${{ matrix.os }} strategy: matrix: os: [ubuntu-18.04, ubuntu-20.04] steps: - name: checkout uses: actions/checkout@v2 - name: Get LLVM libraries id: cache_llvm uses: actions/cache@v2 env: cache-name: llvm_libraries with: path: ./core/deps/llvm/build/LLVM-13.0.0-Linux.tar.gz key: ${{ matrix.os }}-build-${{env.cache-name}} restore-keys: ${{ matrix.os }}-build-${{env.cache-name}} - name: Quit if cache miss if: steps.cache_llvm.outputs.cache-hit != 'true' run: exit 1 - name: Extract the LLVM package run: tar xf LLVM-13.0.0-Linux.tar.gz --strip-components=1 working-directory: ./core/deps/llvm/build - name: Build wamrc run: | mkdir build && cd build cmake .. && make -j $(nproc) working-directory: wamr-compiler - name: Upload Wamrc uses: actions/upload-artifact@v2 with: name: wamrc_bin-${{ matrix.os }} path: ./wamr-compiler/build/wamrc retention-days: 1 build_iwasm: needs: build_llvm_libraries runs-on: ${{ matrix.os }} strategy: matrix: make_options: [ # Running mode "-DWAMR_BUILD_INERP=1 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_AOT=0 -DWAMR_BUILD_FAST_INTERP=1", "-DWAMR_BUILD_INERP=1 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_AOT=0 -DWAMR_BUILD_FAST_INTERP=0", "-DWAMR_BUILD_INERP=0 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_AOT=0", "-DWAMR_BUILD_INERP=0 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_AOT=1", # Features "-DWAMR_BUILD_CUSTOM_NAME_SECTION=1", "-DWAMR_BUILD_LIB_PTHREAD=1", "-DWAMR_BUILD_MEMORY_PROFILING=1", "-DWAMR_BUILD_MULTI_MODULE=1", "-DWAMR_BUILD_REF_TYPES=1", "-DWAMR_BUILD_SIMD=1", "-DWAMR_BUILD_TAIL_CALL=1", "-DWAMR_DISABLE_HW_BOUND_CHECK=1", ] os: [ubuntu-18.04, ubuntu-20.04] platform: [linux, android] steps: - name: checkout uses: actions/checkout@v2 - name: Get LLVM libraries id: cache_llvm uses: actions/cache@v2 env: cache-name: llvm_libraries with: path: ./core/deps/llvm/build/LLVM-13.0.0-Linux.tar.gz key: ${{ matrix.os }}-build-${{env.cache-name}} restore-keys: ${{ matrix.os }}-build-${{env.cache-name}} - name: Quit if cache miss if: steps.cache_llvm.outputs.cache-hit != 'true' run: exit 1 - name: Extract the LLVM package run: tar xf LLVM-13.0.0-Linux.tar.gz --strip-components=1 working-directory: ./core/deps/llvm/build - name: Build iwasm run: | mkdir build && cd build cmake .. ${{ matrix.make_options }} && make -j $(nproc) cd .. && rm -rf build working-directory: product-mini/platforms/${{ matrix.platform }} build_samples: needs: [build_llvm_libraries, build_wamrc] runs-on: ${{ matrix.os }} strategy: matrix: os: [ubuntu-18.04, ubuntu-20.04] make_options: [ # Running mode "-DWAMR_BUILD_INERP=1 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_AOT=0 -DWAMR_BUILD_FAST_INTERP=1", "-DWAMR_BUILD_INERP=1 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_AOT=0 -DWAMR_BUILD_FAST_INTERP=0", "-DWAMR_BUILD_INERP=0 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_AOT=0", "-DWAMR_BUILD_INERP=0 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_AOT=1", ] steps: - name: checkout uses: actions/checkout@v2 - name: Get LLVM libraries id: cache_llvm uses: actions/cache@v2 env: cache-name: llvm_libraries with: path: ./core/deps/llvm/build/LLVM-13.0.0-Linux.tar.gz key: ${{ matrix.os }}-build-${{env.cache-name}} restore-keys: ${{ matrix.os }}-build-${{env.cache-name}} - name: Quit if cache miss if: steps.cache_llvm.outputs.cache-hit != 'true' run: exit 1 - name: Extract the LLVM package run: tar xf LLVM-13.0.0-Linux.tar.gz --strip-components=1 working-directory: ./core/deps/llvm/build - name: Download Wamrc uses: actions/download-artifact@v2 with: name: wamrc_bin-${{ matrix.os }} path: ./wamr-compiler/build - name: Give execution rights run: chmod a+x ./wamr-compiler/build/wamrc - name: download and install wasi-sdk run: | cd /opt wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-linux.tar.gz tar -xzf wasi-sdk-12.0-linux.tar.gz mv wasi-sdk-12.0 wasi-sdk rm wasi-sdk-12.0-linux.tar.gz - name: download and install wabt run: | cd /opt wget https://github.com/WebAssembly/wabt/releases/download/1.0.23/wabt-1.0.23-ubuntu.tar.gz tar -xzf wabt-1.0.23-ubuntu.tar.gz mv wabt-1.0.23 wabt rm wabt-1.0.23-ubuntu.tar.gz - name: Build Sample [wasm-c-api] run: | cd samples/wasm-c-api mkdir build && cd build cmake .. ${{ matrix.make_options }} make -j $(nproc) ./callback ./callback_chain ./global ./hello ./hostref ./memory ./reflect ./table ./trap cd .. && rm -r build - name: Build Sample [basic] run: | cd samples/basic ./build.sh ./run.sh - name: Build Sample [multi-thread] run: | cd samples/multi-thread mkdir build && cd build cmake .. make -j $(nproc) ./iwasm wasm-apps/test.wasm - name: Build Sample [multi-module] run: | cd samples/multi-module mkdir build && cd build cmake .. make -j $(nproc) ./multi_module - name: Build Sample [spawn-thread] run: | cd samples/spawn-thread mkdir build && cd build cmake .. make -j $(nproc) ./spawn_thread - name: Build Sample [ref-types] run: | cd samples/ref-types mkdir build && cd build cmake .. make -j $(nproc) ./hello