|
| 1 | +name: Platform validation |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + pull_request: |
| 6 | + branches: |
| 7 | + - main |
| 8 | + paths: |
| 9 | + - ".github/workflows/platform-validation.yml" |
| 10 | + - "pyproject.toml" |
| 11 | + - "uv.lock" |
| 12 | + - "rust/**" |
| 13 | + - "src/**" |
| 14 | + - "scripts/certify_*.py" |
| 15 | + - "eval/voice_agent_itn/**" |
| 16 | + |
| 17 | +permissions: |
| 18 | + contents: read |
| 19 | + |
| 20 | +concurrency: |
| 21 | + group: platform-validation-${{ github.ref }} |
| 22 | + cancel-in-progress: false |
| 23 | + |
| 24 | +jobs: |
| 25 | + package: |
| 26 | + name: ${{ matrix.name }} / Python ${{ matrix.python }} |
| 27 | + runs-on: ${{ matrix.runner }} |
| 28 | + strategy: |
| 29 | + fail-fast: false |
| 30 | + matrix: |
| 31 | + include: |
| 32 | + - { name: macOS arm64, runner: macos-14, os: Darwin, arch: arm64, python: "3.11" } |
| 33 | + - { name: macOS arm64, runner: macos-14, os: Darwin, arch: arm64, python: "3.12" } |
| 34 | + - { name: macOS arm64, runner: macos-14, os: Darwin, arch: arm64, python: "3.13" } |
| 35 | + - { name: Linux x86_64, runner: ubuntu-22.04, os: Linux, arch: x86_64, python: "3.11" } |
| 36 | + - { name: Linux x86_64, runner: ubuntu-22.04, os: Linux, arch: x86_64, python: "3.12" } |
| 37 | + - { name: Linux x86_64, runner: ubuntu-22.04, os: Linux, arch: x86_64, python: "3.13" } |
| 38 | + steps: |
| 39 | + - name: Check out repository |
| 40 | + uses: actions/checkout@v4 |
| 41 | + |
| 42 | + - name: Set up Python ${{ matrix.python }} |
| 43 | + uses: actions/setup-python@v5 |
| 44 | + with: |
| 45 | + python-version: ${{ matrix.python }} |
| 46 | + |
| 47 | + - name: Set up uv |
| 48 | + uses: astral-sh/setup-uv@v5 |
| 49 | + with: |
| 50 | + enable-cache: true |
| 51 | + |
| 52 | + - name: Build macOS release wheel for the matrix interpreter |
| 53 | + if: matrix.os == 'Darwin' |
| 54 | + run: uv build --wheel --python ${{ matrix.python }} --out-dir wheelhouse |
| 55 | + |
| 56 | + - name: Build manylinux release wheel for the matrix interpreter |
| 57 | + if: matrix.os == 'Linux' |
| 58 | + uses: PyO3/maturin-action@86b9d133d34bc1b40018696f782949dac11bd380 |
| 59 | + with: |
| 60 | + command: build |
| 61 | + maturin-version: v1.11.5 |
| 62 | + target: x86_64-unknown-linux-gnu |
| 63 | + manylinux: 2_28 |
| 64 | + args: >- |
| 65 | + --release --locked --compatibility pypi |
| 66 | + --interpreter python${{ matrix.python }} |
| 67 | + --out wheelhouse |
| 68 | +
|
| 69 | + - name: Inspect release wheel |
| 70 | + shell: bash |
| 71 | + run: python scripts/inspect_release_artifact.py wheelhouse/*.whl |
| 72 | + |
| 73 | + - name: Create clean install environment |
| 74 | + shell: bash |
| 75 | + run: | |
| 76 | + set -euo pipefail |
| 77 | + uv venv --python ${{ matrix.python }} "$RUNNER_TEMP/certification-venv" |
| 78 | + uv pip install --only-binary :all: \ |
| 79 | + --python "$RUNNER_TEMP/certification-venv/bin/python" wheelhouse/*.whl |
| 80 | +
|
| 81 | + - name: Certify installed package and CLI |
| 82 | + shell: bash |
| 83 | + run: | |
| 84 | + "$RUNNER_TEMP/certification-venv/bin/python" -m \ |
| 85 | + scripts.certify_installed_platform \ |
| 86 | + --wheel "$GITHUB_WORKSPACE"/wheelhouse/*.whl \ |
| 87 | + --expected-os "${{ matrix.os }}" \ |
| 88 | + --expected-arch "${{ matrix.arch }}" \ |
| 89 | + --expected-python "${{ matrix.python }}" \ |
| 90 | + --expected-wheel-platform "${{ matrix.os == 'Linux' && 'manylinux_2_28_x86_64' || 'macosx_11_0_arm64' }}" \ |
| 91 | + --source-commit "$GITHUB_SHA" \ |
| 92 | + --output "$GITHUB_WORKSPACE/evidence/package-${{ matrix.os }}-${{ matrix.arch }}-py${{ matrix.python }}.json" |
| 93 | +
|
| 94 | + - name: Retain package evidence and wheel |
| 95 | + uses: actions/upload-artifact@v4 |
| 96 | + with: |
| 97 | + name: package-${{ matrix.os }}-${{ matrix.arch }}-py${{ matrix.python }} |
| 98 | + path: | |
| 99 | + evidence/*.json |
| 100 | + wheelhouse/*.whl |
| 101 | + if-no-files-found: error |
| 102 | + |
| 103 | + inference: |
| 104 | + name: ${{ matrix.name }} / ${{ matrix.device }} inference |
| 105 | + runs-on: ${{ matrix.runner }} |
| 106 | + timeout-minutes: 180 |
| 107 | + strategy: |
| 108 | + fail-fast: false |
| 109 | + matrix: |
| 110 | + include: |
| 111 | + - { name: Linux x86_64, runner: ubuntu-22.04, os: Linux, arch: x86_64, device: cpu, unavailable: mps } |
| 112 | + steps: |
| 113 | + - name: Check out repository |
| 114 | + uses: actions/checkout@v4 |
| 115 | + |
| 116 | + - name: Set up Python 3.11 |
| 117 | + uses: actions/setup-python@v5 |
| 118 | + with: |
| 119 | + python-version: "3.11" |
| 120 | + |
| 121 | + - name: Set up uv |
| 122 | + uses: astral-sh/setup-uv@v5 |
| 123 | + with: |
| 124 | + enable-cache: true |
| 125 | + |
| 126 | + - name: Build manylinux release wheel |
| 127 | + uses: PyO3/maturin-action@86b9d133d34bc1b40018696f782949dac11bd380 |
| 128 | + with: |
| 129 | + command: build |
| 130 | + maturin-version: v1.11.5 |
| 131 | + target: x86_64-unknown-linux-gnu |
| 132 | + manylinux: 2_28 |
| 133 | + args: >- |
| 134 | + --release --locked --compatibility pypi |
| 135 | + --interpreter python3.11 |
| 136 | + --out wheelhouse |
| 137 | +
|
| 138 | + - name: Clean-install manylinux release wheel |
| 139 | + shell: bash |
| 140 | + run: | |
| 141 | + set -euo pipefail |
| 142 | + python scripts/inspect_release_artifact.py wheelhouse/*.whl |
| 143 | + uv venv --python 3.11 "$RUNNER_TEMP/inference-venv" |
| 144 | + uv pip install --only-binary :all: \ |
| 145 | + --python "$RUNNER_TEMP/inference-venv/bin/python" wheelhouse/*.whl |
| 146 | +
|
| 147 | + - name: Download frozen model with bounded retries |
| 148 | + env: |
| 149 | + HF_HOME: ${{ runner.temp }}/huggingface |
| 150 | + HF_HUB_CACHE: ${{ runner.temp }}/huggingface/hub |
| 151 | + HF_HUB_DOWNLOAD_TIMEOUT: "120" |
| 152 | + HF_HUB_ETAG_TIMEOUT: "30" |
| 153 | + shell: bash |
| 154 | + run: | |
| 155 | + set -euo pipefail |
| 156 | + for attempt in 1 2 3; do |
| 157 | + if "$RUNNER_TEMP/inference-venv/bin/python" - <<'PY' |
| 158 | + from huggingface_hub import snapshot_download |
| 159 | + from premove_itn.contextual import DEFAULT_MODEL_ID, DEFAULT_REVISION |
| 160 | +
|
| 161 | + snapshot_download(repo_id=DEFAULT_MODEL_ID, revision=DEFAULT_REVISION) |
| 162 | + PY |
| 163 | + then |
| 164 | + exit 0 |
| 165 | + fi |
| 166 | + if [ "$attempt" -eq 3 ]; then |
| 167 | + exit 1 |
| 168 | + fi |
| 169 | + sleep 5 |
| 170 | + done |
| 171 | +
|
| 172 | + - name: Certify frozen prediction equivalence |
| 173 | + shell: bash |
| 174 | + env: |
| 175 | + HF_HOME: ${{ runner.temp }}/huggingface |
| 176 | + HF_HUB_CACHE: ${{ runner.temp }}/huggingface/hub |
| 177 | + HF_HUB_OFFLINE: "1" |
| 178 | + run: | |
| 179 | + "$RUNNER_TEMP/inference-venv/bin/python" -m \ |
| 180 | + scripts.certify_inference_backend \ |
| 181 | + --device "${{ matrix.device }}" \ |
| 182 | + --dataset "$GITHUB_WORKSPACE/eval/voice_agent_itn/voice_agent_eval.jsonl" \ |
| 183 | + --frozen-digest "$GITHUB_WORKSPACE/eval/voice_agent_itn/FROZEN.sha256" \ |
| 184 | + --reference-records "$GITHUB_WORKSPACE/eval/voice_agent_itn/results/first-evaluation/premove-itn/records.jsonl" \ |
| 185 | + --wheel "$GITHUB_WORKSPACE"/wheelhouse/*.whl \ |
| 186 | + --expected-wheel-platform manylinux_2_28_x86_64 \ |
| 187 | + --source-commit "$GITHUB_SHA" \ |
| 188 | + --unavailable-device "${{ matrix.unavailable }}" \ |
| 189 | + --output "$GITHUB_WORKSPACE/evidence/inference-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.device }}.json" |
| 190 | +
|
| 191 | + - name: Retain inference evidence |
| 192 | + if: always() |
| 193 | + uses: actions/upload-artifact@v4 |
| 194 | + with: |
| 195 | + name: inference-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.device }} |
| 196 | + path: evidence/*.json |
| 197 | + if-no-files-found: warn |
0 commit comments