Skip to content

build(rockchip): share builder across RKNN targets #108

build(rockchip): share builder across RKNN targets

build(rockchip): share builder across RKNN targets #108

name: Build and Test (x86)
on:
pull_request:
branches: [main]
paths:
- 'src/**'
- 'test/**'
- 'cmake/**'
- '3rd/**'
- 'prebuild/ffmpeg/x86_64/**'
- 'toolchains/**'
- 'CMakeLists.txt'
- 'scripts/build_cpu_test.sh'
- '.github/workflows/ci-build-and-test.yml'
workflow_dispatch:
permissions:
checks: write
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
build-and-test:
# Use the same builder image as Dockerfile.x86 — keeps CI and production builds consistent.
runs-on: ubuntu-latest
container:
image: ghcr.io/cosmo-wander-ai/cosmo_edge-build-env_x86:v1
timeout-minutes: 60
env:
# GitHub Actions runs container jobs with HOME=/github/home, but the
# builder image installs rustup under /root. rustup derives RUSTUP_HOME
# from $HOME, so it reads /github/home/.rustup (empty) and aborts with
# "no default is configured" when tokenizers-cpp invokes cargo to build
# libtokenizers_c.a. Pin both homes to the image's install — the image
# PATH already hardcodes /root/.cargo/bin, so this couples no further.
RUSTUP_HOME: /root/.rustup
CARGO_HOME: /root/.cargo
steps:
# Container runs as root but workspace is owned by host UID.
# Suppress git "dubious ownership" errors that break test-reporter.
- name: Configure git safe directory
run: git config --global --add safe.directory '*'
- uses: actions/checkout@v7
# ── Rust toolchain ───────────────────────────────────────────────
# With RUSTUP_HOME/CARGO_HOME pinned above, the image's toolchain
# resolves correctly. Verify it; install stable as a fallback only if
# a future image ships without one.
- name: Verify Rust toolchain
run: |
if ! cargo --version >/dev/null 2>&1; then
rustup toolchain install stable --profile minimal --no-self-update
rustup default stable
fi
cargo --version
# ── Build ────────────────────────────────────────────────────────
- name: Configure and build cosmo-tests (x86 CPU backend)
run: bash scripts/build_cpu_test.sh
# ── Run tests ────────────────────────────────────────────────────
- name: Run tests
run: |
export LD_LIBRARY_PATH="\
${GITHUB_WORKSPACE}/prebuild/ffmpeg/x86_64/lib:\
${GITHUB_WORKSPACE}/3rd/onnxruntime-linux-x64-1.26.0/lib:\
${GITHUB_WORKSPACE}/build_cpu/thirdparty_install/openssl/lib:\
${GITHUB_WORKSPACE}/build_cpu/thirdparty_install/curl/lib:\
${GITHUB_WORKSPACE}/build_cpu/thirdparty_install/event/lib:\
${GITHUB_WORKSPACE}/build_cpu/thirdparty_install/glog/lib:\
${GITHUB_WORKSPACE}/build_cpu/thirdparty_install/mp4v2/lib:\
${GITHUB_WORKSPACE}/build_cpu/thirdparty_install/uuid/lib:\
${LD_LIBRARY_PATH}"
./build_cpu/cosmo-tests -r junit -o test-results.xml
# ── Upload test results ──────────────────────────────────────────
- name: Upload test results artifact
if: always()
uses: actions/upload-artifact@v7
with:
name: test-results-x86
path: test-results.xml
retention-days: 7
# ── Surface test summary in GitHub UI ────────────────────────────
- name: Publish test results
if: always()
uses: dorny/test-reporter@a43b3a5f7366b97d083190328d2c652e1a8b6aa2 # v3.0.0
with:
name: Cosmo Tests (x86)
path: test-results.xml
reporter: java-junit