upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/.github/workflows/xma2-decoder.yml
blob: 4f9d44480d3d4438d90b388fd16390c2cad1fd80 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# 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 }