From f975a987bf2c52f1c8679c6176217113d2d3a60f Mon Sep 17 00:00:00 2001 From: "liang.he" Date: Fri, 17 Jun 2022 17:44:20 +0800 Subject: [PATCH] Separate MacOS workflows from the big one (#1236) Separate MacOS workflows from the big one so as to avoid too much tasks And optimize the total duration by reducing getting LLVM libraries times --- .github/workflows/codeing_guildelines.yml | 4 +- ....yml => compilation_on_android_ubuntu.yml} | 256 +++++++----- .github/workflows/compilation_on_macos.yml | 393 ++++++++++++++++++ .github/workflows/compilation_on_sgx.yml | 133 +++--- .github/workflows/compilation_on_windows.yml | 4 +- .github/workflows/spec_test.yml | 155 ------- core/iwasm/compilation/aot_emit_aot_file.c | 6 + 7 files changed, 614 insertions(+), 337 deletions(-) rename .github/workflows/{compilation_on_android_ubuntu_macos.yml => compilation_on_android_ubuntu.yml} (75%) create mode 100644 .github/workflows/compilation_on_macos.yml delete mode 100644 .github/workflows/spec_test.yml diff --git a/.github/workflows/codeing_guildelines.yml b/.github/workflows/codeing_guildelines.yml index de1364f28..f06892631 100644 --- a/.github/workflows/codeing_guildelines.yml +++ b/.github/workflows/codeing_guildelines.yml @@ -21,7 +21,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Cancel Workflow Action - uses: styfle/cancel-workflow-action@0.6.0 + uses: styfle/cancel-workflow-action@0.9.1 with: access_token: ${{ github.token }} @@ -30,7 +30,7 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 diff --git a/.github/workflows/compilation_on_android_ubuntu_macos.yml b/.github/workflows/compilation_on_android_ubuntu.yml similarity index 75% rename from .github/workflows/compilation_on_android_ubuntu_macos.yml rename to .github/workflows/compilation_on_android_ubuntu.yml index becc0881c..5ae14156b 100644 --- a/.github/workflows/compilation_on_android_ubuntu_macos.yml +++ b/.github/workflows/compilation_on_android_ubuntu.yml @@ -1,7 +1,7 @@ # Copyright (C) 2019 Intel Corporation. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -name: compilation on android, ubuntu-18.04, ubuntu-20.04, macos-latest +name: compilation on android, ubuntu-18.04, ubuntu-20.04 on: # will be triggered on PR events @@ -11,7 +11,7 @@ on: - "ci/**" - "doc/**" - "test-tools/**" - - ".github/workflows/compilation_on_android_ubuntu_macos.yml" + - ".github/workflows/compilation_on_android_ubuntu.yml" # will be triggered on push events push: paths-ignore: @@ -19,7 +19,7 @@ on: - "ci/**" - "doc/**" - "test-tools/**" - - ".github/workflows/compilation_on_android_ubuntu_macos.yml" + - ".github/workflows/compilation_on_android_ubuntu.yml" # allow to be triggered manually workflow_dispatch: @@ -30,12 +30,20 @@ concurrency: cancel-in-progress: true env: + # For BUILD AOT_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_LAZY_JIT=0" CLASSIC_INTERP_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=0 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_LAZY_JIT=0" FAST_INTERP_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=0 -DWAMR_BUILD_FAST_INTERP=1 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_LAZY_JIT=0" LAZY_JIT_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LAZY_JIT=1" MC_JIT_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LAZY_JIT=0" + # LLVM LLVM_CACHE_SUFFIX: "build-llvm_libraries_ex" + # For Spec Test + DEFAULT_TEST_OPTIONS: "-s spec -P" + MULTI_MODULES_TEST_OPTIONS: "-s spec -M -P" + SIMD_TEST_OPTIONS: "-s spec -S -P" + THREADS_TEST_OPTIONS: "-s spec -p -P" + X86_32_TARGET_TEST_OPTIONS: "-m x86_32 -P" jobs: # Cancel any in-flight jobs for the same PR/branch so there's only one active @@ -44,25 +52,25 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-18.04, ubuntu-20.04, macos-latest] + os: [ubuntu-18.04, ubuntu-20.04] steps: - name: Cancel Workflow Action - uses: styfle/cancel-workflow-action@0.6.0 + uses: styfle/cancel-workflow-action@0.9.1 with: access_token: ${{ github.token }} # set different traffic lights based on the current repo and the running OS. # according to light colors, the workflow will run different jobs + # it is used to separate between the public repo and the private repo check_repo: needs: cancel_previous runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-18.04, ubuntu-20.04, macos-latest] + os: [ubuntu-18.04, ubuntu-20.04] outputs: traffic_light_on_ubuntu_1804: ${{ steps.do_check_on_ubuntu_1804.outputs.light }} traffic_light_on_ubuntu_2004: ${{ steps.do_check_on_ubuntu_2004.outputs.light }} - traffic_light_on_macos_latest: ${{ steps.do_check_on_macos_latest.outputs.light }} steps: - name: do_check_on_ubuntu_1804 id: do_check_on_ubuntu_1804 @@ -84,41 +92,29 @@ jobs: echo "::set-output name=light::green" fi - - name: do_check_on_macos_latest - id: do_check_on_macos_latest - if: ${{ matrix.os == 'macos-latest' }} - run: | - if [[ ${{ github.repository }} == */wasm-micro-runtime ]]; then - echo "::set-output name=light::green" - else - echo "::set-output name=light::red" - fi - build_llvm_libraries: needs: check_repo runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-18.04, ubuntu-20.04, macos-latest] + os: [ubuntu-18.04, ubuntu-20.04] include: - os: ubuntu-18.04 light: ${{ needs.check_repo.outputs.traffic_light_on_ubuntu_1804 }} - os: ubuntu-20.04 light: ${{ needs.check_repo.outputs.traffic_light_on_ubuntu_2004 }} - - os: macos-latest - light: ${{ needs.check_repo.outputs.traffic_light_on_macos_latest }} steps: - name: light status run: echo "matrix.os=${{ matrix.os }}, light=${{ matrix.light }}" - name: checkout if: ${{ matrix.light == 'green' }} - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Cache LLVM libraries id: cache_llvm if: ${{ matrix.light == 'green' }} - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: | ./core/deps/llvm/build/bin @@ -128,43 +124,35 @@ jobs: ./core/deps/llvm/build/share key: ${{ matrix.os }}-${{ env.LLVM_CACHE_SUFFIX }} - - name: Build llvm and clang from source on ubuntu - id: build_llvm_ubuntu - if: ${{ matrix.light == 'green' && steps.cache_llvm.outputs.cache-hit != 'true' && matrix.os != 'macos-latest' }} + - name: Build llvm and clang from source + id: build_llvm + if: ${{ matrix.light == 'green' && steps.cache_llvm.outputs.cache-hit != 'true' }} run: /usr/bin/env python3 ./build_llvm.py --arch X86 WebAssembly --project clang lldb working-directory: build-scripts - - name: Build llvm and clang from source on macos - id: build_llvm_macos - if: ${{ matrix.light == 'green' && steps.cache_llvm.outputs.cache-hit != 'true' && matrix.os == 'macos-latest' }} - run: /usr/bin/env python3 ./build_llvm.py --arch X86 WebAssembly - working-directory: build-scripts - build_wamrc: needs: [build_llvm_libraries, check_repo] runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-18.04, ubuntu-20.04, macos-latest] + os: [ubuntu-18.04, ubuntu-20.04] include: - os: ubuntu-18.04 light: ${{ needs.check_repo.outputs.traffic_light_on_ubuntu_1804 }} - os: ubuntu-20.04 light: ${{ needs.check_repo.outputs.traffic_light_on_ubuntu_2004 }} - - os: macos-latest - light: ${{ needs.check_repo.outputs.traffic_light_on_macos_latest }} steps: - name: light status run: echo "matrix.os=${{ matrix.os }}, light=${{ matrix.light }}" - name: checkout if: ${{ matrix.light == 'green' }} - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Get LLVM libraries id: cache_llvm if: ${{ matrix.light == 'green' }} - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: | ./core/deps/llvm/build/bin @@ -193,11 +181,11 @@ jobs: matrix: make_options_run_mode: [ # Running mode + $AOT_BUILD_OPTIONS, $CLASSIC_INTERP_BUILD_OPTIONS, $FAST_INTERP_BUILD_OPTIONS, $LAZY_JIT_BUILD_OPTIONS, $MC_JIT_BUILD_OPTIONS, - $AOT_BUILD_OPTIONS, ] make_options_feature: [ # Features @@ -206,6 +194,7 @@ jobs: "-DWAMR_BUILD_DEBUG_INTERP=1", "-DWAMR_BUILD_DUMP_CALL_STACK=1", "-DWAMR_BUILD_LIB_PTHREAD=1", + "-DWAMR_BUILD_LOAD_CUSTOM_SECTION=1", "-DWAMR_BUILD_MINI_LOADER=1", "-DWAMR_BUILD_MEMORY_PROFILING=1", "-DWAMR_BUILD_MULTI_MODULE=1", @@ -214,25 +203,11 @@ jobs: "-DWAMR_BUILD_SIMD=1", "-DWAMR_BUILD_TAIL_CALL=1", "-DWAMR_DISABLE_HW_BOUND_CHECK=1", - "-DWAMR_BUILD_LOAD_CUSTOM_SECTION=1", ] - os: [ubuntu-18.04, ubuntu-20.04, macos-latest] - platform: [android, linux, darwin] + os: [ubuntu-18.04, ubuntu-20.04] + platform: [android, linux] exclude: - # uncompatiable os and platform - # ubuntu can not go with darwin - - os: ubuntu-18.04 - platform: darwin - - os: ubuntu-20.04 - platform: darwin - # macos can not go with android, linux - - os: macos-latest - platform: android - - os: macos-latest - platform: linux # uncompatiable feature and platform - - os: macos-latest - make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1" # uncompatiable mode and feature # MULTI_MODULE only on INTERP mode - make_options_run_mode: $LAZY_JIT_BUILD_OPTIONS @@ -277,20 +252,19 @@ jobs: light: ${{ needs.check_repo.outputs.traffic_light_on_ubuntu_1804 }} - os: ubuntu-20.04 light: ${{ needs.check_repo.outputs.traffic_light_on_ubuntu_2004 }} - - os: macos-latest - light: ${{ needs.check_repo.outputs.traffic_light_on_macos_latest }} steps: - name: light status run: echo "matrix.os=${{ matrix.os }}, light=${{ matrix.light }}" - name: checkout if: ${{ matrix.light == 'green' }} - uses: actions/checkout@v2 + uses: actions/checkout@v3 + # only download llvm cache when needed - name: Get LLVM libraries id: cache_llvm - if: ${{ matrix.light == 'green' }} - uses: actions/cache@v2 + if: (matrix.light == 'green') && (endsWith(matrix.make_options_run_mode, '_JIT_BUILD_OPTIONS')) + uses: actions/cache@v3 with: path: | ./core/deps/llvm/build/bin @@ -301,7 +275,7 @@ jobs: key: ${{ matrix.os }}-${{ env.LLVM_CACHE_SUFFIX }} - name: Quit if cache miss - if: ${{ matrix.light == 'green' && steps.cache_llvm.outputs.cache-hit != 'true' }} + if: (matrix.light == 'green') && (endsWith(matrix.make_options_run_mode, '_JIT_BUILD_OPTIONS')) && (steps.cache_llvm.outputs.cache-hit != 'true') run: echo "::error::can not get prebuilt llvm libraries" && exit 1 - name: Build iwasm @@ -325,7 +299,7 @@ jobs: $MC_JIT_BUILD_OPTIONS, $AOT_BUILD_OPTIONS, ] - os: [ubuntu-18.04, ubuntu-20.04, macos-latest] + os: [ubuntu-18.04, ubuntu-20.04] include: - os: ubuntu-18.04 light: ${{ needs.check_repo.outputs.traffic_light_on_ubuntu_1804 }} @@ -335,30 +309,18 @@ jobs: light: ${{ needs.check_repo.outputs.traffic_light_on_ubuntu_2004 }} wasi_sdk_release: https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-linux.tar.gz wabt_release: https://github.com/WebAssembly/wabt/releases/download/1.0.24/wabt-1.0.24-ubuntu.tar.gz - - os: macos-latest - light: ${{ needs.check_repo.outputs.traffic_light_on_macos_latest }} - wasi_sdk_release: https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-macos.tar.gz - wabt_release: https://github.com/WebAssembly/wabt/releases/download/1.0.24/wabt-1.0.24-macos.tar.gz - exclude: - # TODO: a .aot compatiable problem - - os: macos-latest - make_options: $LAZY_JIT_BUILD_OPTIONS - - os: macos-latest - make_options: $AOT_BUILD_OPTIONS - - os: macos-latest - make_options: $MC_JIT_BUILD_OPTIONS steps: - name: light status run: echo "matrix.os=${{ matrix.os }}, light=${{ matrix.light }}" - name: checkout if: ${{ matrix.light == 'green' }} - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Get LLVM libraries id: cache_llvm - if: ${{ matrix.light == 'green' }} - uses: actions/cache@v2 + if: (matrix.light == 'green') && (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS')) + uses: actions/cache@v3 with: path: | ./core/deps/llvm/build/bin @@ -369,7 +331,7 @@ jobs: key: ${{ matrix.os }}-${{ env.LLVM_CACHE_SUFFIX }} - name: Quit if cache miss - if: ${{ matrix.light == 'green' && steps.cache_llvm.outputs.cache-hit != 'true' }} + if: (matrix.light == 'green') && (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS')) && (steps.cache_llvm.outputs.cache-hit != 'true') run: echo "::error::can not get prebuilt llvm libraries" && exit 1 - name: download and install wabt @@ -381,7 +343,7 @@ jobs: sudo mv wabt-1.0.24 wabt - name: Build wamrc - if: ${{ matrix.light == 'green' }} + if: (matrix.light == 'green') && (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS')) run: | mkdir build && cd build cmake .. @@ -407,7 +369,7 @@ jobs: working-directory: samples/wasm-c-api build_samples_others: - needs: [build_iwasm, build_llvm_libraries, build_wamrc, check_repo] + needs: [build_iwasm, check_repo] runs-on: ${{ matrix.os }} strategy: matrix: @@ -420,34 +382,13 @@ jobs: light: ${{ needs.check_repo.outputs.traffic_light_on_ubuntu_2004 }} wasi_sdk_release: https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-linux.tar.gz wabt_release: https://github.com/WebAssembly/wabt/releases/download/1.0.24/wabt-1.0.24-ubuntu.tar.gz - - os: macos-latest - light: ${{ needs.check_repo.outputs.traffic_light_on_macos_latest }} - wasi_sdk_release: https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-macos.tar.gz - wabt_release: https://github.com/WebAssembly/wabt/releases/download/1.0.24/wabt-1.0.24-macos.tar.gz steps: - name: light status run: echo "matrix.os=${{ matrix.os }}, light=${{ matrix.light }}" - name: checkout if: ${{ matrix.light == 'green' }} - uses: actions/checkout@v2 - - - name: Get LLVM libraries - id: cache_llvm - if: ${{ matrix.light == 'green' }} - uses: actions/cache@v2 - with: - path: | - ./core/deps/llvm/build/bin - ./core/deps/llvm/build/include - ./core/deps/llvm/build/lib - ./core/deps/llvm/build/libexec - ./core/deps/llvm/build/share - key: ${{ matrix.os }}-${{ env.LLVM_CACHE_SUFFIX }} - - - name: Quit if cache miss - if: ${{ matrix.light == 'green' && steps.cache_llvm.outputs.cache-hit != 'true' }} - run: echo "::error::can not get prebuilt llvm libraries" && exit 1 + uses: actions/checkout@v3 - name: download and install wasi-sdk if: ${{ matrix.light == 'green' }} @@ -465,14 +406,6 @@ jobs: sudo tar -xzf wabt-1.0.24-*.tar.gz sudo mv wabt-1.0.24 wabt - - name: Build wamrc - if: ${{ matrix.light == 'green' }} - run: | - mkdir build && cd build - cmake .. - cmake --build . --config Release --parallel 4 - working-directory: wamr-compiler - - name: Build Sample [basic] if: ${{ matrix.light == 'green' }} run: | @@ -515,3 +448,110 @@ jobs: cmake .. cmake --build . --config Release --parallel 4 ./hello + + spec_test_default: + needs: [build_iwasm, build_llvm_libraries, build_wamrc, check_repo] + runs-on: ubuntu-20.04 + strategy: + matrix: + test_option: [$DEFAULT_TEST_OPTIONS, $SIMD_TEST_OPTIONS] + steps: + - name: checkout + uses: actions/checkout@v3 + + - name: Get LLVM libraries + id: cache_llvm + uses: actions/cache@v3 + with: + path: | + ./core/deps/llvm/build/bin + ./core/deps/llvm/build/include + ./core/deps/llvm/build/lib + ./core/deps/llvm/build/libexec + ./core/deps/llvm/build/share + key: ubuntu-20.04-${{ env.LLVM_CACHE_SUFFIX }} + + - name: Quit if cache miss + if: steps.cache_llvm.outputs.cache-hit != 'true' + run: echo "::error::can not get prebuilt llvm libraries" && exit 1 + + - name: install Ninja + run: sudo apt install -y ninja-build + + - name: run spec tests + run: ./test_wamr.sh ${{ matrix.test_option }} + working-directory: ./tests/wamr-test-suites + + spec_test_extra: + if: ${{ endsWith(github.repository, 'wasm-micro-runtime') }} + needs: [build_iwasm, build_llvm_libraries, build_wamrc, check_repo] + runs-on: ubuntu-20.04 + strategy: + matrix: + test_option: [$MULTI_MODULES_TEST_OPTIONS, $THREADS_TEST_OPTIONS] + steps: + - name: checkout + uses: actions/checkout@v3 + + - name: Get LLVM libraries + id: cache_llvm + uses: actions/cache@v3 + with: + path: | + ./core/deps/llvm/build/bin + ./core/deps/llvm/build/include + ./core/deps/llvm/build/lib + ./core/deps/llvm/build/libexec + ./core/deps/llvm/build/share + key: ubuntu-20.04-${{ env.LLVM_CACHE_SUFFIX }} + + - name: Quit if cache miss + if: steps.cache_llvm.outputs.cache-hit != 'true' + run: echo "::error::can not get prebuilt llvm libraries" && exit 1 + + - name: install Ninja + run: sudo apt install -y ninja-build + + - name: run spec tests + run: ./test_wamr.sh ${{ matrix.test_option }} + working-directory: ./tests/wamr-test-suites + + spec_test_x86_32: + if: ${{ endsWith(github.repository, 'wasm-micro-runtime') }} + needs: [build_iwasm, build_llvm_libraries, build_wamrc, check_repo] + runs-on: ubuntu-20.04 + strategy: + matrix: + test_option: [$DEFAULT_TEST_OPTIONS, $THREADS_TEST_OPTIONS] + steps: + - name: checkout + uses: actions/checkout@v3 + + - name: Get LLVM libraries + id: cache_llvm + uses: actions/cache@v3 + with: + path: | + ./core/deps/llvm/build/bin + ./core/deps/llvm/build/include + ./core/deps/llvm/build/lib + ./core/deps/llvm/build/libexec + ./core/deps/llvm/build/share + key: ubuntu-20.04-${{ env.LLVM_CACHE_SUFFIX }} + + - name: Quit if cache miss + if: steps.cache_llvm.outputs.cache-hit != 'true' + run: echo "::error::can not get prebuilt llvm libraries" && exit 1 + + - name: install Ninja and x32 support libraries + run: + # Add another apt repository as some packages cannot + # be downloaded with the github default repository + sudo curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/apt/trusted.gpg.d/microsoft.asc && + sudo apt-add-repository https://packages.microsoft.com/ubuntu/20.04/prod && + sudo apt-get update && + sudo apt install -y g++-multilib lib32gcc-9-dev ninja-build + + - name: run spec tests + run: ./test_wamr.sh ${{ env.X86_32_TARGET_TEST_OPTIONS }} ${{ matrix.test_option }} + working-directory: ./tests/wamr-test-suites diff --git a/.github/workflows/compilation_on_macos.yml b/.github/workflows/compilation_on_macos.yml new file mode 100644 index 000000000..9afbb8444 --- /dev/null +++ b/.github/workflows/compilation_on_macos.yml @@ -0,0 +1,393 @@ +# Copyright (C) 2019 Intel Corporation. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +name: compilation on macos-latest + +on: + # will be triggered on PR events + pull_request: + paths-ignore: + - "assembly-script/**" + - "ci/**" + - "doc/**" + - "test-tools/**" + - ".github/workflows/compilation_on_macos.yml" + # will be triggered on push events + push: + paths-ignore: + - "assembly-script/**" + - "ci/**" + - "doc/**" + - "test-tools/**" + - ".github/workflows/compilation_on_macos.yml" + # allow to be triggered manually + workflow_dispatch: + +# Cancel any in-flight jobs for the same PR/branch so there's only one active +# at a time +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + AOT_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_LAZY_JIT=0" + CLASSIC_INTERP_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=0 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_LAZY_JIT=0" + FAST_INTERP_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=0 -DWAMR_BUILD_FAST_INTERP=1 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_LAZY_JIT=0" + LAZY_JIT_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LAZY_JIT=1" + MC_JIT_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LAZY_JIT=0" + LLVM_CACHE_SUFFIX: "build-llvm_libraries_ex" + +jobs: + # Cancel any in-flight jobs for the same PR/branch so there's only one active + # at a time + cancel_previous: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [macos-latest] + steps: + - name: Cancel Workflow Action + uses: styfle/cancel-workflow-action@0.9.1 + with: + access_token: ${{ github.token }} + + # set different traffic lights based on the current repo and the running OS. + # according to light colors, the workflow will run different jobs + check_repo: + needs: cancel_previous + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [macos-latest] + outputs: + traffic_light: ${{ steps.do_check.outputs.light }} + steps: + - name: do_check + id: do_check + if: ${{ matrix.os == 'macos-latest' }} + run: | + if [[ ${{ github.repository }} == */wasm-micro-runtime ]]; then + echo "::set-output name=light::green" + else + echo "::set-output name=light::red" + fi + + build_llvm_libraries: + needs: check_repo + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [macos-latest] + include: + - os: macos-latest + light: ${{ needs.check_repo.outputs.traffic_light }} + steps: + - name: light status + run: echo "matrix.os=${{ matrix.os }}, light=${{ matrix.light }}" + + - name: checkout + if: ${{ matrix.light == 'green' }} + uses: actions/checkout@v3 + + - name: Cache LLVM libraries + id: cache_llvm + if: ${{ matrix.light == 'green' }} + uses: actions/cache@v3 + with: + path: | + ./core/deps/llvm/build/bin + ./core/deps/llvm/build/include + ./core/deps/llvm/build/lib + ./core/deps/llvm/build/libexec + ./core/deps/llvm/build/share + key: ${{ matrix.os }}-${{ env.LLVM_CACHE_SUFFIX }} + + - name: Build llvm and clang from source + id: build_llvm + if: ${{ matrix.light == 'green' && steps.cache_llvm.outputs.cache-hit != 'true' }} + run: /usr/bin/env python3 ./build_llvm.py --arch X86 WebAssembly + working-directory: build-scripts + + build_wamrc: + needs: [build_llvm_libraries, check_repo] + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [macos-latest] + include: + - os: macos-latest + light: ${{ needs.check_repo.outputs.traffic_light }} + steps: + - name: light status + run: echo "matrix.os=${{ matrix.os }}, light=${{ matrix.light }}" + + - name: checkout + if: ${{ matrix.light == 'green' }} + uses: actions/checkout@v3 + + - name: Get LLVM libraries + id: cache_llvm + if: ${{ matrix.light == 'green' }} + uses: actions/cache@v3 + with: + path: | + ./core/deps/llvm/build/bin + ./core/deps/llvm/build/include + ./core/deps/llvm/build/lib + ./core/deps/llvm/build/libexec + ./core/deps/llvm/build/share + key: ${{ matrix.os }}-${{ env.LLVM_CACHE_SUFFIX }} + + - name: Quit if cache miss + if: ${{ matrix.light == 'green' && steps.cache_llvm.outputs.cache-hit != 'true' }} + run: echo "::error::can not get prebuilt llvm libraries" && exit 1 + + - name: Build wamrc + if: ${{ matrix.light == 'green' }} + run: | + mkdir build && cd build + cmake .. + cmake --build . --config Release --parallel 4 + working-directory: wamr-compiler + + build_iwasm: + needs: [build_llvm_libraries, check_repo] + runs-on: ${{ matrix.os }} + strategy: + matrix: + make_options_run_mode: [ + # Running mode + $AOT_BUILD_OPTIONS, + $CLASSIC_INTERP_BUILD_OPTIONS, + $FAST_INTERP_BUILD_OPTIONS, + $LAZY_JIT_BUILD_OPTIONS, + $MC_JIT_BUILD_OPTIONS, + ] + make_options_feature: [ + # Features + "-DWAMR_BUILD_CUSTOM_NAME_SECTION=1", + # doesn't support + #"-DWAMR_BUILD_DEBUG_AOT=1", + "-DWAMR_BUILD_DEBUG_INTERP=1", + "-DWAMR_BUILD_DUMP_CALL_STACK=1", + "-DWAMR_BUILD_LIB_PTHREAD=1", + "-DWAMR_BUILD_LOAD_CUSTOM_SECTION=1", + "-DWAMR_BUILD_MINI_LOADER=1", + "-DWAMR_BUILD_MEMORY_PROFILING=1", + "-DWAMR_BUILD_MULTI_MODULE=1", + "-DWAMR_BUILD_PERF_PROFILING=1", + "-DWAMR_BUILD_REF_TYPES=1", + "-DWAMR_BUILD_SIMD=1", + "-DWAMR_BUILD_TAIL_CALL=1", + "-DWAMR_DISABLE_HW_BOUND_CHECK=1", + ] + os: [macos-latest] + platform: [darwin] + exclude: + # uncompatiable feature and platform + # uncompatiable mode and feature + # MULTI_MODULE only on INTERP mode + - make_options_run_mode: $LAZY_JIT_BUILD_OPTIONS + make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1" + - make_options_run_mode: $AOT_BUILD_OPTIONS + make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1" + - make_options_run_mode: $MC_JIT_BUILD_OPTIONS + make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1" + # SIMD only on JIT/AOT mode + - make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS + make_options_feature: "-DWAMR_BUILD_SIMD=1" + - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS + make_options_feature: "-DWAMR_BUILD_SIMD=1" + # DEBUG_INTERP only on CLASSIC INTERP mode + - make_options_run_mode: $AOT_BUILD_OPTIONS + make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1" + - make_options_run_mode: $LAZY_JIT_BUILD_OPTIONS + make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1" + - make_options_run_mode: $MC_JIT_BUILD_OPTIONS + make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1" + - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS + make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1" + # DEBUG_AOT only on JIT/AOT mode + - make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS + make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1" + - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS + make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1" + # TODO: DEBUG_AOT on JIT + - make_options_run_mode: $LAZY_JIT_BUILD_OPTIONS + make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1" + - make_options_run_mode: $MC_JIT_BUILD_OPTIONS + make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1" + # MINI_LOADER only on INTERP mode + - make_options_run_mode: $AOT_BUILD_OPTIONS + make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1" + - make_options_run_mode: $LAZY_JIT_BUILD_OPTIONS + make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1" + - make_options_run_mode: $MC_JIT_BUILD_OPTIONS + make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1" + include: + - os: macos-latest + light: ${{ needs.check_repo.outputs.traffic_light }} + steps: + - name: light status + run: echo "matrix.os=${{ matrix.os }}, light=${{ matrix.light }}" + + - name: checkout + if: ${{ matrix.light == 'green' }} + uses: actions/checkout@v3 + + # only download llvm cache when needed + - name: Get LLVM libraries + id: cache_llvm + if: (matrix.light == 'green') && (endsWith(matrix.make_options_run_mode, '_JIT_BUILD_OPTIONS')) + uses: actions/cache@v3 + with: + path: | + ./core/deps/llvm/build/bin + ./core/deps/llvm/build/include + ./core/deps/llvm/build/lib + ./core/deps/llvm/build/libexec + ./core/deps/llvm/build/share + key: ${{ matrix.os }}-${{ env.LLVM_CACHE_SUFFIX }} + + - name: Quit if cache miss + if: (matrix.light == 'green') && (endsWith(matrix.make_options_run_mode, '_JIT_BUILD_OPTIONS')) && (steps.cache_llvm.outputs.cache-hit != 'true') + run: echo "::error::can not get prebuilt llvm libraries" && exit 1 + + - name: Build iwasm + if: ${{ matrix.light == 'green' }} + run: | + mkdir build && cd build + cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }} + cmake --build . --config Release --parallel 4 + working-directory: product-mini/platforms/${{ matrix.platform }} + + build_samples_wasm_c_api: + needs: [build_iwasm, check_repo] + runs-on: ${{ matrix.os }} + strategy: + matrix: + make_options: [ + # Running mode + $CLASSIC_INTERP_BUILD_OPTIONS, + $FAST_INTERP_BUILD_OPTIONS, + # doesn't support + #$LAZY_JIT_BUILD_OPTIONS, + #$MC_JIT_BUILD_OPTIONS, + #$AOT_BUILD_OPTIONS, + ] + os: [macos-latest] + include: + - os: macos-latest + light: ${{ needs.check_repo.outputs.traffic_light }} + wasi_sdk_release: https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-macos.tar.gz + wabt_release: https://github.com/WebAssembly/wabt/releases/download/1.0.24/wabt-1.0.24-macos.tar.gz + steps: + - name: light status + run: echo "matrix.os=${{ matrix.os }}, light=${{ matrix.light }}" + + - name: checkout + if: ${{ matrix.light == 'green' }} + uses: actions/checkout@v3 + + - name: download and install wabt + if: ${{ matrix.light == 'green' }} + run: | + cd /opt + sudo wget ${{ matrix.wabt_release }} + sudo tar -xzf wabt-1.0.24-*.tar.gz + sudo mv wabt-1.0.24 wabt + + - name: Build Sample [wasm-c-api] + if: ${{ matrix.light == 'green' }} + run: | + mkdir build && cd build + cmake .. ${{ matrix.make_options }} + cmake --build . --config Release --parallel 4 + ./callback + ./callback_chain + ./empty_imports + ./global + ./hello + ./hostref + ./memory + ./reflect + ./table + ./trap + working-directory: samples/wasm-c-api + + build_samples_others: + needs: [build_iwasm, check_repo] + runs-on: ${{ matrix.os }} + strategy: + matrix: + include: + - os: macos-latest + light: ${{ needs.check_repo.outputs.traffic_light }} + wasi_sdk_release: https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-macos.tar.gz + wabt_release: https://github.com/WebAssembly/wabt/releases/download/1.0.24/wabt-1.0.24-macos.tar.gz + steps: + - name: light status + run: echo "matrix.os=${{ matrix.os }}, light=${{ matrix.light }}" + + - name: checkout + if: ${{ matrix.light == 'green' }} + uses: actions/checkout@v3 + + - name: download and install wasi-sdk + if: ${{ matrix.light == 'green' }} + run: | + cd /opt + sudo wget ${{ matrix.wasi_sdk_release }} + sudo tar -xzf wasi-sdk-12.0-*.tar.gz + sudo mv wasi-sdk-12.0 wasi-sdk + + - name: download and install wabt + if: ${{ matrix.light == 'green' }} + run: | + cd /opt + sudo wget ${{ matrix.wabt_release }} + sudo tar -xzf wabt-1.0.24-*.tar.gz + sudo mv wabt-1.0.24 wabt + + - name: Build Sample [basic] + if: ${{ matrix.light == 'green' }} + run: | + cd samples/basic + ./build.sh + ./run.sh + + - name: Build Sample [multi-thread] + if: ${{ matrix.light == 'green' }} + run: | + cd samples/multi-thread + mkdir build && cd build + cmake .. + cmake --build . --config Release --parallel 4 + ./iwasm wasm-apps/test.wasm + + - name: Build Sample [multi-module] + if: ${{ matrix.light == 'green' }} + run: | + cd samples/multi-module + mkdir build && cd build + cmake .. + cmake --build . --config Release --parallel 4 + ./multi_module + + - name: Build Sample [spawn-thread] + if: ${{ matrix.light == 'green' }} + run: | + cd samples/spawn-thread + mkdir build && cd build + cmake .. + cmake --build . --config Release --parallel 4 + ./spawn_thread + + - name: Build Sample [ref-types] + if: ${{ matrix.light == 'green' }} + run: | + cd samples/ref-types + mkdir build && cd build + cmake .. + cmake --build . --config Release --parallel 4 + ./hello diff --git a/.github/workflows/compilation_on_sgx.yml b/.github/workflows/compilation_on_sgx.yml index f04168389..f21b618ce 100644 --- a/.github/workflows/compilation_on_sgx.yml +++ b/.github/workflows/compilation_on_sgx.yml @@ -1,7 +1,7 @@ # Copyright (C) 2019 Intel Corporation. All rights reserved. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -name: CI on SGX +name: compilation on SGX on: # will be triggered on PR events @@ -47,7 +47,7 @@ jobs: os: [ubuntu-20.04] steps: - name: Cancel Workflow Action - uses: styfle/cancel-workflow-action@0.6.0 + uses: styfle/cancel-workflow-action@0.9.1 with: access_token: ${{ github.token }} @@ -87,12 +87,12 @@ jobs: - name: checkout if: ${{ matrix.light == 'green' }} - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Cache LLVM libraries id: cache_llvm if: ${{ matrix.light == 'green' }} - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: | ./core/deps/llvm/build/bin @@ -103,24 +103,24 @@ jobs: key: ${{ matrix.os }}-${{ env.LLVM_CACHE_SUFFIX }} - name: Build llvm and clang from source - id: build_llvm_ubuntu + id: build_llvm if: ${{ matrix.light == 'green' && steps.cache_llvm.outputs.cache-hit != 'true' }} run: /usr/bin/env python3 ./build_llvm.py --arch X86 WebAssembly --project clang lldb working-directory: build-scripts build_iwasm: - needs: [build_llvm_libraries, check_repo] + needs: [check_repo] runs-on: ${{ matrix.os }} strategy: matrix: make_options_run_mode: [ # Running mode + $AOT_BUILD_OPTIONS, $CLASSIC_INTERP_BUILD_OPTIONS, $FAST_INTERP_BUILD_OPTIONS, # doesn't support # $LAZY_JIT_BUILD_OPTIONS, # $MC_JIT_BUILD_OPTIONS, - $AOT_BUILD_OPTIONS, ] make_options_feature: [ # Features @@ -130,6 +130,7 @@ jobs: # "-DWAMR_BUILD_DEBUG_INTERP=1", "-DWAMR_BUILD_DUMP_CALL_STACK=1", "-DWAMR_BUILD_LIB_PTHREAD=1", + "-DWAMR_BUILD_LOAD_CUSTOM_SECTION=1", "-DWAMR_BUILD_MINI_LOADER=1", "-DWAMR_BUILD_MEMORY_PROFILING=1", "-DWAMR_BUILD_MULTI_MODULE=1", @@ -139,7 +140,6 @@ jobs: # "-DWAMR_BUILD_SIMD=1", "-DWAMR_BUILD_TAIL_CALL=1", "-DWAMR_DISABLE_HW_BOUND_CHECK=1", - "-DWAMR_BUILD_LOAD_CUSTOM_SECTION=1", ] os: [ubuntu-20.04] platform: [linux-sgx] @@ -174,12 +174,51 @@ jobs: - name: checkout if: ${{ matrix.light == 'green' }} - uses: actions/checkout@v2 + uses: actions/checkout@v3 + + - name: Build iwasm + if: ${{ matrix.light == 'green' }} + run: | + mkdir build && cd build + cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }} + cmake --build . --config Release --parallel 4 + working-directory: product-mini/platforms/${{ matrix.platform }} + + build_wamrc: + needs: [build_llvm_libraries, check_repo] + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-20.04] + include: + - os: ubuntu-20.04 + light: ${{ needs.check_repo.outputs.traffic_light_on_ubuntu_2004 }} + steps: + - name: light status + run: echo "matrix.os=${{ matrix.os }}, light=${{ matrix.light }}" + + - name: install SGX SDK and necessary libraries + if: ${{ matrix.light == 'green' }} + run: | + mkdir -p /opt/intel + cd /opt/intel + wget https://download.01.org/intel-sgx/sgx-linux/2.15/distro/ubuntu20.04-server/sgx_linux_x64_sdk_2.15.100.3.bin + chmod +x sgx_linux_x64_sdk_2.15.100.3.bin + echo 'yes' | ./sgx_linux_x64_sdk_2.15.100.3.bin + echo 'deb [arch=amd64] https://download.01.org/intel-sgx/sgx_repo/ubuntu focal main' | sudo tee /etc/apt/sources.list.d/intel-sgx.list + wget -qO - https://download.01.org/intel-sgx/sgx_repo/ubuntu/intel-sgx-deb.key | sudo apt-key add - + sudo apt update + sudo apt install -y libsgx-launch libsgx-urts + source /opt/intel/sgxsdk/environment + + - name: checkout + if: ${{ matrix.light == 'green' }} + uses: actions/checkout@v3 - name: Get LLVM libraries id: cache_llvm if: ${{ matrix.light == 'green' }} - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: | ./core/deps/llvm/build/bin @@ -193,16 +232,16 @@ jobs: if: ${{ matrix.light == 'green' && steps.cache_llvm.outputs.cache-hit != 'true' }} run: echo "::error::can not get prebuilt llvm libraries" && exit 1 - - name: Build iwasm + - name: Build wamrc if: ${{ matrix.light == 'green' }} run: | mkdir build && cd build - cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }} + cmake .. cmake --build . --config Release --parallel 4 - working-directory: product-mini/platforms/${{ matrix.platform }} + working-directory: wamr-compiler build_samples_wasm_c_api: - needs: [build_iwasm, build_llvm_libraries, check_repo] + needs: [build_iwasm, check_repo] runs-on: ${{ matrix.os }} strategy: matrix: @@ -227,24 +266,7 @@ jobs: - name: checkout if: ${{ matrix.light == 'green' }} - uses: actions/checkout@v2 - - - name: Get LLVM libraries - id: cache_llvm - if: ${{ matrix.light == 'green' }} - uses: actions/cache@v2 - with: - path: | - ./core/deps/llvm/build/bin - ./core/deps/llvm/build/include - ./core/deps/llvm/build/lib - ./core/deps/llvm/build/libexec - ./core/deps/llvm/build/share - key: ${{ matrix.os }}-${{ env.LLVM_CACHE_SUFFIX }} - - - name: Quit if cache miss - if: ${{ matrix.light == 'green' && steps.cache_llvm.outputs.cache-hit != 'true' }} - run: echo "::error::can not get prebuilt llvm libraries" && exit 1 + uses: actions/checkout@v3 - name: download and install wabt if: ${{ matrix.light == 'green' }} @@ -268,14 +290,6 @@ jobs: sudo apt install -y libsgx-launch libsgx-urts source /opt/intel/sgxsdk/environment - - name: Build wamrc - if: ${{ matrix.light == 'green' }} - run: | - mkdir build && cd build - cmake .. - cmake --build . --config Release --parallel 4 - working-directory: wamr-compiler - - name: Build Sample [wasm-c-api] if: ${{ matrix.light == 'green' }} run: | @@ -295,7 +309,7 @@ jobs: working-directory: samples/wasm-c-api build_samples_others: - needs: [build_iwasm, build_llvm_libraries, check_repo] + needs: [build_iwasm, check_repo] runs-on: ${{ matrix.os }} strategy: matrix: @@ -310,24 +324,7 @@ jobs: - name: checkout if: ${{ matrix.light == 'green' }} - uses: actions/checkout@v2 - - - name: Get LLVM libraries - id: cache_llvm - if: ${{ matrix.light == 'green' }} - uses: actions/cache@v2 - with: - path: | - ./core/deps/llvm/build/bin - ./core/deps/llvm/build/include - ./core/deps/llvm/build/lib - ./core/deps/llvm/build/libexec - ./core/deps/llvm/build/share - key: ${{ matrix.os }}-${{ env.LLVM_CACHE_SUFFIX }} - - - name: Quit if cache miss - if: ${{ matrix.light == 'green' && steps.cache_llvm.outputs.cache-hit != 'true' }} - run: echo "::error::can not get prebuilt llvm libraries" && exit 1 + uses: actions/checkout@v3 - name: download and install wasi-sdk if: ${{ matrix.light == 'green' }} @@ -359,14 +356,6 @@ jobs: sudo apt install -y libsgx-launch libsgx-urts source /opt/intel/sgxsdk/environment - - name: Build wamrc - if: ${{ matrix.light == 'green' }} - run: | - mkdir build && cd build - cmake .. - cmake --build . --config Release --parallel 4 - working-directory: wamr-compiler - - name: Build Sample [basic] if: ${{ matrix.light == 'green' }} run: | @@ -411,7 +400,7 @@ jobs: ./hello spec_test_default: - needs: [build_iwasm, build_llvm_libraries, check_repo] + needs: [build_iwasm, build_llvm_libraries, build_wamrc, check_repo] runs-on: ubuntu-20.04 strategy: matrix: @@ -423,12 +412,12 @@ jobs: steps: - name: checkout if: ${{ matrix.light == 'green' }} - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Get LLVM libraries if: ${{ matrix.light == 'green' }} id: cache_llvm - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: | ./core/deps/llvm/build/bin @@ -438,6 +427,10 @@ jobs: ./core/deps/llvm/build/share key: ubuntu-20.04-${{ env.LLVM_CACHE_SUFFIX }} + - name: Quit if cache miss + if: ${{ matrix.light == 'green' && steps.cache_llvm.outputs.cache-hit != 'true' }} + run: echo "::error::can not get prebuilt llvm libraries" && exit 1 + - name: install Ninja if: ${{ matrix.light == 'green' }} run: sudo apt install -y ninja-build diff --git a/.github/workflows/compilation_on_windows.yml b/.github/workflows/compilation_on_windows.yml index 5306f784b..408bdc25e 100644 --- a/.github/workflows/compilation_on_windows.yml +++ b/.github/workflows/compilation_on_windows.yml @@ -36,7 +36,7 @@ jobs: runs-on: windows-latest steps: - name: Cancel Workflow Action - uses: styfle/cancel-workflow-action@0.6.0 + uses: styfle/cancel-workflow-action@0.9.1 with: access_token: ${{ github.token }} @@ -44,7 +44,7 @@ jobs: needs: cancel_previous runs-on: windows-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: clone uvwasi library run: | diff --git a/.github/workflows/spec_test.yml b/.github/workflows/spec_test.yml deleted file mode 100644 index 336d19379..000000000 --- a/.github/workflows/spec_test.yml +++ /dev/null @@ -1,155 +0,0 @@ -# Copyright (C) 2019 Intel Corporation. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -name: Spec tests on non-windows - -on: - # will be triggered on PR events - pull_request: - paths: - - "core/config.h" - - "core/iwasm/**" - - "core/shared/**" - - "wamr-compiler/**" - - "product-mini/**" - - "tests/wamr-test-suites/spec-test-script/**" - - "tests/wamr-test-suites/test_wamr.sh" - - ".github/workflows/spec_test.yml" - # will be triggered on push events - push: - paths: - - "core/config.h" - - "core/iwasm/**" - - "core/shared/**" - - "wamr-compiler/**" - - "product-mini/**" - - "tests/wamr-test-suites/spec-test-script/**" - - "tests/wamr-test-suites/test_wamr.sh" - - ".github/workflows/spec_test.yml" - # allow to be triggered manually - workflow_dispatch: - -# Cancel any in-flight jobs for the same PR/branch so there's only one active -# at a time -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -env: - DEFAULT_TEST_OPTIONS: "-s spec -P" - LLVM_CACHE_SUFFIX: "build-llvm_libraries_ex" - MULTI_MODULES_TEST_OPTIONS: "-s spec -M -P" - SIMD_TEST_OPTIONS: "-s spec -S -P" - THREADS_TEST_OPTIONS: "-s spec -p -P" - X86_32_TARGET_TEST_OPTIONS: "-m x86_32 -P" - -jobs: - cancel_previous: - runs-on: ubuntu-20.04 - steps: - - name: Cancel Workflow Action - uses: styfle/cancel-workflow-action@0.6.0 - with: - access_token: ${{ github.token }} - - spec_test_default: - needs: cancel_previous - runs-on: ubuntu-20.04 - strategy: - matrix: - test_option: [$DEFAULT_TEST_OPTIONS, $SIMD_TEST_OPTIONS] - steps: - - name: checkout - uses: actions/checkout@v2 - - - name: Get LLVM libraries - id: cache_llvm - uses: actions/cache@v2 - with: - path: | - ./core/deps/llvm/build/bin - ./core/deps/llvm/build/include - ./core/deps/llvm/build/lib - ./core/deps/llvm/build/libexec - ./core/deps/llvm/build/share - key: ubuntu-20.04-${{ env.LLVM_CACHE_SUFFIX }} - - - name: install Ninja - run: sudo apt install -y ninja-build - - - name: run spec tests - run: ./test_wamr.sh ${{ matrix.test_option }} - working-directory: ./tests/wamr-test-suites - - spec_test_extra: - needs: cancel_previous - if: ${{ endsWith(github.repository, 'wasm-micro-runtime') }} - runs-on: ubuntu-20.04 - strategy: - matrix: - test_option: [$MULTI_MODULES_TEST_OPTIONS, $THREADS_TEST_OPTIONS] - steps: - - name: checkout - uses: actions/checkout@v2 - - - name: Get LLVM libraries - id: cache_llvm - uses: actions/cache@v2 - with: - path: | - ./core/deps/llvm/build/bin - ./core/deps/llvm/build/include - ./core/deps/llvm/build/lib - ./core/deps/llvm/build/libexec - ./core/deps/llvm/build/share - key: ubuntu-20.04-${{ env.LLVM_CACHE_SUFFIX }} - - - name: Quit if cache miss - if: steps.cache_llvm.outputs.cache-hit != 'true' - run: echo "::error::can not get prebuilt llvm libraries" && exit 1 - - - name: install Ninja - run: sudo apt install -y ninja-build - - - name: run spec tests - run: ./test_wamr.sh ${{ matrix.test_option }} - working-directory: ./tests/wamr-test-suites - - spec_test_x86_32: - if: ${{ endsWith(github.repository, 'wasm-micro-runtime') }} - needs: cancel_previous - runs-on: ubuntu-20.04 - strategy: - matrix: - test_option: [$DEFAULT_TEST_OPTIONS, $THREADS_TEST_OPTIONS] - steps: - - name: checkout - uses: actions/checkout@v2 - - - name: Get LLVM libraries - id: cache_llvm - uses: actions/cache@v2 - with: - path: | - ./core/deps/llvm/build/bin - ./core/deps/llvm/build/include - ./core/deps/llvm/build/lib - ./core/deps/llvm/build/libexec - ./core/deps/llvm/build/share - key: ubuntu-20.04-${{ env.LLVM_CACHE_SUFFIX }} - - - name: Quit if cache miss - if: steps.cache_llvm.outputs.cache-hit != 'true' - run: echo "::error::can not get prebuilt llvm libraries" && exit 1 - - - name: install Ninja and x32 support libraries - run: - # Add another apt repository as some packages cannot - # be downloaded with the github default repository - sudo curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/apt/trusted.gpg.d/microsoft.asc && - sudo apt-add-repository https://packages.microsoft.com/ubuntu/20.04/prod && - sudo apt-get update && - sudo apt install -y g++-multilib lib32gcc-9-dev ninja-build - - - name: run spec tests - run: ./test_wamr.sh ${{ env.X86_32_TARGET_TEST_OPTIONS }} ${{ matrix.test_option }} - working-directory: ./tests/wamr-test-suites diff --git a/core/iwasm/compilation/aot_emit_aot_file.c b/core/iwasm/compilation/aot_emit_aot_file.c index e6d070545..69d415779 100644 --- a/core/iwasm/compilation/aot_emit_aot_file.c +++ b/core/iwasm/compilation/aot_emit_aot_file.c @@ -1287,6 +1287,7 @@ fail: static uint32 get_custom_sections_size(AOTCompContext *comp_ctx, AOTCompData *comp_data) { +#if WASM_ENABLE_LOAD_CUSTOM_SECTION != 0 uint32 size = 0, i; for (i = 0; i < comp_ctx->custom_sections_count; i++) { @@ -1312,6 +1313,9 @@ get_custom_sections_size(AOTCompContext *comp_ctx, AOTCompData *comp_data) } return size; +#else + return 0; +#endif } static bool @@ -1941,6 +1945,7 @@ static bool aot_emit_custom_sections(uint8 *buf, uint8 *buf_end, uint32 *p_offset, AOTCompData *comp_data, AOTCompContext *comp_ctx) { +#if WASM_ENABLE_LOAD_CUSTOM_SECTION != 0 uint32 offset = *p_offset, i; for (i = 0; i < comp_ctx->custom_sections_count; i++) { @@ -1968,6 +1973,7 @@ aot_emit_custom_sections(uint8 *buf, uint8 *buf_end, uint32 *p_offset, } *p_offset = offset; +#endif return true; }