Skip to content

Commit

Permalink
Merge branch 'main' into fix/graph_nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
sunxilin authored Oct 15, 2024
2 parents 0a8320a + 21309f8 commit 9b6a912
Show file tree
Hide file tree
Showing 88 changed files with 2,773 additions and 145 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/build_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,18 @@ jobs:
include:
- image_name: "ubuntu2204"
workdir: "tools/docker_for_building/ubuntu/22.04"
platforms: linux/amd64,linux/arm64
- image_name: "ubuntu1804"
workdir: "tools/docker_for_building/ubuntu/18.04"
platforms: linux/amd64
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build & Publish to Github Container Registry
uses: elgohr/Publish-Docker-Github-Action@v5
with:
Expand All @@ -33,5 +38,6 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}
registry: ghcr.io
workdir: ${{ matrix.workdir }}
platforms: ${{ matrix.platforms }}
snapshot: true
tags: "${{ github.ref == 'refs/heads/main' && 'latest,' || '' }}"
99 changes: 99 additions & 0 deletions .github/workflows/build_linux_arm64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: Build - linux arm64

on:
release:
types: [created]
pull_request:
types: [opened, synchronize, reopened]
paths-ignore:
- "tools/**"
- "docs/**"
- ".vscode/**"
- ".devcontainer/**"
- ".github/**"
- "!.github/workflows/build_linux_arm64.yml"
- "**.md"

jobs:
build:
runs-on: ubuntu-latest
concurrency:
group: build-linux-arm64-${{ github.head_ref }}-${{ matrix.compiler }}-${{ matrix.build_type }}
cancel-in-progress: true
strategy:
matrix:
compiler: [gcc]
build_type: [release]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: "0"
submodules: "true"

- name: Update version
run: |
git config --global --add safe.directory $(pwd)
python3 tools/version/update_version_in_ten_framework.py
python3 tools/version/check_version_in_ten_framework.py
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: arm64

- name: Build
run: |
docker run --rm --platform linux/arm64 \
-v $(pwd):/${{ github.workspace }} -w ${{ github.workspace }} \
ghcr.io/ten-framework/ten_building_ubuntu2204 \
bash -c "\
export PATH=$(pwd)/core/ten_gn:/usr/local/go/bin:/root/go/bin:/root/.cargo/bin:$PATH && \
echo $PATH && \
go env -w GOFLAGS="-buildvcs=false" && \
go1.20.12 download && \
rustup default nightly && \
tgn gen linux arm64 ${{ matrix.build_type }} -- is_clang=${{ matrix.compiler == 'gcc' && 'false' || 'true' }} log_level=1 enable_serialized_actions=true ten_enable_tests=false ten_enable_libwebsockets=false && \
tgn build linux arm64 ${{ matrix.build_type }} && \
tree -I 'gen|obj' out \
"
- name: Upload tman
uses: actions/upload-artifact@v4
with:
name: tman-linux-arm64-${{ matrix.compiler }}-${{ matrix.build_type }}
path: out/linux/arm64/ten_manager/bin/tman

- name: Upload ten_packages
uses: actions/upload-artifact@v4
with:
name: ten_packages-linux-arm64-${{ matrix.compiler }}-${{ matrix.build_type }}
path: |
out/linux/x64/ten_packages/system/ten_runtime
out/linux/x64/ten_packages/system/ten_runtime_go
out/linux/x64/ten_packages/system/ten_runtime_python
out/linux/arm64/ten_packages/extension/default_extension_cpp
out/linux/arm64/ten_packages/extension/default_extension_go
out/linux/arm64/ten_packages/extension/default_extension_python
out/linux/arm64/ten_packages/extension/py_init_extension_cpp
- name: Package assets
if: startsWith(github.ref, 'refs/tags/')
run: |
cd out/linux/arm64
zip -vr tman-linux-arm64-${{ matrix.compiler }}-${{ matrix.build_type }}.zip ten_manager/bin/tman
zip -vr ten_packages-linux-arm64-${{ matrix.compiler }}-${{ matrix.build_type }}.zip \
ten_packages/system/ten_runtime \
ten_packages/system/ten_runtime_go \
ten_packages/system/ten_runtime_python \
ten_packages/extension/default_extension_cpp \
ten_packages/extension/default_extension_go \
ten_packages/extension/default_extension_python \
ten_packages/extension/py_init_extension_cpp
- name: Publish to release assets
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
out/linux/arm64/tman-linux-arm64-${{ matrix.compiler }}-${{ matrix.build_type }}.zip
out/linux/arm64/ten_packages-linux-arm64-${{ matrix.compiler }}-${{ matrix.build_type }}.zip
36 changes: 18 additions & 18 deletions .github/workflows/build_mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@ jobs:
tgn build mac arm64 ${{ matrix.build_type }}
tree -I 'gen|obj' out
# - name: Run Tests (ten_utils_unit_test)
# env:
# ASAN_OPTIONS: detect_stack_use_after_return=1:color=always:unmap_shadow_on_exit=1:abort_on_error=1
# MALLOC_CHECK_: 3
# TEN_ENABLE_MEMORY_TRACKING: "true"
# TEN_ENABLE_BACKTRACE_DUMP: "true"
# run: |
# chmod +x out/mac/arm64/tests/standalone/ten_utils_unit_test
# out/mac/arm64/tests/standalone/ten_utils_unit_test
- name: Run Tests (ten_utils_unit_test)
env:
ASAN_OPTIONS: detect_stack_use_after_return=1:color=always:unmap_shadow_on_exit=1:abort_on_error=1
MALLOC_CHECK_: 3
TEN_ENABLE_MEMORY_TRACKING: "true"
TEN_ENABLE_BACKTRACE_DUMP: "true"
run: |
chmod +x out/mac/arm64/tests/standalone/ten_utils_unit_test
out/mac/arm64/tests/standalone/ten_utils_unit_test
- name: Run Tests (ten_runtime_unit_test)
env:
Expand All @@ -100,15 +100,15 @@ jobs:
chmod +x out/mac/arm64/tests/standalone/ten_runtime_unit_test
out/mac/arm64/tests/standalone/ten_runtime_unit_test
# - name: Run Tests (ten_runtime_smoke_test)
# env:
# ASAN_OPTIONS: detect_stack_use_after_return=1:color=always:unmap_shadow_on_exit=1:abort_on_error=1
# MALLOC_CHECK_: 3
# TEN_ENABLE_MEMORY_TRACKING: "true"
# TEN_ENABLE_BACKTRACE_DUMP: "true"
# run: |
# chmod +x out/mac/arm64/tests/standalone/ten_runtime_smoke_test
# out/mac/arm64/tests/standalone/ten_runtime_smoke_test
- name: Run Tests (ten_runtime_smoke_test)
env:
ASAN_OPTIONS: detect_stack_use_after_return=1:color=always:unmap_shadow_on_exit=1:abort_on_error=1
MALLOC_CHECK_: 3
TEN_ENABLE_MEMORY_TRACKING: "true"
TEN_ENABLE_BACKTRACE_DUMP: "true"
run: |
chmod +x out/mac/arm64/tests/standalone/ten_runtime_smoke_test
out/mac/arm64/tests/standalone/ten_runtime_smoke_test
build-mac-x64:
concurrency:
Expand Down
27 changes: 12 additions & 15 deletions .github/workflows/build_win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,24 +54,21 @@ jobs:
- name: Run Tests (ten_utils_unit_test)
env:
TEN_ENABLE_MEMORY_TRACKING: "true"
TEN_ENABLE_BACKTRACE_DUMP: "true"
run: |
chmod +x out/win/x64/tests/standalone/ten_utils_unit_test
out/win/x64/tests/standalone/ten_utils_unit_test
# - name: Run Tests (ten_runtime_unit_test)
# env:
# TEN_ENABLE_MEMORY_TRACKING: "true"
# TEN_ENABLE_BACKTRACE_DUMP: "true"
# run: |
# chmod +x out/win/x64/tests/standalone/ten_runtime_unit_test
# out/win/x64/tests/standalone/ten_runtime_unit_test
- name: Run Tests (ten_runtime_unit_test)
env:
TEN_ENABLE_BACKTRACE_DUMP: "true"
run: |
chmod +x out/win/x64/tests/standalone/ten_runtime_unit_test
out/win/x64/tests/standalone/ten_runtime_unit_test
# - name: Run Tests (ten_runtime_smoke_test)
# env:
# TEN_ENABLE_MEMORY_TRACKING: "true"
# TEN_ENABLE_BACKTRACE_DUMP: "true"
# run: |
# chmod +x out/win/x64/tests/standalone/ten_runtime_smoke_test
# out/win/x64/tests/standalone/ten_runtime_smoke_test
- name: Run Tests (ten_runtime_smoke_test)
env:
TEN_ENABLE_BACKTRACE_DUMP: "true"
run: |
chmod +x out/win/x64/tests/standalone/ten_runtime_smoke_test
out/win/x64/tests/standalone/ten_runtime_smoke_test
15 changes: 12 additions & 3 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"request": "launch",
"program": "${workspaceFolder}/out/linux/x64/tests/standalone/ten_runtime_unit_test",
"args": [
"--gtest_filter=SchemaTest.SchemaStoreValidateProperty"
"--gtest_filter=TenErrorTest.cpp_thread"
],
"stopAtEntry": false,
"cwd": "${workspaceFolder}/out/linux/x64/",
Expand All @@ -59,6 +59,14 @@
{
"name": "LD_PRELOAD",
"value": "/usr/lib/gcc/x86_64-linux-gnu/10/libasan.so"
},
{
"name": "TEN_ENABLE_MEMORY_TRACKING",
"value": "true"
},
{
"name": "TEN_ENABLE_BACKTRACE_DUMP",
"value": "true"
}
],
"externalConsole": false,
Expand Down Expand Up @@ -371,9 +379,10 @@
"program": "${workspaceFolder}/out/linux/x64/ten_manager/bin/tman",
"cwd": "${workspaceFolder}/out/linux/x64/",
"args": [
"--verbose",
"dev-server",
"--base-dir=/home/wei/MyData/Temp/ASTRA.ai/agents",
"--port=49484"
"--base-dir=/home/sunxilin/ten_framework_internal_base/ten_framework/out/linux/x64/tests/ten_runtime/integration/python/two_async_extensions_in_different_groups_python/two_async_extensions_in_different_groups_python_app",
"--port=49483"
],
},
{
Expand Down
24 changes: 16 additions & 8 deletions build/common/scripts/package_asan_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def detect_mac_asan_lib(arch: str) -> str:


def detect_linux_asan_lib(arch: str) -> str:
if arch == "x64":
if arch in ["x64", "arm64"]:
out, _ = subprocess.Popen(
"gcc -print-file-name=libasan.so",
shell=True,
Expand All @@ -79,13 +79,21 @@ def detect_linux_asan_lib(arch: str) -> str:

# Generally speaking, this function should not need to be called because Clang's
# default ASan mechanism is static linking.
def detect_linux_clang_asan_lib(_arch: str) -> str:
out, _ = subprocess.Popen(
"clang -print-file-name=libclang_rt.asan-x86_64.so",
shell=True,
stdout=subprocess.PIPE,
encoding="utf-8",
).communicate()
def detect_linux_clang_asan_lib(arch: str) -> str:
if arch == "x64":
out, _ = subprocess.Popen(
"clang -print-file-name=libclang_rt.asan-x86_64.so",
shell=True,
stdout=subprocess.PIPE,
encoding="utf-8",
).communicate()
elif arch == "arm64":
out, _ = subprocess.Popen(
"clang -print-file-name=libclang_rt.asan-aarch64.so",
shell=True,
stdout=subprocess.PIPE,
encoding="utf-8",
).communicate()

libasan_path = out.strip()

Expand Down
4 changes: 2 additions & 2 deletions build/ten_manager/options.gni
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ declare_args() {
}

declare_args() {
ten_package_manager_enable_tests =
is_linux || is_win || (is_mac && target_cpu == "x64")
ten_package_manager_enable_tests = (is_linux && target_cpu == "x64") ||
is_win || (is_mac && target_cpu == "x64")
}
10 changes: 8 additions & 2 deletions build/ten_runtime/feature/autotool.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,15 @@ def copy_system_deps(self):

if sys.platform == "linux":
libs.extend(
glob.glob(f"/usr/lib/x86_64-linux-gnu/lib{dep}.so.*")
glob.glob(
f"/usr/lib/{os.uname().machine}-linux-gnu/lib{dep}.so.*"
)
)
libs.extend(
glob.glob(
f"/usr/lib/{os.uname().machine}-linux-gnu/lib{dep}.so"
)
)
libs.extend(glob.glob(f"/usr/lib/x86_64-linux-gnu/lib{dep}.so"))
else:
print("TODO: Add support for other platforms.")
sys.exit(1)
Expand Down
17 changes: 10 additions & 7 deletions build/ten_runtime/feature/cmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,16 @@ def _fill_attributes(self):
self.sharedlinkerflags.append("--target=arm-linux-gnueabihf")
self.exelinkerflags.append("--target=arm-linux-gnueabihf")
elif self.args.target_cpu == "arm64":
self.cflags.append("--target=aarch64-linux-gnu")
self.sharedlinkerflags.append("--target=aarch64-linux-gnu")
self.exelinkerflags.append("--target=aarch64-linux-gnu")
if self.args.use_clang:
self.cflags.append("-fuse-ld=lld")
self.sharedlinkerflags.append("-fuse-ld=lld")
self.exelinkerflags.append("-fuse-ld=lld")
if os.uname().machine in ["arm64", "aarch64"]:
pass
else:
self.cflags.append("--target=aarch64-linux-gnu")
self.sharedlinkerflags.append("--target=aarch64-linux-gnu")
self.exelinkerflags.append("--target=aarch64-linux-gnu")
if self.args.use_clang:
self.cflags.append("-fuse-ld=lld")
self.sharedlinkerflags.append("-fuse-ld=lld")
self.exelinkerflags.append("-fuse-ld=lld")
else:
raise Exception(
"Currently can not build Linux target with CPU arch"
Expand Down
5 changes: 5 additions & 0 deletions build/ten_runtime/feature/install_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def __init__(self):
self.build_type: str
self.config_file: str
self.log_level: int
self.assume_yes: bool


if __name__ == "__main__":
Expand Down Expand Up @@ -56,6 +57,7 @@ def __init__(self):
parser.add_argument(
"--log-level", type=int, required=True, help="specify log level"
)
parser.add_argument("--assume-yes", type=bool, default=False)

arg_info = ArgumentInfo()
args = parser.parse_args(namespace=arg_info)
Expand All @@ -74,6 +76,9 @@ def __init__(self):
if args.config_file is not None:
cmd += ["--config-file=" + args.config_file]

if args.assume_yes:
cmd += ["--yes"]

cmd += ["install"]

if args.build_type is not None:
Expand Down
7 changes: 7 additions & 0 deletions build/ten_runtime/feature/publish.gni
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ template("ten_package_publish") {
args += [ "--no-enable-publish" ]
}

args += [
"--os",
target_os,
"--cpu",
target_cpu,
]

args += [
"--log-level",
"${log_level}",
Expand Down
Loading

0 comments on commit 9b6a912

Please sign in to comment.