| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424 |
- # Copyright (C) 2019 Intel Corporation. All rights reserved.
- # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- name: compilation on macos
- on:
- # will be triggered on PR events
- pull_request:
- types:
- - opened
- - synchronize
- paths:
- - ".github/workflows/build_llvm_libraries.yml"
- - ".github/workflows/compilation_on_macos.yml"
- - "build-scripts/**"
- - "core/**"
- - "!core/deps/**"
- - "product-mini/**"
- - "samples/**"
- - "!samples/workload/**"
- - "tests/wamr-test-suites/**"
- - "wamr-compiler/**"
- # will be triggered on push events
- push:
- branches:
- - main
- - "dev/**"
- paths:
- - ".github/workflows/build_llvm_libraries.yml"
- - ".github/workflows/compilation_on_macos.yml"
- - "build-scripts/**"
- - "core/**"
- - "!core/deps/**"
- - "product-mini/**"
- - "samples/**"
- - "!samples/workload/**"
- - "tests/wamr-test-suites/**"
- - "wamr-compiler/**"
- # 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:
- # For BUILD
- 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"
- 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"
- 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"
- 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"
- 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"
- 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"
- 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"
- permissions:
- contents: read
- jobs:
- build_llvm_libraries_on_intel_macos:
- permissions:
- contents: read
- actions: write
- uses: ./.github/workflows/build_llvm_libraries.yml
- with:
- os: "macos-13"
- arch: "X86"
- build_llvm_libraries_on_arm_macos:
- permissions:
- contents: read
- actions: write
- uses: ./.github/workflows/build_llvm_libraries.yml
- with:
- os: "macos-14"
- arch: "AArch64 ARM"
- build_wamrc:
- needs: [build_llvm_libraries_on_intel_macos]
- runs-on: ${{ matrix.os }}
- strategy:
- matrix:
- include:
- - os: macos-13
- llvm_cache_key: ${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}
- steps:
- - name: checkout
- uses: actions/checkout@v5
- - name: Get LLVM libraries
- id: retrieve_llvm_libs
- uses: actions/cache@v4
- 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.llvm_cache_key }}
- - name: Quit if cache miss
- if: steps.retrieve_llvm_libs.outputs.cache-hit != 'true'
- run: echo "::error::can not get prebuilt llvm libraries" && exit 1
- - name: Build wamrc
- run: |
- mkdir build && cd build
- cmake .. -DCMAKE_C_FLAGS="-Werror"
- cmake --build . --config Release --parallel 4
- working-directory: wamr-compiler
- build_iwasm:
- needs: [build_llvm_libraries_on_intel_macos]
- runs-on: ${{ matrix.os }}
- strategy:
- matrix:
- make_options_run_mode: [
- # Running mode
- $AOT_BUILD_OPTIONS,
- $CLASSIC_INTERP_BUILD_OPTIONS,
- $FAST_INTERP_BUILD_OPTIONS,
- $LLVM_LAZY_JIT_BUILD_OPTIONS,
- $LLVM_EAGER_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_LIB_WASI_THREADS=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",
- "-DWAMR_BUILD_EXTENDED_CONST_EXPR=1",
- ]
- os: [macos-13]
- platform: [darwin]
- exclude:
- # incompatible feature and platform
- # incompatible mode and feature
- # MULTI_MODULE only on INTERP mode and AOT mode
- - make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
- make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
- - make_options_run_mode: $LLVM_EAGER_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: $LLVM_LAZY_JIT_BUILD_OPTIONS
- make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
- - make_options_run_mode: $LLVM_EAGER_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: $LLVM_LAZY_JIT_BUILD_OPTIONS
- make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
- - make_options_run_mode: $LLVM_EAGER_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: $LLVM_LAZY_JIT_BUILD_OPTIONS
- make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
- - make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
- make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
- include:
- - os: macos-13
- llvm_cache_key: ${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}
- steps:
- - name: checkout
- uses: actions/checkout@v5
- # only download llvm cache when needed
- - name: Get LLVM libraries
- id: retrieve_llvm_libs
- if: endsWith(matrix.make_options_run_mode, '_JIT_BUILD_OPTIONS')
- uses: actions/cache@v4
- 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.llvm_cache_key }}
- - name: Quit if cache miss
- if: endsWith(matrix.make_options_run_mode, '_JIT_BUILD_OPTIONS') && (steps.retrieve_llvm_libs.outputs.cache-hit != 'true')
- run: echo "::error::can not get prebuilt llvm libraries" && exit 1
- - name: Build iwasm
- run: |
- mkdir build && cd build
- cmake .. -DCMAKE_C_FLAGS="-Werror" ${{ 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,
- build_llvm_libraries_on_intel_macos,
- build_wamrc,
- ]
- runs-on: ${{ matrix.os }}
- strategy:
- matrix:
- make_options: [
- $AOT_BUILD_OPTIONS,
- $CLASSIC_INTERP_BUILD_OPTIONS,
- $FAST_INTERP_BUILD_OPTIONS,
- $FAST_JIT_BUILD_OPTIONS,
- $LLVM_LAZY_JIT_BUILD_OPTIONS,
- $LLVM_EAGER_JIT_BUILD_OPTIONS,
- $MULTI_TIER_JIT_BUILD_OPTIONS,
- ]
- os: [macos-13]
- include:
- - os: macos-13
- llvm_cache_key: ${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}
- steps:
- - name: checkout
- uses: actions/checkout@v5
- - name: Get LLVM libraries
- id: retrieve_llvm_libs
- if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS'))
- uses: actions/cache@v4
- 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.llvm_cache_key }}
- - name: Quit if cache miss
- if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS')) && (steps.retrieve_llvm_libs.outputs.cache-hit != 'true')
- run: echo "::error::can not get prebuilt llvm libraries" && exit 1
- - name: install-wasi-sdk-wabt
- uses: ./.github/actions/install-wasi-sdk-wabt
- with:
- os: ${{ matrix.os }}
- - name: Build wamrc
- if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS'))
- run: |
- mkdir build && cd build
- cmake ..
- cmake --build . --config Release --parallel 4
- working-directory: wamr-compiler
- - name: Build Sample [wasm-c-api]
- run: |
- VERBOSE=1
- cmake -S . -B build ${{ matrix.make_options }}
- cmake --build build --config Debug --parallel 4
- ctest --test-dir build --output-on-failure
- working-directory: samples/wasm-c-api
- - name: Build Sample [printversion]
- run: |
- ./test.sh
- working-directory: samples/printversion
- build_samples_others:
- needs: [build_iwasm, build_wamrc, build_llvm_libraries_on_intel_macos, build_llvm_libraries_on_arm_macos]
- runs-on: ${{ matrix.os }}
- strategy:
- matrix:
- os: [macos-13, macos-14]
- include:
- - os: macos-13
- llvm_cache_key: ${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}
- - os: macos-14
- llvm_cache_key: ${{ needs.build_llvm_libraries_on_arm_macos.outputs.cache_key }}
- steps:
- - name: checkout
- uses: actions/checkout@v5
- - name: install-wasi-sdk-wabt
- uses: ./.github/actions/install-wasi-sdk-wabt
- with:
- os: ${{ matrix.os }}
- - name: Build Sample [basic]
- run: |
- cd samples/basic
- ./build.sh
- ./run.sh
- - name: Build Sample [file]
- run: |
- cd samples/file
- mkdir build && cd build
- cmake ..
- cmake --build . --config Debug --parallel 4
- ./src/iwasm -f wasm-app/file.wasm -d .
- - name: Build Sample [multi-thread]
- run: |
- cd samples/multi-thread
- mkdir build && cd build
- cmake ..
- cmake --build . --config Debug --parallel 4
- ./iwasm wasm-apps/test.wasm
- - name: Build Sample [multi-module]
- run: |
- cd samples/multi-module
- mkdir build && cd build
- cmake ..
- cmake --build . --config Debug --parallel 4
- ./multi_module mC.wasm
- - name: Build Sample [spawn-thread]
- run: |
- cd samples/spawn-thread
- mkdir build && cd build
- cmake ..
- cmake --build . --config Debug --parallel 4
- ./spawn_thread
- - name: Build Sample [ref-types]
- run: |
- cd samples/ref-types
- mkdir build && cd build
- cmake ..
- cmake --build . --config Debug --parallel 4
- ./hello
- - name: Get LLVM libraries
- id: retrieve_llvm_libs
- uses: actions/cache@v4
- 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.llvm_cache_key }}
- - name: Build wamrc
- run: |
- mkdir build && cd build
- cmake ..
- cmake --build . --config Release --parallel 4
- working-directory: wamr-compiler
- # cmake --build . --config Debug --parallel 4
- - name: Build Sample [wasi-threads]
- run: |
- cd samples/wasi-threads
- mkdir build && cd build
- cmake ..
- cmake --build . --config Debug --verbose
- ./iwasm wasm-apps/no_pthread.wasm
- ../../../wamr-compiler/build/wamrc --size-level=0 --enable-multi-thread -o wasm-apps/no_pthread.aot wasm-apps/no_pthread.wasm
- ./iwasm wasm-apps/no_pthread.aot
- - name: Build Sample [shared-module]
- run: |
- cd samples/shared-module
- ./build.sh
- ./run.sh
- - name: Build Sample [terminate]
- run: |
- cd samples/terminate
- ./build.sh
- ./run.sh
- - name: Build Sample [debug-tools]
- run: |
- cd samples/debug-tools
- mkdir build && cd build
- cmake ..
- cmake --build . --config Debug --parallel 4
- ./iwasm wasm-apps/trap.wasm | grep "#" > call_stack.txt
- ./iwasm wasm-apps/trap.aot | grep "#" > call_stack_aot.txt
- bash -x ../symbolicate.sh
- - name: Build Sample [native-stack-overflow]
- run: |
- cd samples/native-stack-overflow
- ./build.sh
- ./run.sh test1
- ./run.sh test2
- - name: Build Sample [shared-heap]
- run: |
- cd samples/shared-heap
- mkdir build && cd build
- cmake ..
- cmake --build . --config Debug --parallel 4
- ./shared_heap_test
- ./shared_heap_test --aot
|