-
Notifications
You must be signed in to change notification settings - Fork 33
142 lines (128 loc) · 6.29 KB
/
build_linux_arm64.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
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: Update supports
run: |
UPDATE_SUPPORTS_SCRIPT=$(pwd)/tools/supports/update_supports_in_manifest_json.py
ARRAY=(
"core/src/ten_runtime"
"core/src/ten_runtime/binding/go"
"core/src/ten_runtime/binding/python"
"packages/core_extensions/py_init_extension_cpp"
)
for item in "${ARRAY[@]}"; do
python3 ${UPDATE_SUPPORTS_SCRIPT} --os-arch-pairs linux:arm64 --input-file ${item}/manifest.json --output-file ${item}/manifest.json --log-level 1
cat ${item}/manifest.json
done
# Due to the use of QEMU, running as root inside the Docker container
# is required. However, outside the container, the user is not root.
# This causes issues when trying to handle the contents of the out/
# folder from outside the container. To resolve this, the out/ folder
# is first created by a regular non-root user to prevent it from being
# created during the build stage, thus avoiding permission issues with
# the out/ folder being created by the root user.
mkdir -p out/linux/arm64
shell: bash
- 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_rust_enable_tests=false ten_package_manager_enable_tests=false ten_enable_libwebsockets=false ten_enable_cargo_clean=true && \
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/arm64/ten_packages/system/ten_runtime
out/linux/arm64/ten_packages/system/ten_runtime_go
out/linux/arm64/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/default_async_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/default_async_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
- name: Publish release to TEN cloud store
if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.compiler == 'gcc' && matrix.build_type == 'release' }}
run: |
docker run --rm --platform linux/arm64 \
-v $(pwd):/${{ github.workspace }} -w ${{ github.workspace }} --entrypoint /bin/bash \
ghcr.io/ten-framework/ten_building_ubuntu2204 -c "\
set -x && \
cd out/linux/arm64/ten_packages && \
cd system/ten_runtime && ../../../ten_manager/bin/tman --verbose --user-token ${{ secrets.TEN_CLOUD_STORE }} publish && cd - && \
cd system/ten_runtime_go && ../../../ten_manager/bin/tman --verbose --user-token ${{ secrets.TEN_CLOUD_STORE }} publish && cd - && \
cd system/ten_runtime_python && ../../../ten_manager/bin/tman --verbose --user-token ${{ secrets.TEN_CLOUD_STORE }} publish && cd - && \
cd extension/py_init_extension_cpp && ../../../ten_manager/bin/tman --verbose --user-token ${{ secrets.TEN_CLOUD_STORE }} publish && cd - \
"
shell: bash