Skip to content

Build - linux ubuntu1804 #1304

Build - linux ubuntu1804

Build - linux ubuntu1804 #1304

name: Build - linux ubuntu1804
on:
release:
types: [created]
pull_request:
types: [opened, synchronize, reopened]
paths-ignore:
- "tools/**"
- "docs/**"
- ".vscode/**"
- ".devcontainer/**"
- ".github/**"
- "!.github/workflows/build_linux_ubuntu1804.yml"
- "**.md"
jobs:
build-linux-ubuntu1804:
concurrency:
group: build-linux-ubuntu1804-${{ github.head_ref }}-${{ matrix.build_type }}
cancel-in-progress: true
runs-on: ubuntu-22.04
strategy:
matrix:
build_type: [release]
container:
image: ghcr.io/ten-framework/ten_building_ubuntu1804
steps:
- name: Configure Git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Manual Checkout Repository
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global --add safe.directory $(pwd)
git clone https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git .
git checkout ${{ github.event.pull_request.head.sha }}
git submodule update --init --recursive
- 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: Build
run: |
export PATH=$(pwd)/core/ten_gn/:$PATH
echo $PATH
go env -w GOFLAGS="-buildvcs=false"
rustup default nightly
df -h .
tgn gen linux x64 ${{ matrix.build_type }} -- is_clang=false log_level=1 enable_serialized_actions=true ten_enable_serialized_rust_action=true ten_enable_integration_tests=false ten_enable_ten_manager=false ten_rust_enable_gen_cargo_config=false ten_enable_cargo_clean=true ten_enable_rust_incremental_build=false ten_manager_enable_frontend=false
tgn build linux x64 ${{ matrix.build_type }}
df -h .
tree -I 'gen|obj' out
- name: Run Tests (ten_utils_unit_test)
env:
ASAN_OPTIONS: detect_leaks=1: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/linux/x64/tests/standalone/ten_utils_unit_test
out/linux/x64/tests/standalone/ten_utils_unit_test || { echo "test failed"; exit 1; }
- name: Run Tests (ten_runtime_unit_test)
env:
ASAN_OPTIONS: detect_leaks=1: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/linux/x64/tests/standalone/ten_runtime_unit_test
out/linux/x64/tests/standalone/ten_runtime_unit_test || { echo "test failed"; exit 1; }
- name: Run Tests (ten_runtime_smoke_test)
env:
ASAN_OPTIONS: detect_leaks=1: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/linux/x64/tests/standalone/ten_runtime_smoke_test
out/linux/x64/tests/standalone/ten_runtime_smoke_test || { echo "test failed"; exit 1; }
- name: Run Tests (ten_rust standalone tests)
env:
ASAN_OPTIONS: detect_leaks=1: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: |
cd out/linux/x64/tests/standalone/ten_rust
chmod +x unit_test
chmod +x integration_test
./unit_test || { echo "ten_rust unit test failed"; exit 1; }
./integration_test || { echo "ten_rust integration test failed"; exit 1; }
- name: Install jq
if: startsWith(github.ref, 'refs/tags/')
run: apt-get update && apt-get install -y jq
- name: Package assets
if: startsWith(github.ref, 'refs/tags/')
run: |
cd out/linux/x64
zip -vr ten_packages-linux-ubuntu1804-x64-gcc-${{ 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: Upload Release Asset
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ASSET_PATH: out/linux/x64/ten_packages-linux-ubuntu1804-x64-gcc-${{ matrix.build_type }}.zip
ASSET_NAME: ten_packages-linux-ubuntu1804-x64-gcc-${{ matrix.build_type }}.zip
run: |
TAG_NAME=${GITHUB_REF#refs/tags/}
echo "Tag: $TAG_NAME"
# Get the release information
response=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \
https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/tags/$TAG_NAME)
# Check if the release was found
if echo "$response" | grep -q '"id":'; then
echo "Release found."
else
echo "Release not found. Exiting."
exit 1
fi
# Extract upload_url
upload_url=$(echo "$response" | jq -r .upload_url | sed -e "s/{?name,label}//")
echo "Upload URL: $upload_url"
# Upload the asset
curl -s -H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type: application/zip" \
--data-binary @"$ASSET_PATH" \
"$upload_url?name=$ASSET_NAME"
echo "Asset uploaded successfully."