Add CIs to release new version and publish binary files (#1648)

Add CIs to enable the release process of a new version of WAMR,
and build and publish the binary files when a version is released,
including iwasm, wamrc, lldb, vscode-extension and wamr-ide for
Ubuntu-20.04, Ubuntu-22.04 and MacOS.

And refine the CIs to test spec cases.
This commit is contained in:
Wenyong Huang 2022-10-28 13:55:41 +08:00 committed by GitHub
parent 77ff7daaf4
commit 84161fe084
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
28 changed files with 1936 additions and 608 deletions

View File

@ -0,0 +1,60 @@
#!/usr/bin/env python3
#
# Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
"""
Extract the latest release notes content from RELEASE_NOTES.md
"""
import argparse
import os
import sys
import traceback
def latest_content(release_notes_path):
"""
can't change the format of the original content
"""
content = ""
start_extract = False
with open(release_notes_path, encoding="utf-8") as f:
for line in f:
if line.startswith("## "):
if start_extract:
break
start_extract = True
continue
# hit a separated line
if line.startswith("---"):
break
content += line
content += os.linesep
return content
def main():
"""
GO!GO!!GO!!!
"""
parser = argparse.ArgumentParser(description="run the sample and examine outputs")
parser.add_argument("release_notes_path", type=str)
args = parser.parse_args()
ret = 1
try:
print(latest_content(args.release_notes_path))
ret = 0
except AssertionError:
traceback.print_exc()
return ret
if __name__ == "__main__":
sys.exit(main())

View File

@ -0,0 +1,123 @@
#!/usr/bin/env python3
#
# Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
import re
import shlex
import subprocess
import sys
def fetch_version_from_code():
"""
search the semantic version definition in build-scripts/config_common.cmake
"""
major, minor, patch = "", "", ""
with open("core/version.h", encoding="utf-8") as f:
for line in f:
if "WAMR_VERSION" not in line:
continue
major_match = re.search(r"WAMR_VERSION_MAJOR (\d+)", line)
if major_match is not None:
major = major_match.groups()[0]
continue
minor_match = re.search(r"WAMR_VERSION_MINOR (\d+)", line)
if minor_match is not None:
minor = minor_match.groups()[0]
continue
patch_match = re.search(r"WAMR_VERSION_PATCH (\d+)", line)
if patch_match is not None:
patch = patch_match.groups()[0]
if len(major) == 0 or len(minor) == 0 or len(patch) == 0:
raise Exception(
"can't find the semantic version definition likes WAMR_VERSION_*"
)
return f"WAMR-{major}.{minor}.{patch}"
def fetch_latest_git_tag():
list_tag_cmd = (
'git tag --list WAMR-*.*.* --sort=committerdate --format="%(refname:short)"'
)
p = subprocess.run(shlex.split(list_tag_cmd), capture_output=True, check=True)
all_tags = p.stdout.decode().strip()
latest_tag = all_tags.split("\n")[-1]
return latest_tag
def match_version_pattern(v):
pattern = r"WAMR-\d+\.\d+\.\d+"
m = re.match(pattern, v)
return m is not None
def split_version_string(v):
"""
return the semantic version as an integer list
"""
pattern = r"WAMR-(\d+)\.(\d+)\.(\d+)"
m = re.match(pattern, v)
return [int(x) for x in m.groups()]
def compare_version_string(v1, v2):
"""
return value:
- 1. if v1 > v2
- -1. if v1 < v2
- 0. if v1 == v2
"""
if not match_version_pattern(v1):
raise Exception(f"{v1} doesn't match the version pattern")
if not match_version_pattern(v2):
raise Exception(f"{v2} doesn't match the version pattern")
v1_sem_ver = split_version_string(v1)
v2_sem_ver = split_version_string(v2)
return 0 if v1_sem_ver == v2_sem_ver else (1 if v1_sem_ver > v2_sem_ver else -1)
def is_major_or_minor_changed(v1, v2):
"""
return true if change either major of v2 or minor of v2
return false or else
"""
if not match_version_pattern(v1):
raise Exception(f"{v1} doesn't match the version pattern")
if not match_version_pattern(v2):
raise Exception(f"{v2} doesn't match the version pattern")
v1_major, v1_minor, _ = split_version_string(v1)
v2_major, v2_minor, _ = split_version_string(v2)
return v2_major != v1_major or v2_minor != v1_minor
def next_version():
definition = fetch_version_from_code()
tag = fetch_latest_git_tag()
new_version = ""
minor_changed = False
if compare_version_string(definition, tag) == 1:
new_version = definition.split("-")[-1]
if is_major_or_minor_changed(tag, definition):
minor_changed = True
return new_version, "major_minor_change" if minor_changed else "patch_change"
if __name__ == "__main__":
print(f"{next_version()[0]},{next_version()[1]}")
sys.exit(0)

View File

@ -0,0 +1,102 @@
#!/usr/bin/env python3
#
# Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
import argparse
import json
import os
import shlex
import subprocess
import sys
from urllib.error import HTTPError, URLError
import urllib.request
def get_last_commit(target_path, cwd):
last_commit_cmd = f"git log -n 1 --pretty=format:%H -- {target_path}"
p = subprocess.run(
shlex.split(last_commit_cmd), capture_output=True, check=True, cwd=cwd
)
return p.stdout.decode().strip()
def fetch_git_tags():
list_tag_cmd = (
'git tag --list WAMR-*.*.* --sort=committerdate --format="%(refname:short)"'
)
p = subprocess.run(shlex.split(list_tag_cmd), capture_output=True, check=True)
all_tags = p.stdout.decode().strip()
return all_tags.split("\n")
def download_binaries(binary_name_stem, cwd):
"""
1. find the latest release name
2. form assets download url:
"""
try:
all_tags = fetch_git_tags()
# *release_process.yml* will create a tag and release at first
second_last_tag = all_tags[-2]
latest_tag = all_tags[-1]
latest_url = "https://api.github.com/repos/bytecodealliance/wasm-micro-runtime/releases/latest"
print(f"::notice::query the latest release with {latest_url}...")
with urllib.request.urlopen(latest_url) as response:
body = response.read()
release_name = json.loads(body)["name"]
# WAMR-X.Y.Z -> X.Y.Z
second_last_sem_ver = second_last_tag[5:]
latest_sem_ver = latest_tag[5:]
assert latest_sem_ver in binary_name_stem
name_stem_in_release = binary_name_stem.replace(
latest_sem_ver, second_last_sem_ver
)
# download and rename
for file_ext in (".zip", ".tar.gz"):
assets_url = f"https://github.com/bytecodealliance/wasm-micro-runtime/releases/download/{release_name}/{name_stem_in_release}{file_ext}"
local_path = f"{binary_name_stem}{file_ext}"
print(f"::notice::download from {assets_url} and save as {local_path}...")
urllib.request.urlretrieve(assets_url, local_path)
return True
except HTTPError as error:
print(error.status, error.reason)
except URLError as error:
print(error.reason)
except TimeoutError:
print("Request timeout")
return False
def main():
parser = argparse.ArgumentParser(
description="Reuse binaries of the latest release if no more modification on the_path since last_commit"
)
parser.add_argument("working_directory", type=str)
parser.add_argument("--binary_name_stem", type=str)
parser.add_argument("--last_commit", type=str)
parser.add_argument("--the_path", type=str)
args = parser.parse_args()
last_commit = get_last_commit(args.the_path, args.working_directory)
if last_commit == args.last_commit:
return download_binaries(args.binary_name_stem, args.working_directory)
else:
return False
if __name__ == "__main__":
# use output to indicate results
# echo "result=${result}" >> "$GITHUB_OUTPUT"
with open(os.environ.get("GITHUB_OUTPUT"), 'a') as output_file:
output_file.write("result=hit\n" if main() else "result=not-hit\n")
# always return 0
sys.exit(0)

View File

@ -0,0 +1,48 @@
# Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
name: Create and publish Docker images
on:
workflow_call:
inputs:
ver_num:
description: a semantic version number.
type: string
required: true
jobs:
build-and-push-images:
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Downcase github actor
id: downcase_github_actor
uses: ASzc/change-string-case-action@v2
with:
string: ${{ github.actor }}
- name: Login to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ steps.downcase_github_actor.outputs.lowercase }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image(wasm-toolchain:${{ inputs.ver_num }}) to Container registry
run: |
docker build -t ghcr.io/${{ steps.downcase_github_actor.outputs.lowercase }}/wasm-toolchain:${{ inputs.ver_num }} .
docker push ghcr.io/${{ steps.downcase_github_actor.outputs.lowercase }}/wasm-toolchain:${{ inputs.ver_num }}
working-directory: test-tools/wamr-ide/WASM-Toolchain/Docker
- name: Build and push Docker image(wasm-debug-server:${{ inputs.ver_num }}) to Container registry
run: |
docker build -t ghcr.io/${{ steps.downcase_github_actor.outputs.lowercase }}/wasm-debug-server:${{ inputs.ver_num }} .
docker push ghcr.io/${{ steps.downcase_github_actor.outputs.lowercase }}/wasm-debug-server:${{ inputs.ver_num }}
working-directory: test-tools/wamr-ide/WASM-Debug-Server/Docker

View File

@ -0,0 +1,90 @@
# Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
name: build iwasm release
on:
workflow_call:
inputs:
arch:
description: arch of the release
type: string
required: false
default: x86_64
cwd:
description: workfing directory
type: string
required: true
runner:
description: OS of compilation
type: string
required: true
upload_url:
description: a semantic version number. it is required when `release` is true.
type: string
required: false
ver_num:
description: a semantic version number. it is required when `release` is true.
type: string
required: false
jobs:
build:
runs-on: ${{ inputs.runner }}
steps:
- uses: actions/checkout@v3
- name: generate iwasm binary release
run: |
cmake -S . -B build \
-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_JIT=0 \
-DWAMR_BUILD_CUSTOM_NAME_SECTION=0 \
-DWAMR_BUILD_DEBUG_INTERP=0 \
-DWAMR_BUILD_DEBUG_AOT=0 \
-DWAMR_BUILD_DUMP_CALL_STACK=0 \
-DWAMR_BUILD_LIBC_UVWASI=0 \
-DWAMR_BUILD_LIBC_EMCC=0 \
-DWAMR_BUILD_LIB_RATS=0 \
-DWAMR_BUILD_LOAD_CUSTOM_SECTION=0 \
-DWAMR_BUILD_MEMORY_PROFILING=0 \
-DWAMR_BUILD_MINI_LOADER=0 \
-DWAMR_BUILD_MULTI_MODULE=0 \
-DWAMR_BUILD_PERF_PROFILING=0 \
-DWAMR_BUILD_SPEC_TEST=0 \
-DWAMR_BUILD_BULK_MEMORY=1 \
-DWAMR_BUILD_LIB_PTHREAD=1 \
-DWAMR_BUILD_LIB_PTHREAD_SEMAPHORE=1 \
-DWAMR_BUILD_LIBC_BUILTIN=1 \
-DWAMR_BUILD_LIBC_WASI=1 \
-DWAMR_BUILD_REF_TYPES=1 \
-DWAMR_BUILD_SIMD=1 \
-DWAMR_BUILD_SHARED_MEMORY=1 \
-DWAMR_BUILD_TAIL_CALL=1 \
-DWAMR_BUILD_THREAD_MGR=1
cmake --build build --config Release --parallel 4
working-directory: ${{ inputs.cwd }}
- name: compress the binary
run: |
tar czf iwasm-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz iwasm
zip iwasm-${{ inputs.ver_num }}-${{ inputs.runner }}.zip iwasm
working-directory: ${{ inputs.cwd }}/build
- name: upload release tar.gz
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ inputs.upload_url }}
asset_path: ${{ inputs.cwd }}/build/iwasm-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz
asset_name: iwasm-${{ inputs.ver_num }}-${{ inputs.arch }}-${{ inputs.runner }}.tar.gz
asset_content_type: application/x-gzip
- name: upload release zip
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ inputs.upload_url }}
asset_path: ${{ inputs.cwd }}/build/iwasm-${{ inputs.ver_num }}-${{ inputs.runner }}.zip
asset_name: iwasm-${{ inputs.ver_num }}-${{ inputs.arch }}-${{ inputs.runner }}.zip
asset_content_type: application/zip

View File

@ -0,0 +1,39 @@
# Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
name: Reusable workflow-build_llvm_libraries
on:
workflow_call:
inputs:
runs-on:
required: true
type: string
jobs:
build_llvm_libraries:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ${{ fromJson(inputs.runs-on) }}
steps:
- name: checkout
uses: actions/checkout@v3
- name: Cache 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: ${{ matrix.os }}-build-llvm_libraries_ex
- name: Build llvm
id: build_llvm
if: ${{ steps.cache_llvm.outputs.cache-hit != 'true' }}
run: /usr/bin/env python3 ./build_llvm.py --arch X86 WebAssembly
working-directory: build-scripts

181
.github/workflows/build_wamr_lldb.yml vendored Normal file
View File

@ -0,0 +1,181 @@
# Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
name: build wamr lldb
on:
workflow_call:
inputs:
arch:
description: arch of the release
type: string
required: false
default: x86_64
runner:
description: OS of compilation
type: string
required: true
upload_url:
description: upload binary assets to the URL of release
type: string
required: true
ver_num:
description: a semantic version number
type: string
required: true
jobs:
try_reuse:
uses: ./.github/workflows/reuse_latest_release_binaries.yml
with:
binary_name_stem: "wamr-lldb-${{ inputs.ver_num }}-${{ inputs.arch }}-${{ inputs.runner }}"
last_commit: "ea63ba4bd010c2285623ad4acc0262a4d63bcfea"
the_path: "./build-scripts/lldb-wasm.patch"
upload_url: ${{ inputs.upload_url }}
build:
needs: try_reuse
if: needs.try_reuse.outputs.result != 'hit'
runs-on: ${{ inputs.runner }}
steps:
- uses: actions/checkout@v3
- name: Cache build
id: lldb_build_cache
uses: actions/cache@v3
with:
path: |
./core/deps/llvm-project/build/bin
./core/deps/llvm-project/build/include
./core/deps/llvm-project/build/lib
./core/deps/llvm-project/build/libexec
./core/deps/llvm-project/build/share
./core/deps/llvm-project/lldb/tools/
./core/deps/llvm-project/inst/
key: ${{inputs.arch}}-${{ inputs.runner }}-lldb_build
- name: setup xcode macos
if: steps.lldb_build_cache.outputs.cache-hit != 'true' && contains(inputs.runner, 'macos')
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
# Remove xCode command line tools, to prevent duplicate symbol compilation failures
- name: install utils macos
if: steps.lldb_build_cache.outputs.cache-hit != 'true' && contains(inputs.runner, 'macos')
run: |
brew install swig cmake ninja libedit
sudo rm -rf /Library/Developer/CommandLineTools
- name: intsall utils ubuntu
if: steps.lldb_build_cache.outputs.cache-hit != 'true' && contains(inputs.runner, 'ubuntu')
run: sudo apt update && sudo apt-get install -y lld ninja-build
# `git clone` takes ~7m
- name: download llvm
if: steps.lldb_build_cache.outputs.cache-hit != 'true'
run: |
wget https://github.com/llvm/llvm-project/archive/1f27fe6128769f00197925c3b8f6abb9d0e5cd2e.zip
unzip -q 1f27fe6128769f00197925c3b8f6abb9d0e5cd2e.zip
mv llvm-project-1f27fe6128769f00197925c3b8f6abb9d0e5cd2e llvm-project
working-directory: core/deps/
- name: apply wamr patch
if: steps.lldb_build_cache.outputs.cache-hit != 'true'
run: |
git init
git config user.email "action@github.com"
git config user.name "github action"
git apply ../../../build-scripts/lldb-wasm.patch
working-directory: core/deps/llvm-project
- name: build lldb ubuntu
if: steps.lldb_build_cache.outputs.cache-hit != 'true' && contains(inputs.runner, 'ubuntu')
run: |
echo "start to build lldb..."
mkdir -p inst
cmake -S ./llvm -B build \
-G Ninja \
-DCMAKE_INSTALL_PREFIX=../inst \
-DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang;lldb" \
-DLLVM_TARGETS_TO_BUILD=X86 \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DLLVM_BUILD_BENCHMARKS:BOOL=OFF \
-DLLVM_BUILD_DOCS:BOOL=OFF -DLLVM_BUILD_EXAMPLES:BOOL=OFF \
-DLLVM_BUILD_LLVM_DYLIB:BOOL=OFF -DLLVM_BUILD_TESTS:BOOL=OFF \
-DLLVM_ENABLE_BINDINGS:BOOL=OFF -DLLVM_INCLUDE_BENCHMARKS:BOOL=OFF \
-DLLVM_INCLUDE_DOCS:BOOL=OFF -DLLVM_INCLUDE_EXAMPLES:BOOL=OFF \
-DLLVM_INCLUDE_TESTS:BOOL=OFF -DLLVM_ENABLE_LLD:BOOL=ON
cmake --build build --target lldb install --parallel $(nproc)
working-directory: core/deps/llvm-project
- name: build lldb macos
if: steps.lldb_build_cache.outputs.cache-hit != 'true' && contains(inputs.runner, 'macos')
run: |
echo "start to build lldb..."
mkdir -p inst
cmake -S ./llvm -B build \
-G Ninja \
-DCMAKE_INSTALL_PREFIX=../inst \
-DCMAKE_BUILD_TYPE:STRING="Release" \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DLLVM_ENABLE_PROJECTS="clang;lldb" \
-DLLVM_INCLUDE_TESTS:BOOL=OFF \
-DLLVM_INCLUDE_EXAMPLES:BOOL=OFF \
-DLLVM_BUILD_BENCHMARKS:BOOL=OFF \
-DLLVM_BUILD_DOCS:BOOL=OFF \
-DLLVM_BUILD_LLVM_DYLIB:BOOL=OFF \
-DLLVM_ENABLE_BINDINGS:BOOL=OFF \
-DLLVM_TARGETS_TO_BUILD:STRING="X86;WebAssembly" \
-DLLVM_ENABLE_LIBXML2:BOOL=ON \
-DLLDB_ENABLE_PYTHON:BOOL=OFF \
-DLLDB_BUILD_FRAMEWORK:BOOL=OFF
cmake --build build --target lldb install --parallel $(nproc)
working-directory: core/deps/llvm-project
- name: pack a distribution
if: steps.lldb_build_cache.outputs.cache-hit != 'true'
run: |
mkdir -p inst/bin
mkdir -p inst/lib
cp build/bin/lldb* inst/bin
cp lldb/tools/lldb-vscode/package.json inst
cp -r lldb/tools/lldb-vscode/syntaxes/ inst
working-directory: core/deps/llvm-project
- name: pack ubuntu specific libraries
if: steps.lldb_build_cache.outputs.cache-hit != 'true' && contains(inputs.runner, 'ubuntu')
run: |
cp build/lib/liblldb*.so inst/lib
cp build/lib/liblldb*.so.* inst/lib
working-directory: core/deps/llvm-project
- name: pack macos specific libraries
if: steps.lldb_build_cache.outputs.cache-hit != 'true' && contains(inputs.runner, 'macos')
run: |
cp build/lib/liblldb*.dylib inst/lib
working-directory: core/deps/llvm-project
- name: compress the binary
run: |
tar czf wamr-lldb-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz inst
zip -r wamr-lldb-${{ inputs.ver_num }}-${{ inputs.runner }}.zip inst
working-directory: core/deps/llvm-project
- name: upload release tar.gz
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ inputs.upload_url }}
asset_path: core/deps/llvm-project/wamr-lldb-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz
asset_name: wamr-lldb-${{ inputs.ver_num }}-${{ inputs.arch }}-${{ inputs.runner }}.tar.gz
asset_content_type: application/x-gzip
- name: upload release zip
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ inputs.upload_url }}
asset_path: core/deps/llvm-project/wamr-lldb-${{ inputs.ver_num }}-${{ inputs.runner }}.zip
asset_name: wamr-lldb-${{ inputs.ver_num }}-${{ inputs.arch }}-${{ inputs.runner }}.zip
asset_content_type: application/zip

78
.github/workflows/build_wamr_sdk.yml vendored Normal file
View File

@ -0,0 +1,78 @@
# Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
name: build wamr-sdk
on:
workflow_call:
inputs:
arch:
description: arch of the release
type: string
required: false
default: x86_64
config_file:
description: warm-sdk config file path
type: string
required: true
runner:
description: OS of compilation
type: string
required: true
upload_url:
description: upload binary assets to the URL of release
type: string
required: true
ver_num:
description: a semantic version number
type: string
required: true
wasi_sdk_url:
description: download WASI_SDK from this URL
type: string
required: true
jobs:
build:
runs-on: ${{ inputs.runner }}
steps:
- uses: actions/checkout@v3
- name: download and install wasi-sdk
run: |
cd /opt
basename=$(basename ${{ inputs.wasi_sdk_url }})
sudo wget --progress=dot:giga ${{ inputs.wasi_sdk_url }}
sudo tar -xzf ${basename}
sudo rm ${basename}
sudo mv wasi-sdk-* wasi-sdk
- name: generate wamr-sdk release
run: |
./build_sdk.sh -n wamr-sdk -x $(pwd)/${{ inputs.config_file }}
working-directory: wamr-sdk
- name: compress the binary
run: |
tar czf wamr-sdk-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz wamr-sdk
zip -r wamr-sdk-${{ inputs.ver_num }}-${{ inputs.runner }}.zip wamr-sdk
working-directory: wamr-sdk/out
- name: upload release tar.gz
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ inputs.upload_url }}
asset_path: wamr-sdk/out/wamr-sdk-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz
asset_name: wamr-sdk-${{ inputs.ver_num }}-${{ inputs.arch }}-${{ inputs.runner }}.tar.gz
asset_content_type: application/x-gzip
- name: upload release zip
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ inputs.upload_url }}
asset_path: wamr-sdk/out/wamr-sdk-${{ inputs.ver_num }}-${{ inputs.runner }}.zip
asset_name: wamr-sdk-${{ inputs.ver_num }}-${{ inputs.arch }}-${{ inputs.runner }}.zip
asset_content_type: application/zip

View File

@ -0,0 +1,66 @@
# Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
name: build wamr-ide vscode extension
on:
workflow_call:
inputs:
upload_url:
description: upload binary assets to the URL of release
type: string
required: true
ver_num:
description: a semantic version number.
type: string
required: true
jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Use Node.js 14.x
uses: actions/setup-node@v3
with:
node-version: 14.x
- name: set vscode extension to correct version
run: |
npm install -g json
json -I -f package.json -e "this.version=\"${{ inputs.ver_num }}\""
working-directory: test-tools/wamr-ide/VSCode-Extension
- name: generate wamr ide vscode extension
run: |
npm install -g vsce
rm -rf node_modules
npm install
vsce package
working-directory: test-tools/wamr-ide/VSCode-Extension
- name: compress the vscode extension
run: |
tar czf wamr_ide-${{ inputs.ver_num }}.tar.gz wamride-*.vsix
zip wamr_ide-${{ inputs.ver_num }}.zip wamride-*.vsix
working-directory: test-tools/wamr-ide/VSCode-Extension
- name: upload release tar.gz
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ inputs.upload_url }}
asset_path: test-tools/wamr-ide/VSCode-Extension/wamr_ide-${{ inputs.ver_num }}.tar.gz
asset_name: wamr_ide-${{ inputs.ver_num }}.tar.gz
asset_content_type: application/x-gzip
- name: upload release zip
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ inputs.upload_url }}
asset_path: test-tools/wamr-ide/VSCode-Extension/wamr_ide-${{ inputs.ver_num }}.zip
asset_name: wamr_ide-${{ inputs.ver_num }}.zip
asset_content_type: application/zip

90
.github/workflows/build_wamrc.yml vendored Normal file
View File

@ -0,0 +1,90 @@
# Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
name: build wamrc
on:
workflow_call:
inputs:
arch:
description: arch of the release
type: string
required: false
default: x86_64
llvm_cache_key:
description: the cache key of llvm libraries
type: string
required: true
release:
description: it is a part of the release process
type: boolean
required: true
runner:
description: OS of compilation
type: string
required: true
upload_url:
description: a semantic version number. it is required when `release` is true.
type: string
required: false
ver_num:
description: a semantic version number. it is required when `release` is true.
type: string
required: false
jobs:
build:
runs-on: ${{ inputs.runner }}
steps:
- uses: actions/checkout@v3
- name: get cached 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: ${{ inputs.llvm_cache_key }}
- name: Build llvm and clang from source
if: steps.cache_llvm.outputs.cache-hit != 'true'
run: /usr/bin/env python3 ./build_llvm.py --arch X86
working-directory: build-scripts
- name: generate wamrc binary release
run: |
cmake -S . -B build
cmake --build build --config Release --parallel 4
working-directory: wamr-compiler
- name: compress the binary
if: inputs.release
run: |
tar czf wamrc-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz wamrc
zip wamrc-${{ inputs.ver_num }}-${{ inputs.runner }}.zip wamrc
working-directory: wamr-compiler/build
- name: upload release tar.gz
if: inputs.release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ inputs.upload_url }}
asset_path: wamr-compiler/build/wamrc-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz
asset_name: wamrc-${{ inputs.ver_num }}-${{ inputs.arch }}-${{ inputs.runner }}.tar.gz
asset_content_type: application/x-gzip
- name: upload release zip
if: inputs.release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ inputs.upload_url }}
asset_path: wamr-compiler/build/wamrc-${{ inputs.ver_num }}-${{ inputs.runner }}.zip
asset_name: wamrc-${{ inputs.ver_num }}-${{ inputs.arch }}-${{ inputs.runner }}.zip
asset_content_type: application/zip

View File

@ -15,18 +15,7 @@ concurrency:
cancel-in-progress: true cancel-in-progress: true
jobs: jobs:
# Cancel any in-flight jobs for the same PR/branch so there's only one active
# at a time
cancel_previous:
runs-on: ubuntu-latest
steps:
- name: Cancel Workflow Action
uses: styfle/cancel-workflow-action@0.9.1
with:
access_token: ${{ github.token }}
complinace_job: complinace_job:
needs: cancel_previous
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: checkout - name: checkout

View File

@ -6,20 +6,36 @@ name: compilation on android, ubuntu-20.04, ubuntu-22.04
on: on:
# will be triggered on PR events # will be triggered on PR events
pull_request: pull_request:
paths-ignore: types:
- "assembly-script/**" - opened
- "ci/**" - synchronize
- "doc/**" paths:
- "test-tools/**" - ".github/**"
- ".github/workflows/compilation_on_android_ubuntu.yml" - "build-scripts/**"
- "core/**"
- "!core/deps/**"
- "product-mini/**"
- "samples/**"
- "!samples/workload/**"
- "tests/wamr-test-suites/**"
- "wamr-compiler/**"
- "wamr-sdk/**"
# will be triggered on push events # will be triggered on push events
push: push:
paths-ignore: branches:
- "assembly-script/**" - main
- "ci/**" - "dev/**"
- "doc/**" paths:
- "test-tools/**" - ".github/**"
- ".github/workflows/compilation_on_android_ubuntu.yml" - "build-scripts/**"
- "core/**"
- "!core/deps/**"
- "product-mini/**"
- "samples/**"
- "!samples/workload/**"
- "tests/wamr-test-suites/**"
- "wamr-compiler/**"
- "wamr-sdk/**"
# allow to be triggered manually # allow to be triggered manually
workflow_dispatch: workflow_dispatch:
@ -34,8 +50,8 @@ 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" 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" 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" 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"
LLVM_EAGER_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_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" LLVM_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"
LLVM_EAGER_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
LLVM_CACHE_SUFFIX: "build-llvm_libraries_ex" LLVM_CACHE_SUFFIX: "build-llvm_libraries_ex"
# For Spec Test # For Spec Test
@ -46,112 +62,23 @@ env:
X86_32_TARGET_TEST_OPTIONS: "-m x86_32 -P" X86_32_TARGET_TEST_OPTIONS: "-m x86_32 -P"
jobs: 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: [ubuntu-20.04, ubuntu-22.04]
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
# 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-20.04, ubuntu-22.04]
outputs:
traffic_light_on_ubuntu_2004: ${{ steps.do_check_on_ubuntu_2004.outputs.light }}
traffic_light_on_ubuntu_2204: ${{ steps.do_check_on_ubuntu_2204.outputs.light }}
steps:
- name: do_check_on_ubuntu_2004
id: do_check_on_ubuntu_2004
if: ${{ matrix.os == 'ubuntu-20.04' }}
run: |
if [[ ${{ github.repository }} == */wasm-micro-runtime ]]; then
echo "::set-output name=light::green"
else
echo "::set-output name=light::red"
fi
- name: do_check_on_ubuntu_2204
id: do_check_on_ubuntu_2204
if: ${{ matrix.os == 'ubuntu-22.04' }}
run: |
if [[ ${{ github.repository }} == */wasm-micro-runtime ]]; then
echo "::set-output name=light::green"
else
echo "::set-output name=light::green"
fi
build_llvm_libraries: build_llvm_libraries:
needs: check_repo uses: ./.github/workflows/build_llvm_libraries.yml
runs-on: ${{ matrix.os }} with:
strategy: runs-on: "['ubuntu-20.04', 'ubuntu-22.04']"
matrix:
os: [ubuntu-20.04, ubuntu-22.04]
include:
- os: ubuntu-20.04
light: ${{ needs.check_repo.outputs.traffic_light_on_ubuntu_2004 }}
- os: ubuntu-22.04
light: ${{ needs.check_repo.outputs.traffic_light_on_ubuntu_2204 }}
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 --project clang lldb
working-directory: build-scripts
build_wamrc: build_wamrc:
needs: [build_llvm_libraries, check_repo] needs: [build_llvm_libraries]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
os: [ubuntu-20.04, ubuntu-22.04] os: [ubuntu-20.04, ubuntu-22.04]
include:
- os: ubuntu-20.04
light: ${{ needs.check_repo.outputs.traffic_light_on_ubuntu_2004 }}
- os: ubuntu-22.04
light: ${{ needs.check_repo.outputs.traffic_light_on_ubuntu_2204 }}
steps: steps:
- name: light status
run: echo "matrix.os=${{ matrix.os }}, light=${{ matrix.light }}"
- name: checkout - name: checkout
if: ${{ matrix.light == 'green' }}
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Get LLVM libraries - name: Get LLVM libraries
id: cache_llvm id: cache_llvm
if: ${{ matrix.light == 'green' }}
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
path: | path: |
@ -163,11 +90,10 @@ jobs:
key: ${{ matrix.os }}-${{ env.LLVM_CACHE_SUFFIX }} key: ${{ matrix.os }}-${{ env.LLVM_CACHE_SUFFIX }}
- name: Quit if cache miss - name: Quit if cache miss
if: ${{ matrix.light == 'green' && steps.cache_llvm.outputs.cache-hit != 'true' }} if: steps.cache_llvm.outputs.cache-hit != 'true'
run: echo "::error::can not get prebuilt llvm libraries" && exit 1 run: echo "::error::can not get prebuilt llvm libraries" && exit 1
- name: Build wamrc - name: Build wamrc
if: ${{ matrix.light == 'green' }}
run: | run: |
mkdir build && cd build mkdir build && cd build
cmake .. cmake ..
@ -175,7 +101,7 @@ jobs:
working-directory: wamr-compiler working-directory: wamr-compiler
build_iwasm: build_iwasm:
needs: [build_llvm_libraries, check_repo] needs: [build_llvm_libraries]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
@ -184,8 +110,8 @@ jobs:
$AOT_BUILD_OPTIONS, $AOT_BUILD_OPTIONS,
$CLASSIC_INTERP_BUILD_OPTIONS, $CLASSIC_INTERP_BUILD_OPTIONS,
$FAST_INTERP_BUILD_OPTIONS, $FAST_INTERP_BUILD_OPTIONS,
$LLVM_EAGER_JIT_BUILD_OPTIONS,
$LLVM_LAZY_JIT_BUILD_OPTIONS, $LLVM_LAZY_JIT_BUILD_OPTIONS,
$LLVM_EAGER_JIT_BUILD_OPTIONS,
] ]
make_options_feature: [ make_options_feature: [
# Features # Features
@ -210,10 +136,10 @@ jobs:
# uncompatiable feature and platform # uncompatiable feature and platform
# uncompatiable mode and feature # uncompatiable mode and feature
# MULTI_MODULE only on INTERP mode # MULTI_MODULE only on INTERP mode
- make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
- make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS - make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1" 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"
- make_options_run_mode: $AOT_BUILD_OPTIONS - make_options_run_mode: $AOT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1" make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
# SIMD only on JIT/AOT mode # SIMD only on JIT/AOT mode
@ -224,10 +150,10 @@ jobs:
# DEBUG_INTERP only on CLASSIC INTERP mode # DEBUG_INTERP only on CLASSIC INTERP mode
- make_options_run_mode: $AOT_BUILD_OPTIONS - make_options_run_mode: $AOT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1" 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: $LLVM_LAZY_JIT_BUILD_OPTIONS - make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1" 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_run_mode: $FAST_INTERP_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1" make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
# DEBUG_AOT only on JIT/AOT mode # DEBUG_AOT only on JIT/AOT mode
@ -236,34 +162,25 @@ jobs:
- make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1" make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
# TODO: DEBUG_AOT on JIT # TODO: DEBUG_AOT on JIT
- make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
- make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS - make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1" 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 # MINI_LOADER only on INTERP mode
- make_options_run_mode: $AOT_BUILD_OPTIONS - make_options_run_mode: $AOT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1" 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"
- make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS - make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1" make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
include: - make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
- os: ubuntu-20.04 make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
light: ${{ needs.check_repo.outputs.traffic_light_on_ubuntu_2004 }}
- os: ubuntu-22.04
light: ${{ needs.check_repo.outputs.traffic_light_on_ubuntu_2204 }}
steps: steps:
- name: light status
run: echo "matrix.os=${{ matrix.os }}, light=${{ matrix.light }}"
- name: checkout - name: checkout
if: ${{ matrix.light == 'green' }}
uses: actions/checkout@v3 uses: actions/checkout@v3
# only download llvm cache when needed # only download llvm cache when needed
- name: Get LLVM libraries - name: Get LLVM libraries
id: cache_llvm id: cache_llvm
if: (matrix.light == 'green') && (endsWith(matrix.make_options_run_mode, '_JIT_BUILD_OPTIONS')) if: endsWith(matrix.make_options_run_mode, '_JIT_BUILD_OPTIONS')
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
path: | path: |
@ -275,11 +192,10 @@ jobs:
key: ${{ matrix.os }}-${{ env.LLVM_CACHE_SUFFIX }} key: ${{ matrix.os }}-${{ env.LLVM_CACHE_SUFFIX }}
- name: Quit if cache miss - 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') if: 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 run: echo "::error::can not get prebuilt llvm libraries" && exit 1
- name: Build iwasm - name: Build iwasm
if: ${{ matrix.light == 'green' }}
run: | run: |
mkdir build && cd build mkdir build && cd build
cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }} cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }}
@ -287,39 +203,34 @@ jobs:
working-directory: product-mini/platforms/${{ matrix.platform }} working-directory: product-mini/platforms/${{ matrix.platform }}
build_samples_wasm_c_api: build_samples_wasm_c_api:
needs: [build_iwasm, build_llvm_libraries, build_wamrc, check_repo] needs: [build_iwasm, build_llvm_libraries, build_wamrc]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
make_options: [ make_options: [
# Running mode # Running mode
$AOT_BUILD_OPTIONS,
$CLASSIC_INTERP_BUILD_OPTIONS, $CLASSIC_INTERP_BUILD_OPTIONS,
$FAST_INTERP_BUILD_OPTIONS, $FAST_INTERP_BUILD_OPTIONS,
$LLVM_EAGER_JIT_BUILD_OPTIONS,
$LLVM_LAZY_JIT_BUILD_OPTIONS, $LLVM_LAZY_JIT_BUILD_OPTIONS,
$LLVM_EAGER_JIT_BUILD_OPTIONS,
$AOT_BUILD_OPTIONS,
] ]
os: [ubuntu-20.04, ubuntu-22.04] os: [ubuntu-20.04, ubuntu-22.04]
include: wasi_sdk_release:
- os: ubuntu-20.04 [
light: ${{ needs.check_repo.outputs.traffic_light_on_ubuntu_2004 }} "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-linux.tar.gz",
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 wabt_release:
- os: ubuntu-22.04 [
light: ${{ needs.check_repo.outputs.traffic_light_on_ubuntu_2204 }} "https://github.com/WebAssembly/wabt/releases/download/1.0.24/wabt-1.0.24-ubuntu.tar.gz",
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
steps: steps:
- name: light status
run: echo "matrix.os=${{ matrix.os }}, light=${{ matrix.light }}"
- name: checkout - name: checkout
if: ${{ matrix.light == 'green' }}
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Get LLVM libraries - name: Get LLVM libraries
id: cache_llvm id: cache_llvm
if: (matrix.light == 'green') && (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS')) if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS'))
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
path: | path: |
@ -331,11 +242,10 @@ jobs:
key: ${{ matrix.os }}-${{ env.LLVM_CACHE_SUFFIX }} key: ${{ matrix.os }}-${{ env.LLVM_CACHE_SUFFIX }}
- name: Quit if cache miss - name: Quit if cache miss
if: (matrix.light == 'green') && (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS')) && (steps.cache_llvm.outputs.cache-hit != 'true') if: (!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 run: echo "::error::can not get prebuilt llvm libraries" && exit 1
- name: download and install wabt - name: download and install wabt
if: ${{ matrix.light == 'green' }}
run: | run: |
cd /opt cd /opt
sudo wget ${{ matrix.wabt_release }} sudo wget ${{ matrix.wabt_release }}
@ -343,7 +253,7 @@ jobs:
sudo mv wabt-1.0.24 wabt sudo mv wabt-1.0.24 wabt
- name: Build wamrc - name: Build wamrc
if: (matrix.light == 'green') && (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS')) if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS'))
run: | run: |
mkdir build && cd build mkdir build && cd build
cmake .. cmake ..
@ -351,7 +261,6 @@ jobs:
working-directory: wamr-compiler working-directory: wamr-compiler
- name: Build Sample [wasm-c-api] - name: Build Sample [wasm-c-api]
if: ${{ matrix.light == 'green' }}
run: | run: |
mkdir build && cd build mkdir build && cd build
cmake .. ${{ matrix.make_options }} cmake .. ${{ matrix.make_options }}
@ -369,29 +278,24 @@ jobs:
working-directory: samples/wasm-c-api working-directory: samples/wasm-c-api
build_samples_others: build_samples_others:
needs: [build_iwasm, check_repo] needs: [build_iwasm]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
include: os: [ubuntu-20.04, ubuntu-22.04]
- os: ubuntu-20.04 wasi_sdk_release:
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 "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: ubuntu-22.04 wabt_release:
light: ${{ needs.check_repo.outputs.traffic_light_on_ubuntu_2204 }} [
wasi_sdk_release: https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-linux.tar.gz "https://github.com/WebAssembly/wabt/releases/download/1.0.24/wabt-1.0.24-ubuntu.tar.gz",
wabt_release: https://github.com/WebAssembly/wabt/releases/download/1.0.24/wabt-1.0.24-ubuntu.tar.gz ]
steps: steps:
- name: light status
run: echo "matrix.os=${{ matrix.os }}, light=${{ matrix.light }}"
- name: checkout - name: checkout
if: ${{ matrix.light == 'green' }}
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: download and install wasi-sdk - name: download and install wasi-sdk
if: ${{ matrix.light == 'green' }}
run: | run: |
cd /opt cd /opt
sudo wget ${{ matrix.wasi_sdk_release }} sudo wget ${{ matrix.wasi_sdk_release }}
@ -399,7 +303,6 @@ jobs:
sudo mv wasi-sdk-12.0 wasi-sdk sudo mv wasi-sdk-12.0 wasi-sdk
- name: download and install wabt - name: download and install wabt
if: ${{ matrix.light == 'green' }}
run: | run: |
cd /opt cd /opt
sudo wget ${{ matrix.wabt_release }} sudo wget ${{ matrix.wabt_release }}
@ -407,14 +310,12 @@ jobs:
sudo mv wabt-1.0.24 wabt sudo mv wabt-1.0.24 wabt
- name: Build Sample [basic] - name: Build Sample [basic]
if: ${{ matrix.light == 'green' }}
run: | run: |
cd samples/basic cd samples/basic
./build.sh ./build.sh
./run.sh ./run.sh
- name: Build Sample [file] - name: Build Sample [file]
if: ${{ matrix.light == 'green' }}
run: | run: |
cd samples/file cd samples/file
mkdir build && cd build mkdir build && cd build
@ -423,7 +324,6 @@ jobs:
./src/iwasm -f wasm-app/file.wasm -d . ./src/iwasm -f wasm-app/file.wasm -d .
- name: Build Sample [multi-thread] - name: Build Sample [multi-thread]
if: ${{ matrix.light == 'green' }}
run: | run: |
cd samples/multi-thread cd samples/multi-thread
mkdir build && cd build mkdir build && cd build
@ -432,7 +332,6 @@ jobs:
./iwasm wasm-apps/test.wasm ./iwasm wasm-apps/test.wasm
- name: Build Sample [multi-module] - name: Build Sample [multi-module]
if: ${{ matrix.light == 'green' }}
run: | run: |
cd samples/multi-module cd samples/multi-module
mkdir build && cd build mkdir build && cd build
@ -441,7 +340,6 @@ jobs:
./multi_module ./multi_module
- name: Build Sample [spawn-thread] - name: Build Sample [spawn-thread]
if: ${{ matrix.light == 'green' }}
run: | run: |
cd samples/spawn-thread cd samples/spawn-thread
mkdir build && cd build mkdir build && cd build
@ -450,7 +348,6 @@ jobs:
./spawn_thread ./spawn_thread
- name: Build Sample [ref-types] - name: Build Sample [ref-types]
if: ${{ matrix.light == 'green' }}
run: | run: |
cd samples/ref-types cd samples/ref-types
mkdir build && cd build mkdir build && cd build
@ -458,57 +355,63 @@ jobs:
cmake --build . --config Release --parallel 4 cmake --build . --config Release --parallel 4
./hello ./hello
spec_test_default: - name: Build Sample [simple]
needs: [build_iwasm, build_llvm_libraries, build_wamrc, check_repo] run: |
./build.sh -p host-interp
python3 ./sample_test_run.py $(pwd)/out
exit $?
working-directory: ./samples/simple
spec_test:
needs: [build_iwasm, build_llvm_libraries, build_wamrc]
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
strategy: strategy:
matrix: matrix:
test_option: [$DEFAULT_TEST_OPTIONS] running_mode:
steps: ["classic-interp", "fast-interp", "jit", "aot", "fast-jit"]
- 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:
running_mode: ["classic-interp", "fast-interp", "jit", "aot"]
test_option: test_option:
[ [
$DEFAULT_TEST_OPTIONS,
$MULTI_MODULES_TEST_OPTIONS, $MULTI_MODULES_TEST_OPTIONS,
$SIMD_TEST_OPTIONS, $SIMD_TEST_OPTIONS,
$THREADS_TEST_OPTIONS, $THREADS_TEST_OPTIONS,
] ]
exclude:
# uncompatiable modes and features
# classic-interp and fast-interp don't support simd
- running_mode: "classic-interp"
test_option: $SIMD_TEST_OPTIONS
- running_mode: "fast-interp"
test_option: $SIMD_TEST_OPTIONS
# aot and jit don't support multi module
- running_mode: "aot"
test_option: $MULTI_MODULES_TEST_OPTIONS
- running_mode: "jit"
test_option: $MULTI_MODULES_TEST_OPTIONS
# fast-jit is only tested on default mode, exclude other three
- running_mode: "fast-jit"
test_option: $MULTI_MODULES_TEST_OPTIONS
- running_mode: "fast-jit"
test_option: $SIMD_TEST_OPTIONS
- running_mode: "fast-jit"
test_option: $THREADS_TEST_OPTIONS
steps: steps:
- name: checkout - name: checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: set env variable(if llvm are used)
if: matrix.running_mode == 'aot' || matrix.running_mode == 'jit'
run: echo "USE_LLVM=true" >> $GITHUB_ENV
- name: set env variable(if x86_32 test needed)
if: >
(matrix.test_option == '$DEFAULT_TEST_OPTIONS' || matrix.test_option == '$THREADS_TEST_OPTIONS')
&& matrix.running_mode != 'fast-jit' && matrix.running_mode != 'jit'
run: echo "TEST_ON_X86_32=true" >> $GITHUB_ENV
#only download llvm libraries in jit and aot mode
- name: Get LLVM libraries - name: Get LLVM libraries
if: env.USE_LLVM == 'true'
id: cache_llvm id: cache_llvm
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
@ -521,53 +424,28 @@ jobs:
key: ubuntu-20.04-${{ env.LLVM_CACHE_SUFFIX }} key: ubuntu-20.04-${{ env.LLVM_CACHE_SUFFIX }}
- name: Quit if cache miss - name: Quit if cache miss
if: steps.cache_llvm.outputs.cache-hit != 'true' if: env.USE_LLVM == 'true' && steps.cache_llvm.outputs.cache-hit != 'true'
run: echo "::error::can not get prebuilt llvm libraries" && exit 1 run: echo "::error::can not get prebuilt llvm libraries" && exit 1
- name: install Ninja - name: install Ninja
run: sudo apt install -y ninja-build run: sudo apt install -y ninja-build
- name: run spec tests - name: run spec tests default and extra
run: ./test_wamr.sh ${{ matrix.test_option }} -t ${{ matrix.running_mode }} run: ./test_wamr.sh ${{ matrix.test_option }} -t ${{ matrix.running_mode }}
working-directory: ./tests/wamr-test-suites working-directory: ./tests/wamr-test-suites
spec_test_x86_32: #only install x32 support libraries when to run x86_32 cases
if: ${{ endsWith(github.repository, 'wasm-micro-runtime') }} - name: install x32 support libraries
needs: [build_iwasm, build_llvm_libraries, build_wamrc, check_repo] if: env.TEST_ON_X86_32 == 'true'
runs-on: ubuntu-20.04
strategy:
matrix:
running_mode: ["classic-interp", "fast-interp", "jit", "aot"]
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: run:
# Add another apt repository as some packages cannot # Add another apt repository as some packages cannot
# be downloaded with the github default repository # 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 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-add-repository https://packages.microsoft.com/ubuntu/20.04/prod &&
sudo apt-get update && sudo apt-get update &&
sudo apt install -y g++-multilib lib32gcc-9-dev ninja-build sudo apt install -y g++-multilib lib32gcc-9-dev
- name: run spec tests - name: run spec tests x86_32
if: env.TEST_ON_X86_32 == 'true'
run: ./test_wamr.sh ${{ env.X86_32_TARGET_TEST_OPTIONS }} ${{ matrix.test_option }} -t ${{ matrix.running_mode }} run: ./test_wamr.sh ${{ env.X86_32_TARGET_TEST_OPTIONS }} ${{ matrix.test_option }} -t ${{ matrix.running_mode }}
working-directory: ./tests/wamr-test-suites working-directory: ./tests/wamr-test-suites

View File

@ -6,20 +6,36 @@ name: compilation on macos-latest
on: on:
# will be triggered on PR events # will be triggered on PR events
pull_request: pull_request:
paths-ignore: types:
- "assembly-script/**" - opened
- "ci/**" - synchronize
- "doc/**" paths:
- "test-tools/**" - ".github/**"
- ".github/workflows/compilation_on_macos.yml" - "build-scripts/**"
- "core/**"
- "!core/deps/**"
- "product-mini/**"
- "samples/**"
- "!samples/workload/**"
- "tests/wamr-test-suites/**"
- "wamr-compiler/**"
- "wamr-sdk/**"
# will be triggered on push events # will be triggered on push events
push: push:
paths-ignore: branches:
- "assembly-script/**" - main
- "ci/**" - "dev/**"
- "doc/**" paths:
- "test-tools/**" - ".github/**"
- ".github/workflows/compilation_on_macos.yml" - "build-scripts/**"
- "core/**"
- "!core/deps/**"
- "product-mini/**"
- "samples/**"
- "!samples/workload/**"
- "tests/wamr-test-suites/**"
- "wamr-compiler/**"
- "wamr-sdk/**"
# allow to be triggered manually # allow to be triggered manually
workflow_dispatch: workflow_dispatch:
@ -30,106 +46,31 @@ concurrency:
cancel-in-progress: true cancel-in-progress: true
env: 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" 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" 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" 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"
LLVM_EAGER_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_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" LLVM_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"
# LLVM LLVM_EAGER_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" LLVM_CACHE_SUFFIX: "build-llvm_libraries_ex"
jobs: 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: build_llvm_libraries:
needs: check_repo uses: ./.github/workflows/build_llvm_libraries.yml
runs-on: ${{ matrix.os }} with:
strategy: runs-on: "['macos-latest']"
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: build_wamrc:
needs: [build_llvm_libraries, check_repo] needs: [build_llvm_libraries]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
os: [macos-latest] os: [macos-latest]
include:
- os: macos-latest
light: ${{ needs.check_repo.outputs.traffic_light }}
steps: steps:
- name: light status
run: echo "matrix.os=${{ matrix.os }}, light=${{ matrix.light }}"
- name: checkout - name: checkout
if: ${{ matrix.light == 'green' }}
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Get LLVM libraries - name: Get LLVM libraries
id: cache_llvm id: cache_llvm
if: ${{ matrix.light == 'green' }}
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
path: | path: |
@ -141,11 +82,10 @@ jobs:
key: ${{ matrix.os }}-${{ env.LLVM_CACHE_SUFFIX }} key: ${{ matrix.os }}-${{ env.LLVM_CACHE_SUFFIX }}
- name: Quit if cache miss - name: Quit if cache miss
if: ${{ matrix.light == 'green' && steps.cache_llvm.outputs.cache-hit != 'true' }} if: steps.cache_llvm.outputs.cache-hit != 'true'
run: echo "::error::can not get prebuilt llvm libraries" && exit 1 run: echo "::error::can not get prebuilt llvm libraries" && exit 1
- name: Build wamrc - name: Build wamrc
if: ${{ matrix.light == 'green' }}
run: | run: |
mkdir build && cd build mkdir build && cd build
cmake .. cmake ..
@ -153,7 +93,7 @@ jobs:
working-directory: wamr-compiler working-directory: wamr-compiler
build_iwasm: build_iwasm:
needs: [build_llvm_libraries, check_repo] needs: [build_llvm_libraries]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
@ -162,8 +102,8 @@ jobs:
$AOT_BUILD_OPTIONS, $AOT_BUILD_OPTIONS,
$CLASSIC_INTERP_BUILD_OPTIONS, $CLASSIC_INTERP_BUILD_OPTIONS,
$FAST_INTERP_BUILD_OPTIONS, $FAST_INTERP_BUILD_OPTIONS,
$LLVM_EAGER_JIT_BUILD_OPTIONS,
$LLVM_LAZY_JIT_BUILD_OPTIONS, $LLVM_LAZY_JIT_BUILD_OPTIONS,
$LLVM_EAGER_JIT_BUILD_OPTIONS,
] ]
make_options_feature: [ make_options_feature: [
# Features # Features
@ -189,10 +129,10 @@ jobs:
# uncompatiable feature and platform # uncompatiable feature and platform
# uncompatiable mode and feature # uncompatiable mode and feature
# MULTI_MODULE only on INTERP mode # MULTI_MODULE only on INTERP mode
- make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
- make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS - make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1" 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"
- make_options_run_mode: $AOT_BUILD_OPTIONS - make_options_run_mode: $AOT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1" make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
# SIMD only on JIT/AOT mode # SIMD only on JIT/AOT mode
@ -203,10 +143,10 @@ jobs:
# DEBUG_INTERP only on CLASSIC INTERP mode # DEBUG_INTERP only on CLASSIC INTERP mode
- make_options_run_mode: $AOT_BUILD_OPTIONS - make_options_run_mode: $AOT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1" 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: $LLVM_LAZY_JIT_BUILD_OPTIONS - make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1" 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_run_mode: $FAST_INTERP_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1" make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
# DEBUG_AOT only on JIT/AOT mode # DEBUG_AOT only on JIT/AOT mode
@ -215,32 +155,25 @@ jobs:
- make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS - make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1" make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
# TODO: DEBUG_AOT on JIT # TODO: DEBUG_AOT on JIT
- make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
- make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS - make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1" 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 # MINI_LOADER only on INTERP mode
- make_options_run_mode: $AOT_BUILD_OPTIONS - make_options_run_mode: $AOT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1" 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"
- make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS - make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1" make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
include: - make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
- os: macos-latest make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
light: ${{ needs.check_repo.outputs.traffic_light }}
steps: steps:
- name: light status
run: echo "matrix.os=${{ matrix.os }}, light=${{ matrix.light }}"
- name: checkout - name: checkout
if: ${{ matrix.light == 'green' }}
uses: actions/checkout@v3 uses: actions/checkout@v3
# only download llvm cache when needed # only download llvm cache when needed
- name: Get LLVM libraries - name: Get LLVM libraries
id: cache_llvm id: cache_llvm
if: (matrix.light == 'green') && (endsWith(matrix.make_options_run_mode, '_JIT_BUILD_OPTIONS')) if: endsWith(matrix.make_options_run_mode, '_JIT_BUILD_OPTIONS')
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
path: | path: |
@ -252,11 +185,10 @@ jobs:
key: ${{ matrix.os }}-${{ env.LLVM_CACHE_SUFFIX }} key: ${{ matrix.os }}-${{ env.LLVM_CACHE_SUFFIX }}
- name: Quit if cache miss - 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') if: 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 run: echo "::error::can not get prebuilt llvm libraries" && exit 1
- name: Build iwasm - name: Build iwasm
if: ${{ matrix.light == 'green' }}
run: | run: |
mkdir build && cd build mkdir build && cd build
cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }} cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }}
@ -264,35 +196,27 @@ jobs:
working-directory: product-mini/platforms/${{ matrix.platform }} working-directory: product-mini/platforms/${{ matrix.platform }}
build_samples_wasm_c_api: build_samples_wasm_c_api:
needs: [build_iwasm, check_repo] needs: [build_iwasm]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
make_options: [ make_options: [
# Running mode # Running modes supported
$CLASSIC_INTERP_BUILD_OPTIONS, $CLASSIC_INTERP_BUILD_OPTIONS,
$FAST_INTERP_BUILD_OPTIONS, $FAST_INTERP_BUILD_OPTIONS,
# doesn't support # Running modes unsupported
#$AOT_BUILD_OPTIONS,
#$LLVM_EAGER_JIT_BUILD_OPTIONS,
#$LLVM_LAZY_JIT_BUILD_OPTIONS, #$LLVM_LAZY_JIT_BUILD_OPTIONS,
#$LLVM_EAGER_JIT_BUILD_OPTIONS,
#$AOT_BUILD_OPTIONS,
] ]
os: [macos-latest] os: [macos-latest]
include: wasi_sdk_release: ["https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-macos.tar.gz"]
- os: macos-latest wabt_release: ["https://github.com/WebAssembly/wabt/releases/download/1.0.24/wabt-1.0.24-macos.tar.gz"]
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: steps:
- name: light status
run: echo "matrix.os=${{ matrix.os }}, light=${{ matrix.light }}"
- name: checkout - name: checkout
if: ${{ matrix.light == 'green' }}
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: download and install wabt - name: download and install wabt
if: ${{ matrix.light == 'green' }}
run: | run: |
cd /opt cd /opt
sudo wget ${{ matrix.wabt_release }} sudo wget ${{ matrix.wabt_release }}
@ -300,7 +224,6 @@ jobs:
sudo mv wabt-1.0.24 wabt sudo mv wabt-1.0.24 wabt
- name: Build Sample [wasm-c-api] - name: Build Sample [wasm-c-api]
if: ${{ matrix.light == 'green' }}
run: | run: |
mkdir build && cd build mkdir build && cd build
cmake .. ${{ matrix.make_options }} cmake .. ${{ matrix.make_options }}
@ -318,25 +241,18 @@ jobs:
working-directory: samples/wasm-c-api working-directory: samples/wasm-c-api
build_samples_others: build_samples_others:
needs: [build_iwasm, check_repo] needs: [build_iwasm]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
include: os: [macos-latest]
- os: macos-latest wasi_sdk_release: ["https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-macos.tar.gz"]
light: ${{ needs.check_repo.outputs.traffic_light }} wabt_release: ["https://github.com/WebAssembly/wabt/releases/download/1.0.24/wabt-1.0.24-macos.tar.gz"]
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: steps:
- name: light status
run: echo "matrix.os=${{ matrix.os }}, light=${{ matrix.light }}"
- name: checkout - name: checkout
if: ${{ matrix.light == 'green' }}
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: download and install wasi-sdk - name: download and install wasi-sdk
if: ${{ matrix.light == 'green' }}
run: | run: |
cd /opt cd /opt
sudo wget ${{ matrix.wasi_sdk_release }} sudo wget ${{ matrix.wasi_sdk_release }}
@ -344,7 +260,6 @@ jobs:
sudo mv wasi-sdk-12.0 wasi-sdk sudo mv wasi-sdk-12.0 wasi-sdk
- name: download and install wabt - name: download and install wabt
if: ${{ matrix.light == 'green' }}
run: | run: |
cd /opt cd /opt
sudo wget ${{ matrix.wabt_release }} sudo wget ${{ matrix.wabt_release }}
@ -352,14 +267,12 @@ jobs:
sudo mv wabt-1.0.24 wabt sudo mv wabt-1.0.24 wabt
- name: Build Sample [basic] - name: Build Sample [basic]
if: ${{ matrix.light == 'green' }}
run: | run: |
cd samples/basic cd samples/basic
./build.sh ./build.sh
./run.sh ./run.sh
- name: Build Sample [file] - name: Build Sample [file]
if: ${{ matrix.light == 'green' }}
run: | run: |
cd samples/file cd samples/file
mkdir build && cd build mkdir build && cd build
@ -368,7 +281,6 @@ jobs:
./src/iwasm -f wasm-app/file.wasm -d . ./src/iwasm -f wasm-app/file.wasm -d .
- name: Build Sample [multi-thread] - name: Build Sample [multi-thread]
if: ${{ matrix.light == 'green' }}
run: | run: |
cd samples/multi-thread cd samples/multi-thread
mkdir build && cd build mkdir build && cd build
@ -377,7 +289,6 @@ jobs:
./iwasm wasm-apps/test.wasm ./iwasm wasm-apps/test.wasm
- name: Build Sample [multi-module] - name: Build Sample [multi-module]
if: ${{ matrix.light == 'green' }}
run: | run: |
cd samples/multi-module cd samples/multi-module
mkdir build && cd build mkdir build && cd build
@ -386,7 +297,6 @@ jobs:
./multi_module ./multi_module
- name: Build Sample [spawn-thread] - name: Build Sample [spawn-thread]
if: ${{ matrix.light == 'green' }}
run: | run: |
cd samples/spawn-thread cd samples/spawn-thread
mkdir build && cd build mkdir build && cd build
@ -395,7 +305,6 @@ jobs:
./spawn_thread ./spawn_thread
- name: Build Sample [ref-types] - name: Build Sample [ref-types]
if: ${{ matrix.light == 'green' }}
run: | run: |
cd samples/ref-types cd samples/ref-types
mkdir build && cd build mkdir build && cd build

View File

@ -6,18 +6,36 @@ name: compilation on nuttx
on: on:
# will be triggered on PR events # will be triggered on PR events
pull_request: pull_request:
paths-ignore: types:
- "assembly-script/**" - opened
- "ci/**" - synchronize
- "doc/**" paths:
- "test-tools/**" - ".github/**"
- "build-scripts/**"
- "core/**"
- "!core/deps/**"
- "product-mini/**"
- "samples/**"
- "!samples/workload/**"
- "tests/wamr-test-suites/**"
- "wamr-compiler/**"
- "wamr-sdk/**"
# will be triggered on push events # will be triggered on push events
push: push:
paths-ignore: branches:
- "assembly-script/**" - main
- "ci/**" - "dev/**"
- "doc/**" paths:
- "test-tools/**" - ".github/**"
- "build-scripts/**"
- "core/**"
- "!core/deps/**"
- "product-mini/**"
- "samples/**"
- "!samples/workload/**"
- "tests/wamr-test-suites/**"
- "wamr-compiler/**"
- "wamr-sdk/**"
# allow to be triggered manually # allow to be triggered manually
workflow_dispatch: workflow_dispatch:
@ -28,21 +46,11 @@ concurrency:
cancel-in-progress: true cancel-in-progress: true
jobs: jobs:
# Cancel any in-flight jobs for the same PR/branch so there's only one active
# at a time
cancel_previous:
runs-on: ubuntu-22.04
steps:
- name: Cancel Workflow Action
uses: styfle/cancel-workflow-action@0.9.1
with:
access_token: ${{ github.token }}
build_iwasm_on_nuttx: build_iwasm_on_nuttx:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
strategy: strategy:
matrix: matrix:
nuttx_board_config : [ nuttx_board_config: [
# x64 # x64
"boards/sim/sim/sim/configs/nsh", "boards/sim/sim/sim/configs/nsh",
# cortex-m0 # cortex-m0
@ -72,17 +80,17 @@ jobs:
steps: steps:
- name: Install Utilities - name: Install Utilities
run: | run: |
sudo apt install -y kconfig-frontends-nox genromfs sudo apt install -y kconfig-frontends-nox genromfs
pip3 install pyelftools pip3 install pyelftools
pip3 install cxxfilt pip3 install cxxfilt
- name: Install ARM Compilers - name: Install ARM Compilers
if: ${{ contains(matrix.nuttx_board_config, 'arm') }} if: contains(matrix.nuttx_board_config, 'arm')
run: sudo apt install -y gcc-arm-none-eabi run: sudo apt install -y gcc-arm-none-eabi
- name: Install RISC-V Compilers - name: Install RISC-V Compilers
if: ${{ contains(matrix.nuttx_board_config, 'risc-v') }} if: contains(matrix.nuttx_board_config, 'risc-v')
run: sudo apt install -y gcc-riscv64-unknown-elf run: sudo apt install -y gcc-riscv64-unknown-elf
- name: Checkout NuttX - name: Checkout NuttX
@ -104,7 +112,7 @@ jobs:
path: apps/interpreters/wamr/wamr path: apps/interpreters/wamr/wamr
- name: Enable WAMR for NuttX - name: Enable WAMR for NuttX
run: | run: |
find nuttx/boards -name defconfig | xargs sed -i '$a\CONFIG_EOL_IS_CR=y\n${{ matrix.wamr_config_option }}' find nuttx/boards -name defconfig | xargs sed -i '$a\CONFIG_EOL_IS_CR=y\n${{ matrix.wamr_config_option }}'
find nuttx/boards/sim -name defconfig | xargs sed -i '$a\CONFIG_LIBM=y\n' find nuttx/boards/sim -name defconfig | xargs sed -i '$a\CONFIG_LIBM=y\n'
find nuttx/boards/risc-v -name defconfig | xargs sed -i '$a\CONFIG_LIBM=y\n' find nuttx/boards/risc-v -name defconfig | xargs sed -i '$a\CONFIG_LIBM=y\n'

View File

@ -6,20 +6,36 @@ name: compilation on SGX
on: on:
# will be triggered on PR events # will be triggered on PR events
pull_request: pull_request:
paths-ignore: types:
- "assembly-script/**" - opened
- "ci/**" - synchronize
- "doc/**" paths:
- "test-tools/**" - ".github/**"
- ".github/workflows/compilation_on_sgx.yml" - "build-scripts/**"
- "core/**"
- "!core/deps/**"
- "product-mini/**"
- "samples/**"
- "!samples/workload/**"
- "tests/wamr-test-suites/**"
- "wamr-compiler/**"
- "wamr-sdk/**"
# will be triggered on push events # will be triggered on push events
push: push:
paths-ignore: branches:
- "assembly-script/**" - main
- "ci/**" - "dev/**"
- "doc/**" paths:
- "test-tools/**" - ".github/**"
- ".github/workflows/compilation_on_sgx.yml" - "build-scripts/**"
- "core/**"
- "!core/deps/**"
- "product-mini/**"
- "samples/**"
- "!samples/workload/**"
- "tests/wamr-test-suites/**"
- "wamr-compiler/**"
- "wamr-sdk/**"
# allow to be triggered manually # allow to be triggered manually
workflow_dispatch: workflow_dispatch:
@ -30,99 +46,31 @@ concurrency:
cancel-in-progress: true cancel-in-progress: true
env: 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" 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" 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" 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"
LLVM_EAGER_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_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" LLVM_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"
# LLVM LLVM_EAGER_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" LLVM_CACHE_SUFFIX: "build-llvm_libraries_ex"
jobs: 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: [ubuntu-20.04]
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: [ubuntu-20.04]
outputs:
traffic_light_on_ubuntu_2004: ${{ steps.do_check_on_ubuntu_2004.outputs.light }}
steps:
- name: do_check_on_ubuntu_2004
id: do_check_on_ubuntu_2004
if: ${{ matrix.os == 'ubuntu-20.04' }}
run: |
if [[ ${{ github.repository }} == */wasm-micro-runtime ]]; then
echo "::set-output name=light::green"
else
echo "::set-output name=light::green"
fi
build_llvm_libraries: build_llvm_libraries:
needs: check_repo uses: ./.github/workflows/build_llvm_libraries.yml
runs-on: ${{ matrix.os }} with:
strategy: runs-on: "['ubuntu-20.04']"
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: 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 --project clang lldb
working-directory: build-scripts
build_iwasm: build_iwasm:
needs: [check_repo]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
make_options_run_mode: [ make_options_run_mode: [
# Running mode # Running modes supported
$AOT_BUILD_OPTIONS, $AOT_BUILD_OPTIONS,
$CLASSIC_INTERP_BUILD_OPTIONS, $CLASSIC_INTERP_BUILD_OPTIONS,
$FAST_INTERP_BUILD_OPTIONS, $FAST_INTERP_BUILD_OPTIONS,
# doesn't support # Running modes unsupported
#$LLVM_EAGER_JIT_BUILD_OPTIONS,
#$LLVM_LAZY_JIT_BUILD_OPTIONS, #$LLVM_LAZY_JIT_BUILD_OPTIONS,
#$LLVM_EAGER_JIT_BUILD_OPTIONS,
] ]
make_options_feature: [ make_options_feature: [
# Features # Features
@ -154,15 +102,8 @@ jobs:
# MINI_LOADER only on INTERP mode # MINI_LOADER only on INTERP mode
- make_options_run_mode: $AOT_BUILD_OPTIONS - make_options_run_mode: $AOT_BUILD_OPTIONS
make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1" make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
include:
- os: ubuntu-20.04
light: ${{ needs.check_repo.outputs.traffic_light_on_ubuntu_2004 }}
steps: steps:
- name: light status
run: echo "matrix.os=${{ matrix.os }}, light=${{ matrix.light }}"
- name: install SGX SDK and necessary libraries - name: install SGX SDK and necessary libraries
if: ${{ matrix.light == 'green' }}
run: | run: |
mkdir -p /opt/intel mkdir -p /opt/intel
cd /opt/intel cd /opt/intel
@ -176,11 +117,9 @@ jobs:
source /opt/intel/sgxsdk/environment source /opt/intel/sgxsdk/environment
- name: checkout - name: checkout
if: ${{ matrix.light == 'green' }}
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Build iwasm - name: Build iwasm
if: ${{ matrix.light == 'green' }}
run: | run: |
mkdir build && cd build mkdir build && cd build
cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }} cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }}
@ -188,20 +127,13 @@ jobs:
working-directory: product-mini/platforms/${{ matrix.platform }} working-directory: product-mini/platforms/${{ matrix.platform }}
build_wamrc: build_wamrc:
needs: [build_llvm_libraries, check_repo] needs: [build_llvm_libraries]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
os: [ubuntu-20.04] os: [ubuntu-20.04]
include:
- os: ubuntu-20.04
light: ${{ needs.check_repo.outputs.traffic_light_on_ubuntu_2004 }}
steps: steps:
- name: light status
run: echo "matrix.os=${{ matrix.os }}, light=${{ matrix.light }}"
- name: install SGX SDK and necessary libraries - name: install SGX SDK and necessary libraries
if: ${{ matrix.light == 'green' }}
run: | run: |
mkdir -p /opt/intel mkdir -p /opt/intel
cd /opt/intel cd /opt/intel
@ -215,12 +147,10 @@ jobs:
source /opt/intel/sgxsdk/environment source /opt/intel/sgxsdk/environment
- name: checkout - name: checkout
if: ${{ matrix.light == 'green' }}
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Get LLVM libraries - name: Get LLVM libraries
id: cache_llvm id: cache_llvm
if: ${{ matrix.light == 'green' }}
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
path: | path: |
@ -232,11 +162,10 @@ jobs:
key: ${{ matrix.os }}-${{ env.LLVM_CACHE_SUFFIX }} key: ${{ matrix.os }}-${{ env.LLVM_CACHE_SUFFIX }}
- name: Quit if cache miss - name: Quit if cache miss
if: ${{ matrix.light == 'green' && steps.cache_llvm.outputs.cache-hit != 'true' }} if: steps.cache_llvm.outputs.cache-hit != 'true'
run: echo "::error::can not get prebuilt llvm libraries" && exit 1 run: echo "::error::can not get prebuilt llvm libraries" && exit 1
- name: Build wamrc - name: Build wamrc
if: ${{ matrix.light == 'green' }}
run: | run: |
mkdir build && cd build mkdir build && cd build
cmake .. cmake ..
@ -244,35 +173,27 @@ jobs:
working-directory: wamr-compiler working-directory: wamr-compiler
build_samples_wasm_c_api: build_samples_wasm_c_api:
needs: [build_iwasm, check_repo] needs: [build_iwasm]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
make_options: [ make_options: [
# Running mode # Running modes supported
$CLASSIC_INTERP_BUILD_OPTIONS, $CLASSIC_INTERP_BUILD_OPTIONS,
$FAST_INTERP_BUILD_OPTIONS, $FAST_INTERP_BUILD_OPTIONS,
# doesn't support # Running modes unsupported
#$AOT_BUILD_OPTIONS,
#$LLVM_EAGER_JIT_BUILD_OPTIONS, #$LLVM_EAGER_JIT_BUILD_OPTIONS,
#$LLVM_LAZY_JIT_BUILD_OPTIONS, #$LLVM_LAZY_JIT_BUILD_OPTIONS,
#$AOT_BUILD_OPTIONS,
] ]
os: [ubuntu-20.04] os: [ubuntu-20.04]
include: wasi_sdk_release: ["https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-linux.tar.gz"]
- os: ubuntu-20.04 wabt_release: ["https://github.com/WebAssembly/wabt/releases/download/1.0.24/wabt-1.0.24-ubuntu.tar.gz"]
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
steps: steps:
- name: light status
run: echo "matrix.os=${{ matrix.os }}, light=${{ matrix.light }}"
- name: checkout - name: checkout
if: ${{ matrix.light == 'green' }}
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: download and install wabt - name: download and install wabt
if: ${{ matrix.light == 'green' }}
run: | run: |
cd /opt cd /opt
sudo wget ${{ matrix.wabt_release }} sudo wget ${{ matrix.wabt_release }}
@ -280,7 +201,6 @@ jobs:
sudo mv wabt-1.0.24 wabt sudo mv wabt-1.0.24 wabt
- name: install SGX SDK and necessary libraries - name: install SGX SDK and necessary libraries
if: ${{ matrix.light == 'green' }}
run: | run: |
mkdir -p /opt/intel mkdir -p /opt/intel
cd /opt/intel cd /opt/intel
@ -294,7 +214,6 @@ jobs:
source /opt/intel/sgxsdk/environment source /opt/intel/sgxsdk/environment
- name: Build Sample [wasm-c-api] - name: Build Sample [wasm-c-api]
if: ${{ matrix.light == 'green' }}
run: | run: |
mkdir build && cd build mkdir build && cd build
cmake .. ${{ matrix.make_options }} cmake .. ${{ matrix.make_options }}
@ -312,25 +231,18 @@ jobs:
working-directory: samples/wasm-c-api working-directory: samples/wasm-c-api
build_samples_others: build_samples_others:
needs: [build_iwasm, check_repo] needs: [build_iwasm]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
include: os: [ubuntu-20.04]
- os: ubuntu-20.04 wasi_sdk_release: ["https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-linux.tar.gz"]
light: ${{ needs.check_repo.outputs.traffic_light_on_ubuntu_2004 }} wabt_release: ["https://github.com/WebAssembly/wabt/releases/download/1.0.24/wabt-1.0.24-ubuntu.tar.gz"]
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
steps: steps:
- name: light status
run: echo "matrix.os=${{ matrix.os }}, light=${{ matrix.light }}"
- name: checkout - name: checkout
if: ${{ matrix.light == 'green' }}
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: download and install wasi-sdk - name: download and install wasi-sdk
if: ${{ matrix.light == 'green' }}
run: | run: |
cd /opt cd /opt
sudo wget ${{ matrix.wasi_sdk_release }} sudo wget ${{ matrix.wasi_sdk_release }}
@ -338,7 +250,6 @@ jobs:
sudo mv wasi-sdk-12.0 wasi-sdk sudo mv wasi-sdk-12.0 wasi-sdk
- name: download and install wabt - name: download and install wabt
if: ${{ matrix.light == 'green' }}
run: | run: |
cd /opt cd /opt
sudo wget ${{ matrix.wabt_release }} sudo wget ${{ matrix.wabt_release }}
@ -346,7 +257,6 @@ jobs:
sudo mv wabt-1.0.24 wabt sudo mv wabt-1.0.24 wabt
- name: install SGX SDK and necessary libraries - name: install SGX SDK and necessary libraries
if: ${{ matrix.light == 'green' }}
run: | run: |
mkdir -p /opt/intel mkdir -p /opt/intel
cd /opt/intel cd /opt/intel
@ -360,14 +270,12 @@ jobs:
source /opt/intel/sgxsdk/environment source /opt/intel/sgxsdk/environment
- name: Build Sample [basic] - name: Build Sample [basic]
if: ${{ matrix.light == 'green' }}
run: | run: |
cd samples/basic cd samples/basic
./build.sh ./build.sh
./run.sh ./run.sh
- name: Build Sample [file] - name: Build Sample [file]
if: ${{ matrix.light == 'green' }}
run: | run: |
cd samples/file cd samples/file
mkdir build && cd build mkdir build && cd build
@ -376,7 +284,6 @@ jobs:
./src/iwasm -f wasm-app/file.wasm -d . ./src/iwasm -f wasm-app/file.wasm -d .
- name: Build Sample [multi-thread] - name: Build Sample [multi-thread]
if: ${{ matrix.light == 'green' }}
run: | run: |
cd samples/multi-thread cd samples/multi-thread
mkdir build && cd build mkdir build && cd build
@ -385,7 +292,6 @@ jobs:
./iwasm wasm-apps/test.wasm ./iwasm wasm-apps/test.wasm
- name: Build Sample [multi-module] - name: Build Sample [multi-module]
if: ${{ matrix.light == 'green' }}
run: | run: |
cd samples/multi-module cd samples/multi-module
mkdir build && cd build mkdir build && cd build
@ -394,7 +300,6 @@ jobs:
./multi_module ./multi_module
- name: Build Sample [spawn-thread] - name: Build Sample [spawn-thread]
if: ${{ matrix.light == 'green' }}
run: | run: |
cd samples/spawn-thread cd samples/spawn-thread
mkdir build && cd build mkdir build && cd build
@ -403,7 +308,6 @@ jobs:
./spawn_thread ./spawn_thread
- name: Build Sample [ref-types] - name: Build Sample [ref-types]
if: ${{ matrix.light == 'green' }}
run: | run: |
cd samples/ref-types cd samples/ref-types
mkdir build && cd build mkdir build && cd build
@ -412,22 +316,25 @@ jobs:
./hello ./hello
spec_test_default: spec_test_default:
needs: [build_iwasm, build_llvm_libraries, build_wamrc, check_repo] needs: [build_iwasm, build_llvm_libraries, build_wamrc]
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
strategy: strategy:
matrix: matrix:
running_mode: ["classic-interp", "fast-interp", "aot"] running_mode: ["classic-interp", "fast-interp", "aot"]
test_option: ["-x -p -s spec -P", "-x -p -s spec -S -P"] test_option: ["-x -p -s spec -P", "-x -p -s spec -S -P"]
include: # classic-interp and fast-interp don't support simd
- os: ubuntu-20.04 exclude:
light: ${{ needs.check_repo.outputs.traffic_light_on_ubuntu_2004 }} - running_mode: "classic-interp"
test_option: "-x -p -s spec -S -P"
- running_mode: "fast-interp"
test_option: "-x -p -s spec -S -P"
steps: steps:
- name: checkout - name: checkout
if: ${{ matrix.light == 'green' }}
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Get LLVM libraries - name: Get LLVM libraries
if: ${{ matrix.light == 'green' }} if: matrix.running_mode == 'aot'
id: cache_llvm id: cache_llvm
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
@ -440,15 +347,13 @@ jobs:
key: ubuntu-20.04-${{ env.LLVM_CACHE_SUFFIX }} key: ubuntu-20.04-${{ env.LLVM_CACHE_SUFFIX }}
- name: Quit if cache miss - name: Quit if cache miss
if: ${{ matrix.light == 'green' && steps.cache_llvm.outputs.cache-hit != 'true' }} if: matrix.running_mode == 'aot' && steps.cache_llvm.outputs.cache-hit != 'true'
run: echo "::error::can not get prebuilt llvm libraries" && exit 1 run: echo "::error::can not get prebuilt llvm libraries" && exit 1
- name: install Ninja - name: install Ninja
if: ${{ matrix.light == 'green' }}
run: sudo apt install -y ninja-build run: sudo apt install -y ninja-build
- name: install SGX SDK and necessary libraries - name: install SGX SDK and necessary libraries
if: ${{ matrix.light == 'green' }}
run: | run: |
mkdir -p /opt/intel mkdir -p /opt/intel
cd /opt/intel cd /opt/intel
@ -461,7 +366,6 @@ jobs:
sudo apt install -y libsgx-launch libsgx-urts sudo apt install -y libsgx-launch libsgx-urts
- name: run spec tests - name: run spec tests
if: ${{ matrix.light == 'green' }}
run: | run: |
source /opt/intel/sgxsdk/environment source /opt/intel/sgxsdk/environment
./test_wamr.sh ${{ matrix.test_option }} -t ${{ matrix.running_mode }} ./test_wamr.sh ${{ matrix.test_option }} -t ${{ matrix.running_mode }}

View File

@ -6,20 +6,36 @@ name: compilation on windows-latest
on: on:
# will be triggered on PR events # will be triggered on PR events
pull_request: pull_request:
paths-ignore: types:
- "assembly-script/**" - opened
- "ci/**" - synchronize
- "doc/**" paths:
- "test-tools/**" - ".github/**"
- ".github/workflows/compilation_on_windows.yml" - "build-scripts/**"
- "core/**"
- "!core/deps/**"
- "product-mini/**"
- "samples/**"
- "!samples/workload/**"
- "tests/wamr-test-suites/**"
- "wamr-compiler/**"
- "wamr-sdk/**"
# will be triggered on push events # will be triggered on push events
push: push:
paths-ignore: branches:
- "assembly-script/**" - main
- "ci/**" - "dev/**"
- "doc/**" paths:
- "test-tools/**" - ".github/**"
- ".github/workflows/compilation_on_windows.yml" - "build-scripts/**"
- "core/**"
- "!core/deps/**"
- "product-mini/**"
- "samples/**"
- "!samples/workload/**"
- "tests/wamr-test-suites/**"
- "wamr-compiler/**"
- "wamr-sdk/**"
# allow to be triggered manually # allow to be triggered manually
workflow_dispatch: workflow_dispatch:
@ -30,18 +46,7 @@ concurrency:
cancel-in-progress: true cancel-in-progress: true
jobs: jobs:
# Cancel any in-flight jobs for the same PR/branch so there's only one active
# at a time
cancel_previous:
runs-on: windows-latest
steps:
- name: Cancel Workflow Action
uses: styfle/cancel-workflow-action@0.9.1
with:
access_token: ${{ github.token }}
build: build:
needs: cancel_previous
runs-on: windows-latest runs-on: windows-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3

68
.github/workflows/create_tag.yml vendored Normal file
View File

@ -0,0 +1,68 @@
# Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
name: create a tag
on:
workflow_call:
outputs:
minor_version:
description: "the new version is a minor version or a major version"
value: ${{ jobs.create_tag.outputs.minor_version}}
new_ver:
description: "the new version"
value: ${{ jobs.create_tag.outputs.new_ver}}
new_tag:
description: "the new tag just created"
value: ${{ jobs.create_tag.outputs.new_tag}}
jobs:
create_tag:
runs-on: ubuntu-latest
outputs:
minor_version: ${{ steps.preparation.outputs.minor_version }}
new_ver: ${{ steps.preparation.outputs.new_ver }}
new_tag: ${{ steps.preparation.outputs.new_tag }}
steps:
- uses: actions/checkout@v3
# Full git history is needed to get a proper list of commits and tags
with:
fetch-depth: 0
- name: prepare
id: preparation
run: |
# show latest 3 versions
git tag --list WAMR-*.*.* --sort=committerdate --format="%(refname:short)" | tail -n 3
# compare latest git tag and semantic version definition
result=$(python3 ./.github/scripts/fetch_and_compare_version.py)
echo "script result is ${result}"
#
# return in a form like "WAMR-X.Y.Z,major_minor_change" or ",patch_change"
new_ver=$(echo "${result}" | awk -F',' '{print $1}')
diff_versioning=$(echo "${result}" | awk -F',' '{print $2}')
echo "next version is ${new_ver}, it ${diff_versioning}"
#
# set output
if [[ ${diff_versioning} == 'major_minor_change' ]];then
echo "minor_version=true" >> "$GITHUB_OUTPUT"
else
echo "minor_version=false" >> "$GITHUB_OUTPUT"
fi
#
#
if [[ -z ${new_ver} ]]; then
echo "::error::please indicate the right semantic version in build-scripts/config_common.cmake"
echo "new_ver=''" >> "$GITHUB_OUTPUT"
echo "new_tag=''" >> "$GITHUB_OUTPUT"
exit 1
else
echo "new_ver=${new_ver}" >> "$GITHUB_OUTPUT"
echo "new_tag=WAMR-${new_ver}" >> "$GITHUB_OUTPUT"
fi
- name: push tag
if: steps.preparation.outputs.new_tag != ''
run: |
git tag ${{ steps.preparation.outputs.new_tag }}
git push origin --force --tags

193
.github/workflows/release_process.yml vendored Normal file
View File

@ -0,0 +1,193 @@
# Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
name: the binary release processes
on:
workflow_dispatch:
inputs:
require_confirmation:
description: "If the process requires a confirmation"
type: boolean
required: false
default: false
# 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
jobs:
create_tag:
uses: ./.github/workflows/create_tag.yml
create_release:
needs: [create_tag]
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- uses: actions/checkout@v3
- name: prepare the release note
run: |
extract_result="$(python3 ./.github/scripts/extract_from_release_notes.py RELEASE_NOTES.md)"
echo "RELEASE_NOTE<<EOF" >> $GITHUB_ENV
echo "${extract_result}" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: check output
run: echo 'the release note is "${{ env.RELEASE_NOTE }}"'
- name: create a release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ needs.create_tag.outputs.new_tag }}
release_name: ${{ needs.create_tag.outputs.new_tag }}
prerelease: ${{ inputs.require_confirmation || needs.create_tag.outputs.minor_version }}
draft: false
body: ${{ env.RELEASE_NOTE }}
#
# WAMRC
release_wamrc_on_ubuntu_2004:
needs: [create_tag, create_release]
uses: ./.github/workflows/build_wamrc.yml
with:
# can't take an env variable here
llvm_cache_key: ubuntu-20.04-build-llvm_libraries_ex
release: true
runner: ubuntu-20.04
upload_url: ${{ needs.create_release.outputs.upload_url }}
ver_num: ${{ needs.create_tag.outputs.new_ver}}
release_wamrc_on_ubuntu_2204:
needs: [create_tag, create_release]
uses: ./.github/workflows/build_wamrc.yml
with:
# can't take an env variable here
llvm_cache_key: ubuntu-22.04-build-llvm_libraries_ex
release: true
runner: ubuntu-22.04
upload_url: ${{ needs.create_release.outputs.upload_url }}
ver_num: ${{ needs.create_tag.outputs.new_ver }}
release_wamrc_on_ubuntu_macos:
needs: [create_tag, create_release]
uses: ./.github/workflows/build_wamrc.yml
with:
# can't take an env variable here
llvm_cache_key: macos-latest-build-llvm_libraries_ex
release: true
runner: macos-latest
upload_url: ${{ needs.create_release.outputs.upload_url }}
ver_num: ${{ needs.create_tag.outputs.new_ver }}
#
# IWASM
release_iwasm_on_ubuntu_2004:
needs: [create_tag, create_release]
uses: ./.github/workflows/build_iwasm_release.yml
with:
cwd: product-mini/platforms/linux
runner: ubuntu-20.04
upload_url: ${{ needs.create_release.outputs.upload_url }}
ver_num: ${{ needs.create_tag.outputs.new_ver}}
release_iwasm_on_ubuntu_2204:
needs: [create_tag, create_release]
uses: ./.github/workflows/build_iwasm_release.yml
with:
cwd: product-mini/platforms/linux
runner: ubuntu-22.04
upload_url: ${{ needs.create_release.outputs.upload_url }}
ver_num: ${{ needs.create_tag.outputs.new_ver}}
release_iwasm_on_macos:
needs: [create_tag, create_release]
uses: ./.github/workflows/build_iwasm_release.yml
with:
cwd: product-mini/platforms/darwin
runner: macos-latest
upload_url: ${{ needs.create_release.outputs.upload_url }}
ver_num: ${{ needs.create_tag.outputs.new_ver}}
#
# WAMR_SDK
release_wamr_sdk_on_ubuntu_2004:
needs: [create_tag, create_release]
uses: ./.github/workflows/build_wamr_sdk.yml
with:
config_file: wamr_config_ubuntu_release.cmake
runner: ubuntu-20.04
upload_url: ${{ needs.create_release.outputs.upload_url }}
ver_num: ${{ needs.create_tag.outputs.new_ver}}
wasi_sdk_url: https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-linux.tar.gz
release_wamr_sdk_on_ubuntu_2204:
needs: [create_tag, create_release]
uses: ./.github/workflows/build_wamr_sdk.yml
with:
config_file: wamr_config_ubuntu_release.cmake
runner: ubuntu-22.04
upload_url: ${{ needs.create_release.outputs.upload_url }}
ver_num: ${{ needs.create_tag.outputs.new_ver}}
wasi_sdk_url: https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-linux.tar.gz
release_wamr_sdk_on_macos:
needs: [create_tag, create_release]
uses: ./.github/workflows/build_wamr_sdk.yml
with:
config_file: wamr_config_macos_release.cmake
runner: macos-latest
upload_url: ${{ needs.create_release.outputs.upload_url }}
ver_num: ${{ needs.create_tag.outputs.new_ver}}
wasi_sdk_url: https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-macos.tar.gz
#
# vscode extension cross-platform
release_wamr_ide_vscode_ext:
needs: [create_tag, create_release]
uses: ./.github/workflows/build_wamr_vscode_ext.yml
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
ver_num: ${{ needs.create_tag.outputs.new_ver }}
#
# vscode extension docker images package
release_wamr_ide_docker_images_package:
needs: [create_tag, create_release]
uses: ./.github/workflows/build_docker_images.yml
with:
ver_num: ${{ needs.create_tag.outputs.new_ver }}
#
# WAMR_LLDB
release_wamr_lldb_on_ubuntu_2004:
needs: [create_tag, create_release]
uses: ./.github/workflows/build_wamr_lldb.yml
with:
runner: ubuntu-20.04
upload_url: ${{ needs.create_release.outputs.upload_url }}
ver_num: ${{ needs.create_tag.outputs.new_ver}}
release_wamr_lldb_on_ubuntu_2204:
needs: [create_tag, create_release]
uses: ./.github/workflows/build_wamr_lldb.yml
with:
runner: ubuntu-22.04
upload_url: ${{ needs.create_release.outputs.upload_url }}
ver_num: ${{ needs.create_tag.outputs.new_ver}}
release_wamr_lldb_on_macos_universal:
needs: [create_tag, create_release]
uses: ./.github/workflows/build_wamr_lldb.yml
with:
runner: macos-latest
arch: universal
upload_url: ${{ needs.create_release.outputs.upload_url }}
ver_num: ${{ needs.create_tag.outputs.new_ver}}

View File

@ -0,0 +1,68 @@
# Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
name: reuse binaries of the latest release if no more modification on the_path since last_commit
on:
workflow_call:
inputs:
binary_name_stem:
type: string
required: true
last_commit:
type: string
required: true
the_path:
type: string
required: true
upload_url:
description: upload binary assets to the URL of release
type: string
required: true
outputs:
result:
value: ${{ jobs.build.outputs.result }}
jobs:
reuse:
runs-on: ubuntu-latest
outputs:
result: ${{ steps.try_reuse.outputs.result }}
steps:
- uses: actions/checkout@v3
# Full git history is needed to get a proper list of commits and tags
with:
fetch-depth: 0
- name: try to reuse binaries
id: try_reuse
run: |
echo '::echo::on'
python3 ./.github/scripts/reuse_latest_release_binaries.py \
--binary_name_stem ${{ inputs.binary_name_stem }} \
--last_commit ${{ inputs.last_commit }} \
--the_path ${{ inputs.the_path }} .
ls -lh .
- run: echo ${{ steps.try_reuse.outputs.result }}
- name: upload release tar.gz
if: steps.try_reuse.outputs.result == 'hit'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ inputs.upload_url }}
asset_path: ${{ inputs.binary_name_stem }}.tar.gz
asset_name: ${{ inputs.binary_name_stem }}.tar.gz
asset_content_type: application/x-gzip
- name: upload release zip
if: steps.try_reuse.outputs.result == 'hit'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ inputs.upload_url }}
asset_path: ${{ inputs.binary_name_stem }}.zip
asset_name: ${{ inputs.binary_name_stem }}.zip
asset_content_type: application/zip

1
.gitignore vendored
View File

@ -8,6 +8,7 @@
*.obj *.obj
*.a *.a
*.so *.so
.DS_Store
core/deps/** core/deps/**
core/shared/mem-alloc/tlsf core/shared/mem-alloc/tlsf

118
RELEASE_NOTES.md Normal file
View File

@ -0,0 +1,118 @@
## WAMR-X.Y.Z
### Breaking Changes
### New Features
### Bug Fixes
### Enhancements
### Others
---
## WAMR-1.1.0
- Extend support for Socket API:
- Implement IPv6 (along with IPv4) for all the socket-related operations
- Enable resolving host name IP address by adding a host call to WASI
- Implement a security feature for controlling what domains are allowed to be resolved
- Allow configuring socket options by adding host calls to WASI for setting and reading the options
- Enable connection-less communication between hosts by adding host calls to WASI for sending
- data directly to a given address and receiving messages from a specific address
- Fix verification of the address in the address pool
- Add more samples and update the documents
- Implement SGX IPFS as POSIX backend for file interaction for linux-sgx
- Integrates the Intel SGX feature called Intel Protection File System Library (IPFS) into the runtime
to create, operate and delete files inside the enclave, while guaranteeing the confidentiality and
integrity of the data persisted
- Make libc-builtin buffered printf be a common feature
- Enable passing through arguments for build_llvm.sh
- Update \_\_wasi_sock_accept signature to match wasi_snapshot_preview1
- Enable build wasi_socket_ext.c with both clang and clang++
- Add check for code section size, fix interpreter float operations
- Prevent an already detached thread from being detached again for thread manager
- Fix several issues related to AOT debug and update source_debugging.md
- Fix Windows/MSVC build issues and compile warnings
- Fix wasm loader: function sub local count can be 0
- Fix crash in dumping call stack when the AOT file doesn't contain custom name section
- Fix Dockerfile lint errors and suppress hadolint warnings for pinning versions part
- Fix Fast JIT issues reported by instrument test
- Fix link error for ESP-IDF 4.4.2
- Fix syntax errors and undefined names in Python code
- Fix issues reported by Coverity
- Fix Go binding build error
- Fix a wrongly named parameter and enhance the docs in bh_hashmap.h
---
## WAMR-1.0.0
- Implement Python language binding
- Implement Go language binding
- Implement Fast JIT engine
- Implement hw bound check for interpreter and Fast JIT
- Enable the semantic version mechanism for WAMR
- Implement POSIX semaphore support for linux platform
- Implement SGX getrandom/getentropy without ocall
- Enable remote attestation by librats in SGX mode
- Upgrade WAMR-IDE and source debugging
- Support print exception info in source debugger
- Support emit specified custom sections into AoT file
- Refactor spec test script and CI workflows
- Support integrate 3rd-party toolchains into wamrc
- Enable dump call stack to a buffer
- Enable aot compiler with llvm-14/15
- Don't suppress prev signal handler in hw bound check
- Remove unnecessary memset after mmap
- Refine wasm\*runtime_call_wasm_a/v
- Enable app management and thread support for esp32 arch
- Enable libc-wasi support for esp-idf arch
- Implement xtensa XIP
- Enable memory leak check
- Introduce basic CI for nuttx
- Update documents
- Fix module_realloc with NULL ptr issue
- Fix a typo of macro in wasm_application.c
- nuttx: add CONFIG_INTERPRETERS_WAMR_PERF_PROFILING
- aot_reloc_xtensa.c: define \_\_packed if not available
- Fix bh_vector extend_vector not locked issue
- Enable build libc-wasi for nuttx
- Fix typo in embed_wamr.md
- Fix drop opcode issue in fast interpreter
- Fix typos in wasm_mini_loader.c
- Fix issues reported by Coverity and Klocwork
- Add missing aot relocation symbols for xtensa target
- Add arc compiler-rt functions and reloc type for mwdt
- Fix get invokeNative float ret value issue with clang compiler
- Make robust on choosing target assumption for X86_32 support
- Fix an issue of wasm_cluster_spread_custom_data when called before exec
- Fix socket api verification of addresses in the address pool
- Add API wasm_runtime_set_module_inst
- Set noexecstack CXX link flags for wamrc
- Add import subtyping validation
- Fix libc-wasi/uvwasi poll/environ_get issues
- Add missing symbol for aot_reloc_arc.c
- Add a dev docker container for WAMR repo
- Fix dump call stack issue in interpreter
- Fix windows thread data issue and enhance windows os_mmap
- Support custom stack guard size
- Implement i64.div and i64.rem intrinsics
- Let iwasm return non-zero value when running failed
- Reserve one pointer size for fast-interp code_compiled_size
- Enable libc-wasi support for esp-idf
- Expose wasm_runtime_get_exec_env_singleton to the API users
- Normalize wasm types to refine interpreter call_indirect
- Remove unused wasm_runtime_create_exec_env_and_call_wasm
- Fix linear memory page count issues
- debug: Retire wasm_debug\*(get|set)\_engine_active mechanism
- wasm_application.c: Do not start debug instance automatically
- Fix typo in simd_conversions.c
- nuttx: Add CONFIG_INTERPRETERS_WAMR_DEBUG_INTERP
- Add a new API to get free memory in memory pool
- Fix multi-module and some other issues
- Fix build issue of the meshoptimizer workload
- Fix build error on alios platform
---

View File

@ -1,3 +1,15 @@
diff --git a/lldb/include/lldb/Breakpoint/Breakpoint.h b/lldb/include/lldb/Breakpoint/Breakpoint.h
index f2e2a0d22..426d1129b 100644
--- a/lldb/include/lldb/Breakpoint/Breakpoint.h
+++ b/lldb/include/lldb/Breakpoint/Breakpoint.h
@@ -9,6 +9,7 @@
#ifndef LLDB_BREAKPOINT_BREAKPOINT_H
#define LLDB_BREAKPOINT_BREAKPOINT_H
+#include <limits>
#include <memory>
#include <string>
#include <unordered_set>
diff --git a/lldb/include/lldb/Core/Module.h b/lldb/include/lldb/Core/Module.h diff --git a/lldb/include/lldb/Core/Module.h b/lldb/include/lldb/Core/Module.h
index dd7100c46..97d70daad 100644 index dd7100c46..97d70daad 100644
--- a/lldb/include/lldb/Core/Module.h --- a/lldb/include/lldb/Core/Module.h
@ -5829,3 +5841,27 @@ index 4ec2e25c7..24c88fe9a 100644
default: default:
return std::make_shared<UnixSignals>(); return std::make_shared<UnixSignals>();
} }
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/OrcRPCExecutorProcessControl.h b/llvm/include/llvm/ExecutionEngine/Orc/OrcRPCExecutorProcessControl.h
index 4310ba9ce..297b33879 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/OrcRPCExecutorProcessControl.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/OrcRPCExecutorProcessControl.h
@@ -13,6 +13,7 @@
#ifndef LLVM_EXECUTIONENGINE_ORC_ORCRPCEXECUTORPROCESSCONTROL_H
#define LLVM_EXECUTIONENGINE_ORC_ORCRPCEXECUTORPROCESSCONTROL_H
+#include "llvm/ExecutionEngine/Orc/Core.h"
#include "llvm/ExecutionEngine/Orc/ExecutorProcessControl.h"
#include "llvm/ExecutionEngine/Orc/Shared/RPCUtils.h"
#include "llvm/ExecutionEngine/Orc/Shared/RawByteChannel.h"
diff --git a/llvm/include/llvm/Support/MathExtras.h b/llvm/include/llvm/Support/MathExtras.h
index 753b1998c..27370c62d 100644
--- a/llvm/include/llvm/Support/MathExtras.h
+++ b/llvm/include/llvm/Support/MathExtras.h
@@ -16,6 +16,7 @@
#include "llvm/Support/Compiler.h"
#include <cassert>
#include <climits>
+#include <limits>
#include <cmath>
#include <cstdint>
#include <cstring>

View File

@ -0,0 +1,11 @@
# Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
set (WAMR_BUILD_PLATFORM "darwin")
set (WAMR_BUILD_TARGET X86_64)
set (WAMR_BUILD_INTERP 1)
set (WAMR_BUILD_AOT 1)
set (WAMR_BUILD_JIT 0)
set (WAMR_BUILD_LIBC_BUILTIN 1)
set (WAMR_BUILD_LIBC_WASI 0)
set (WAMR_BUILD_APP_FRAMEWORK 1)
set (WAMR_BUILD_APP_LIST WAMR_APP_BUILD_BASE WAMR_APP_BUILD_CONNECTION WAMR_APP_BUILD_SENSOR)

161
samples/simple/sample_test_run.py Executable file
View File

@ -0,0 +1,161 @@
#!/usr/bin/env python3
#
# Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
import argparse
import shlex
import subprocess
import sys
import time
import traceback
def start_server(cwd):
"""
Startup the 'simple' process works in TCP server mode
"""
app_server = subprocess.Popen(shlex.split("./simple -s "), cwd=cwd)
return app_server
def query_installed_application(cwd):
"""
Query all installed applications
"""
qry_prc = subprocess.run(
shlex.split("./host_tool -q"), cwd=cwd, check=False, capture_output=True
)
assert qry_prc.returncode == 69
return qry_prc.returncode, qry_prc.stdout
def install_wasm_application(wasm_name, wasm_file, cwd):
"""
Install a wasm application
"""
inst_prc = subprocess.run(
shlex.split(f"./host_tool -i {wasm_name} -f {wasm_file}"),
cwd=cwd,
check=False,
capture_output=True,
)
assert inst_prc.returncode == 65
return inst_prc.returncode, inst_prc.stdout
def uninstall_wasm_application(wasm_name, cwd):
"""
Uninstall a wasm application
"""
unst_prc = subprocess.run(
shlex.split(f"./host_tool -u {wasm_name}"),
cwd=cwd,
check=False,
capture_output=True,
)
assert unst_prc.returncode == 66
return unst_prc.returncode, unst_prc.stdout
def send_get_to_wasm_application(wasm_name, url, cwd):
"""
send a request (GET) from host to an applicaton
"""
qry_prc = subprocess.run(
shlex.split(f"./host_tool -r /app/{wasm_name}{url} -A GET"),
cwd=cwd,
check=False,
capture_output=True,
)
assert qry_prc.returncode == 69
return qry_prc.returncode, qry_prc.stdout
def main():
"""
GO!GO!!GO!!!
"""
parser = argparse.ArgumentParser(description="run the sample and examine outputs")
parser.add_argument("working_directory", type=str)
args = parser.parse_args()
ret = 1
app_server = None
try:
app_server = start_server(args.working_directory)
# wait for a second
time.sleep(1)
print("--> Install timer.wasm...")
install_wasm_application(
"timer", "./wasm-apps/timer.wasm", args.working_directory
)
print("--> Install event_publisher.wasm...")
install_wasm_application(
"event_publisher",
"./wasm-apps/event_publisher.wasm",
args.working_directory,
)
print("--> Install event_subscriber.wasm...")
install_wasm_application(
"event_subscriber",
"./wasm-apps/event_subscriber.wasm",
args.working_directory,
)
print("--> Uninstall timer.wasm...")
uninstall_wasm_application("timer", args.working_directory)
print("--> Uninstall event_publisher.wasm...")
uninstall_wasm_application(
"event_publisher",
args.working_directory,
)
print("--> Uninstall event_subscriber.wasm...")
uninstall_wasm_application(
"event_subscriber",
args.working_directory,
)
print("--> Query all installed applications...")
query_installed_application(args.working_directory)
print("--> Install request_handler.wasm...")
install_wasm_application(
"request_handler",
"./wasm-apps/request_handler.wasm",
args.working_directory,
)
print("--> Query again...")
query_installed_application(args.working_directory)
print("--> Install request_sender.wasm...")
install_wasm_application(
"request_sender",
"./wasm-apps/request_sender.wasm",
args.working_directory,
)
print("--> Send GET to the Wasm application named request_handler...")
send_get_to_wasm_application("request_handler", "/url1", args.working_directory)
print("--> All pass")
ret = 0
except AssertionError:
traceback.print_exc()
finally:
app_server.kill()
return ret
if __name__ == "__main__":
sys.exit(main())

View File

@ -37,7 +37,26 @@ under `resource/debug/bin`.
- Ubuntu Bionic 18.04(LTS) - Ubuntu Bionic 18.04(LTS)
``` ```
#### 3. Build docker images #### 3. Pull docker images from the registry(recommended) or build docker images on the host
##### 3.1 Pull docker images from registry
From now on, for each release, we have the same version tagged docker image pushed to GitHub package.
You could simply pull a certain version of docker images using the following commands:
```sh
# pull and retag wasm-toolchain
docker pull ghcr.io/bytecodealliance/wasm-toolchain:{version number}
docker tag ghcr.io/bytecodealliance/wasm-toolchain:{version number} wasm-toolchain:{version number}
docker rmi ghcr.io/bytecodealliance/wasm-toolchain:{version number}
# pull and retag wasm-debug-server
docker pull ghcr.io/bytecodealliance/wasm-debug-server:{version number}
docker tag ghcr.io/bytecodealliance/wasm-debug-server:{version number} wasm-debug-server:{version number}
docker rmi ghcr.io/bytecodealliance/wasm-debug-server:{version number}
```
##### 3.2 Build docker images on host
We have 2 docker images which should be built or loaded on your host, `wasm-toolchain` and `wasm-debug-server`. To build these 2 images, please enter the `WASM-Debug-Server/Docker` & `WASM-Toolchain/Docker`, then execute the `build_docker_image` script respectively. We have 2 docker images which should be built or loaded on your host, `wasm-toolchain` and `wasm-debug-server`. To build these 2 images, please enter the `WASM-Debug-Server/Docker` & `WASM-Toolchain/Docker`, then execute the `build_docker_image` script respectively.

View File

@ -3,10 +3,13 @@
### An integrated development environment for WASM. ### An integrated development environment for WASM.
# How to debug this extension # How to debug this extension
> Note that when you download and
> Note that please build `lldb` firstly follow this > decompress to get .vsix file from [our release](https://github.com/bytecodealliance/wasm-micro-runtime/releases).
> [instruction](./resource/debug/README.md) if you want to enable > It's by default that the `source debugging` feature is not enabled.
> `source debugging` feature of this extension > If you want to enable `source debugging` feature of this extension,
> you could either download `lldb` from [our release](https://github.com/bytecodealliance/wasm-micro-runtime/releases) and put them in correct path
mentioned in this [instruction](./resource/debug/README.md) (This is recommended way),
> or you could build `lldb` yourself follow this [instruction](./resource/debug/README.md)
### 1. open `VSCode_Extension` directory with the `vscode` ### 1. open `VSCode_Extension` directory with the `vscode`

View File

@ -0,0 +1,40 @@
set (WAMR_BUILD_PLATFORM "darwin")
set (WAMR_BUILD_TARGET X86_64)
# Running mode
set (WAMR_BUILD_AOT 1)
set (WAMR_BUILD_INTERP 1)
set (WAMR_BUILD_JIT 0)
# Runtime SDK Features
set (WAMR_BUILD_CUSTOM_NAME_SECTION 0)
set (WAMR_BUILD_DEBUG_INTERP 0)
set (WAMR_BUILD_DEBUG_AOT 0)
set (WAMR_BUILD_DUMP_CALL_STACK 0)
set (WAMR_BUILD_LIBC_UVWASI 0)
set (WAMR_BUILD_LIBC_EMCC 0)
set (WAMR_BUILD_LIB_RATS 0)
set (WAMR_BUILD_LOAD_CUSTOM_SECTION 0)
set (WAMR_BUILD_MEMORY_PROFILING 0)
set (WAMR_BUILD_MINI_LOADER 0)
set (WAMR_BUILD_MULTI_MODULE 0)
set (WAMR_BUILD_PERF_PROFILING 0)
set (WAMR_BUILD_SPEC_TEST 0)
set (WAMR_BUILD_BULK_MEMORY 1)
set (WAMR_BUILD_LIB_PTHREAD 1)
set (WAMR_BUILD_LIB_PTHREAD_SEMAPHORE 1)
set (WAMR_BUILD_LIBC_BUILTIN 1)
set (WAMR_BUILD_LIBC_WASI 1)
set (WAMR_BUILD_REF_TYPES 1)
set (WAMR_BUILD_SIMD 1)
set (WAMR_BUILD_SHARED_MEMORY 1)
set (WAMR_BUILD_TAIL_CALL 1)
set (WAMR_BUILD_THREAD_MGR 1)
# APP SDK Features
set (WAMR_BUILD_APP_FRAMEWORK 1)
set (WAMR_BUILD_APP_LIST WAMR_APP_BUILD_BASE)
#
# set (EXTRA_SDK_INCLUDE_PATH "")

View File

@ -0,0 +1,40 @@
set (WAMR_BUILD_PLATFORM "linux")
set (WAMR_BUILD_TARGET X86_64)
# Running mode
set (WAMR_BUILD_AOT 1)
set (WAMR_BUILD_INTERP 1)
set (WAMR_BUILD_JIT 0)
# Runtime SDK Features
set (WAMR_BUILD_CUSTOM_NAME_SECTION 0)
set (WAMR_BUILD_DEBUG_INTERP 0)
set (WAMR_BUILD_DEBUG_AOT 0)
set (WAMR_BUILD_DUMP_CALL_STACK 0)
set (WAMR_BUILD_LIBC_UVWASI 0)
set (WAMR_BUILD_LIBC_EMCC 0)
set (WAMR_BUILD_LIB_RATS 0)
set (WAMR_BUILD_LOAD_CUSTOM_SECTION 0)
set (WAMR_BUILD_MEMORY_PROFILING 0)
set (WAMR_BUILD_MINI_LOADER 0)
set (WAMR_BUILD_MULTI_MODULE 0)
set (WAMR_BUILD_PERF_PROFILING 0)
set (WAMR_BUILD_SPEC_TEST 0)
set (WAMR_BUILD_BULK_MEMORY 1)
set (WAMR_BUILD_LIB_PTHREAD 1)
set (WAMR_BUILD_LIB_PTHREAD_SEMAPHORE 1)
set (WAMR_BUILD_LIBC_BUILTIN 1)
set (WAMR_BUILD_LIBC_WASI 1)
set (WAMR_BUILD_REF_TYPES 1)
set (WAMR_BUILD_SIMD 1)
set (WAMR_BUILD_SHARED_MEMORY 1)
set (WAMR_BUILD_TAIL_CALL 1)
set (WAMR_BUILD_THREAD_MGR 1)
# APP SDK Features
set (WAMR_BUILD_APP_FRAMEWORK 1)
set (WAMR_BUILD_APP_LIST WAMR_APP_BUILD_BASE)
#
# set (EXTRA_SDK_INCLUDE_PATH "")