Skip to content

chore: refine CI pipeline #379

chore: refine CI pipeline

chore: refine CI pipeline #379

name: Build - linux ubuntu2204
on:
release:
types: [created]
push:
branches:
- "**"
paths-ignore:
- "tools/**"
- "docs/**"
- ".vscode/**"
- ".devcontainer/**"
- ".github/**"
- "!.github/workflows/build_linux_ubuntu2204.yml"
- "**.md"
pull_request:
paths-ignore:
- "tools/**"
- "docs/**"
- ".vscode/**"
- ".devcontainer/**"
- ".github/**"
- "!.github/workflows/build_linux_ubuntu2204.yml"
- "**.md"
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
compiler: [gcc, clang]
build_type: [debug, release]
container:
image: ghcr.io/ten-framework/ten_building_ubuntu2204
steps:
- uses: actions/checkout@v4
with:
fetch-depth: "0"
submodules: "true"
- name: Install cpulimit and taskset
run: |
apt-get update
apt-get install -y cpulimit util-linux
- name: Build
run: |
export PATH=$(pwd)/core/ten_gn:$PATH
echo $PATH
go env -w GOFLAGS="-buildvcs=false"
go1.20.12 download
rustup default nightly
tgn gen linux x64 ${{ matrix.build_type }} -- is_clang=${{ matrix.compiler == 'gcc' && 'false' || 'true' }} log_level=1 enable_serialized_actions=true ten_enable_integration_tests=false ten_enable_private_tests=false ten_rust_enable_tests=false ten_package_manager_enable_tests=false
tgn build linux x64 ${{ matrix.build_type }}
tree -I 'gen|obj' out
- name: Create cmd_wrapper.sh
run: |
echo '#!/bin/sh' > cmd_wrapper.sh
echo 'echo "==========================================="' >> cmd_wrapper.sh
echo 'echo "cmd wrapper executes the following command:"' >> cmd_wrapper.sh
echo 'echo "$@"' >> cmd_wrapper.sh
echo 'echo "==========================================="' >> cmd_wrapper.sh
echo '"$@"' >> cmd_wrapper.sh
echo 'status=$?' >> cmd_wrapper.sh
echo 'echo $status >_cmd_wrapper_exit_status.txt' >> cmd_wrapper.sh
echo 'exit $status' >> cmd_wrapper.sh
shell: bash
- name: Run Tests
env:
ASAN_OPTIONS: detect_leaks=1:detect_stack_use_after_return=1:color=always:unmap_shadow_on_exit=1:abort_on_error=1
TEN_ENABLE_MEMORY_TRACKING: "true"
run: |
chmod +x cmd_wrapper.sh
chmod +x out/linux/x64/tests/standalone/ten_utils_unit_test
out/linux/x64/tests/standalone/ten_utils_unit_test
cpulimit -f -l 60 -- taskset 0x3 ./cmd_wrapper.sh out/linux/x64/tests/standalone/ten_utils_unit_test
cpulimit -f -l 30 -- taskset 0x1 ./cmd_wrapper.sh out/linux/x64/tests/standalone/ten_utils_unit_test
chmod +x out/linux/x64/tests/standalone/ten_runtime_unit_test
out/linux/x64/tests/standalone/ten_runtime_unit_test
cpulimit -f -l 60 -- taskset 0x3 ./cmd_wrapper.sh out/linux/x64/tests/standalone/ten_runtime_unit_test
cpulimit -f -l 30 -- taskset 0x1 ./cmd_wrapper.sh out/linux/x64/tests/standalone/ten_runtime_unit_test
chmod +x out/linux/x64/tests/standalone/ten_runtime_smoke_test
out/linux/x64/tests/standalone/ten_runtime_smoke_test
cpulimit -f -l 60 -- taskset 0x3 ./cmd_wrapper.sh out/linux/x64/tests/standalone/ten_runtime_smoke_test
cpulimit -f -l 30 -- taskset 0x1 ./cmd_wrapper.sh out/linux/x64/tests/standalone/ten_runtime_smoke_test
- name: Upload tman
uses: actions/upload-artifact@v4
with:
name: tman-linux-x64-${{ matrix.compiler }}-${{ matrix.build_type }}
path: out/linux/x64/ten_manager/bin/tman
- name: Upload ten_packages
uses: actions/upload-artifact@v4
with:
name: ten_packages-linux-x64-${{ matrix.compiler }}-${{ matrix.build_type }}
path: |
out/linux/x64/ten_packages/system
out/linux/x64/ten_packages/extension_group
out/linux/x64/ten_packages/extension/default_extension_cpp
out/linux/x64/ten_packages/extension/default_extension_go
out/linux/x64/ten_packages/extension/default_extension_python
out/linux/x64/ten_packages/extension/py_init_extension_cpp
- name: Package assets
if: startsWith(github.ref, 'refs/tags/')
run: |
cd out/linux/x64
zip -vr tman-linux-x64-${{ matrix.compiler }}-${{ matrix.build_type }}.zip ten_manager/bin/tman
zip -vr ten_packages-linux-x64-${{ matrix.compiler }}-${{ matrix.build_type }}.zip \
ten_packages/system \
ten_packages/extension_group \
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: Release assets
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
out/linux/x64/tman-linux-x64-${{ matrix.compiler }}-${{ matrix.build_type }}.zip
out/linux/x64/ten_packages-linux-x64-${{ matrix.compiler }}-${{ matrix.build_type }}.zip