# Builds and tests the legacy C++ runtime's Rust XMA2 FFI crate (runtime/xma_decoder/). # The legacy C++ Vulkan runtime/ is deprecated in favor of the Rust DX12 runtime (d3d12/) and the new Rust Vulkan # runtime (in progress), so automatic push and pull_request CI runs are disabled. Trigger manually via # workflow_dispatch when needed. name: XMA2 decoder on: workflow_dispatch: permissions: contents: read concurrency: # Each manual dispatch gets its own group so runs do not cancel each other. group: xma2-decoder-${{ github.event_name }}-${{ github.run_id }} cancel-in-progress: false jobs: windows-ffi: runs-on: windows-latest timeout-minutes: 15 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: Identify Rust toolchain id: rust-toolchain shell: bash run: | rustc_hash=$(rustc -vV | tr -d '\r' | awk '/^commit-hash: /{print $2}') test -n "$rustc_hash" echo "rustc-hash=$rustc_hash" >> "$GITHUB_OUTPUT" rustc --version - name: Cache Cargo dependencies and build uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: path: | ~/.cargo/registry ~/.cargo/git ${{ runner.temp }}/leonida-xma2-target key: xma2-decoder-cargo-${{ runner.os }}-${{ steps.rust-toolchain.outputs.rustc-hash }}-${{ hashFiles('runtime/xma_decoder/Cargo.lock') }} restore-keys: | xma2-decoder-cargo-${{ runner.os }}-${{ steps.rust-toolchain.outputs.rustc-hash }}- xma2-decoder-cargo-${{ runner.os }}- - uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 - name: Run synthetic Rust FFI tests shell: pwsh run: | $env:CARGO_TARGET_DIR = Join-Path $env:RUNNER_TEMP "leonida-xma2-target" cargo fmt --manifest-path runtime/xma_decoder/Cargo.toml -- --check if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } cargo test --manifest-path runtime/xma_decoder/Cargo.toml --locked if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - name: Link and run the synthetic C++ ABI smoke test shell: pwsh run: | $env:CARGO_TARGET_DIR = Join-Path $env:RUNNER_TEMP "leonida-xma2-target" cargo build --manifest-path runtime/xma_decoder/Cargo.toml --locked if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } $library = Join-Path $env:CARGO_TARGET_DIR "debug\leonida_xma2_decoder.lib" $smoke = Join-Path $env:RUNNER_TEMP "leonida-xma2-ffi-smoke.exe" cl /nologo /std:c++20 /EHsc /W4 /DNDEBUG /I runtime/xma_decoder runtime/xma_decoder/tests/ffi_cpp_smoke.cpp $library "/Fe:$smoke" ws2_32.lib userenv.lib ntdll.lib synchronization.lib if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } & $smoke if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }