Repository navigation
onnxdriver: declare the deployed payload; sync the embedded overlay #57
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Test | |
| on: | |
| push: | |
| branches: [main, refactor] | |
| pull_request: | |
| branches: [main, refactor] | |
| env: | |
| BUILD_TYPE: Release | |
| # Enable vcpkg binary caching via GitHub Actions cache backend. | |
| # Compiled packages (e.g. ffmpeg) are stored in the GH Actions cache and | |
| # restored on subsequent runs, avoiding lengthy rebuilds. | |
| VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" | |
| # Cancel superseded runs on the same ref to save runner minutes. | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build-and-test: | |
| name: ${{ matrix.os }} | |
| runs-on: ${{ matrix.runner }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: Windows | |
| runner: windows-latest | |
| - os: Linux | |
| runner: ubuntu-latest | |
| - os: macOS | |
| runner: macos-latest | |
| steps: | |
| # actions/checkout@v5 runs on Node 24 (v4 was Node 20, deprecated). | |
| # No submodules: the vcpkg overlay (custom ports + triplets) is tracked | |
| # directly under scripts/vcpkg-overlay in this repository | |
| # (mirrors the stdware/vcpkg-overlay content needed by synthrt), | |
| # so the plain checkout is sufficient. | |
| - uses: actions/checkout@v5 | |
| # Export the GH Actions cache URL and token so that vcpkg's x-gha | |
| # binary source can read/write compiled packages. | |
| # actions/github-script@v7 is the latest stable major; its latest patch | |
| # already runs on Node 24. | |
| - name: Export GitHub Actions cache variables | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); | |
| core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); | |
| - name: Install system dependencies (Linux) | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y nasm yasm pkg-config | |
| - name: Select Xcode and install system dependencies (macOS) | |
| if: runner.os == 'macOS' | |
| run: | | |
| sudo xcode-select --reset | |
| clang++ --version | |
| brew install nasm yasm pkg-config | |
| # Normalize the vcpkg triplet per platform+arch. Previously the macOS | |
| # job relied on the vcpkg default triplet (x64-osx): on ARM64 runners | |
| # (macos-latest is now arm64) that mismatched the prebuilt artifacts | |
| # selected by host arch detection in the ffmpeg-builds port, causing | |
| # link failures. Explicitly pinning the triplet keeps every platform in | |
| # sync with the downloaded prebuilt artifacts. | |
| - name: Normalize vcpkg target triplet | |
| shell: bash | |
| run: | | |
| ARCH="$(echo "${{ runner.arch }}" | tr '[:upper:]' '[:lower:]')" | |
| case "${{ runner.os }}" in | |
| macOS) | |
| if [ "$ARCH" = "arm64" ]; then TRIPLET="arm64-osx"; else TRIPLET="x64-osx"; fi | |
| ;; | |
| Windows) | |
| TRIPLET="x64-windows" | |
| ;; | |
| *) | |
| TRIPLET="x64-linux" | |
| ;; | |
| esac | |
| echo "VCPKG_TARGET_TRIPLET=${TRIPLET}" >> "$GITHUB_ENV" | |
| echo "Normalized vcpkg triplet: ${TRIPLET} (arch ${ARCH})" | |
| # Pin the vcpkg client to the same revision as builtin-baseline. Runner | |
| # images ship a moving (and sometimes shallow) vcpkg clone, which cannot | |
| # reliably resolve a manifest baseline. | |
| - name: Check out vcpkg | |
| uses: actions/checkout@v5 | |
| with: | |
| repository: microsoft/vcpkg | |
| ref: 97b19caab97ab0c8d36c93230046c8c45fcd41d0 | |
| path: .vcpkg | |
| - name: Set up vcpkg | |
| shell: bash | |
| run: | | |
| echo "VCPKG_ROOT=${GITHUB_WORKSPACE}/.vcpkg" >> "$GITHUB_ENV" | |
| git -C "${GITHUB_WORKSPACE}/.vcpkg" cat-file -e \ | |
| 97b19caab97ab0c8d36c93230046c8c45fcd41d0^{commit} | |
| - name: Bootstrap vcpkg (Windows) | |
| if: runner.os == 'Windows' | |
| shell: cmd | |
| run: .vcpkg\bootstrap-vcpkg.bat -disableMetrics | |
| - name: Bootstrap vcpkg (Unix) | |
| if: runner.os != 'Windows' | |
| shell: bash | |
| run: ./.vcpkg/bootstrap-vcpkg.sh -disableMetrics | |
| - name: Show vcpkg version | |
| shell: bash | |
| run: | | |
| "${VCPKG_ROOT}/vcpkg" version | |
| # ONNX Runtime comes from the onnxruntime-builds overlay port (tracked | |
| # under scripts/vcpkg-overlay, declared in scripts/vcpkg-manifest), so | |
| # no separate download/cache step is needed. | |
| # sccache accelerates C++ recompilation across runs by caching object | |
| # files in the GH Actions cache backend. Only enabled on Linux/macOS | |
| # where SCCACHE_GHA_ENABLED is supported out of the box; Windows uses | |
| # the same GH Actions cache backend via SCCACHE_GHA_ENABLED=true. | |
| - name: Set up sccache (Linux) | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get install -y sccache | |
| echo "SCCACHE_GHA_ENABLED=true" >> "$GITHUB_ENV" | |
| echo "CMAKE_C_COMPILER_LAUNCHER=sccache" >> "$GITHUB_ENV" | |
| echo "CMAKE_CXX_COMPILER_LAUNCHER=sccache" >> "$GITHUB_ENV" | |
| - name: Set up sccache (macOS) | |
| if: runner.os == 'macOS' | |
| run: | | |
| brew install sccache | |
| echo "SCCACHE_GHA_ENABLED=true" >> "$GITHUB_ENV" | |
| echo "CMAKE_C_COMPILER_LAUNCHER=sccache" >> "$GITHUB_ENV" | |
| echo "CMAKE_CXX_COMPILER_LAUNCHER=sccache" >> "$GITHUB_ENV" | |
| - name: Set up sccache (Windows) | |
| if: runner.os == 'Windows' | |
| shell: pwsh | |
| run: | | |
| # sccache is preinstalled on windows-latest; just enable GH Actions backend. | |
| "SCCACHE_GHA_ENABLED=true" | Out-File -FilePath $env:GITHUB_ENV -Append | |
| "CMAKE_C_COMPILER_LAUNCHER=sccache" | Out-File -FilePath $env:GITHUB_ENV -Append | |
| "CMAKE_CXX_COMPILER_LAUNCHER=sccache" | Out-File -FilePath $env:GITHUB_ENV -Append | |
| - name: Configure CMake | |
| shell: bash | |
| run: | | |
| cmake -B build -S . \ | |
| -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \ | |
| -DSYNTHRT_BUILD_TESTS=ON \ | |
| -DCMAKE_TOOLCHAIN_FILE="${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" \ | |
| -DVCPKG_MANIFEST_DIR="${{ github.workspace }}/scripts/vcpkg-manifest" \ | |
| -DVCPKG_TARGET_TRIPLET="${{ env.VCPKG_TARGET_TRIPLET }}" | |
| - name: Build | |
| run: cmake --build build --config ${{ env.BUILD_TYPE }} --parallel | |
| - name: Test | |
| shell: bash | |
| run: | | |
| ctest --test-dir build --build-config ${{ env.BUILD_TYPE }} \ | |
| --output-on-failure --parallel 4 --timeout 300 |