Skip to content

fix(variance): auto-detect linguistic mode from ONNX model input names #16

fix(variance): auto-detect linguistic mode from ONNX model input names

fix(variance): auto-detect linguistic mode from ONNX model input names #16

Workflow file for this run

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"
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:
- uses: actions/checkout@v4
with:
submodules: recursive
# Export the GH Actions cache URL and token so that vcpkg's x-gha
# binary source can read/write compiled packages.
- 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: Install system dependencies (macOS)
if: runner.os == 'macOS'
run: |
brew install nasm yasm pkg-config
# Use the pre-installed vcpkg on GitHub-hosted runners.
# VCPKG_ROOT is set by the runner environment. This avoids the
# lukka/run-vcpkg action which sets up an isolated environment that
# may not inherit the system PATH (where nasm/yasm were installed),
# causing vcpkg_find_acquire_program to fail finding nasm.
- name: Set up vcpkg
shell: bash
run: |
echo "VCPKG_ROOT=${VCPKG_ROOT}"
if [ -z "${VCPKG_ROOT}" ]; then
echo "Error: VCPKG_ROOT is not set on the runner."
exit 1
fi
# Ensure vcpkg executable exists (bootstrap if missing).
if [ ! -x "${VCPKG_ROOT}/vcpkg" ] && [ ! -x "${VCPKG_ROOT}/vcpkg.exe" ]; then
echo "Bootstrapping vcpkg..."
if [ "${RUNNER_OS}" = "Windows" ]; then
"${VCPKG_ROOT}/bootstrap-vcpkg.bat" -disableMetrics
else
"${VCPKG_ROOT}/bootstrap-vcpkg.sh" -disableMetrics
fi
fi
echo "vcpkg version:"
"${VCPKG_ROOT}/vcpkg" version || true
- name: Cache ONNX Runtime
id: cache-ort
uses: actions/cache@v4
with:
path: build/onnxruntime
key: onnxruntime-${{ matrix.os }}-${{ runner.arch }}-1.17.3-v1
- name: Download ONNX Runtime
if: steps.cache-ort.outputs.cache-hit != 'true'
shell: cmake -P {0}
run: |
set(ws [=[${{ github.workspace }}]=])
file(TO_CMAKE_PATH "${ws}" ws)
set(CMAKE_BINARY_DIR "${ws}/build")
include(${ws}/scripts/setup-onnxruntime.cmake)
- name: Configure CMake
shell: bash
run: |
cmake -B build -S . \
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DSYNTHRT_BUILD_TESTS=ON \
-DSYNTHRT_ORT_DIR="${{ github.workspace }}/build/onnxruntime" \
-DCMAKE_TOOLCHAIN_FILE="${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" \
-DVCPKG_MANIFEST_DIR="${{ github.workspace }}/scripts/vcpkg-manifest" \
-DVCPKG_OVERLAY_PORTS="${{ github.workspace }}/scripts/vcpkg/ports" \
-DVCPKG_OVERLAY_TRIPLETS="${{ github.workspace }}/scripts/vcpkg/triplets"
- 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