unsloth/.github/workflows/studio-tauri-smoke.yml
Daniel Han 5cfbb7b6cf ci: extend supply-chain audit + smoke jobs to new lockfiles
Point the existing audit + install + content-sanity workflows at
the two lockfiles PR #5604 introduced (studio/package-lock.json
and studio/backend/core/data_recipe/oxc-validator/package-lock.json)
so the Studio Tauri CLI holder and the oxc-validator runtime
benefit from the same per-PR coverage the frontend already has.

release-desktop.yml:
  - Tauri CLI install: `npm install --save-dev --prefix studio` ->
    `npm ci --prefix studio --no-fund --no-audit`.
  - Frontend install: `npm install --no-fund --no-audit` ->
    `npm ci --no-fund --no-audit`.
  - New "Lockfile supply-chain audit" step inserted BEFORE the
    Tauri CLI install so the structural audit fires before any
    tarball-side lifecycle script.

studio-tauri-smoke.yml:
  - Tauri CLI install: `npm install --save-dev --prefix studio` ->
    `npm ci --prefix studio --no-fund --no-audit`.
  - Existing audit step relocated to run BEFORE the Tauri CLI
    install (same ordering rationale).

wheel-smoke.yml:
  - One-line content-sanity assertion ensuring the oxc-validator
    package-lock.json is shipped in the wheel.

security-audit.yml:
  - `paths` trigger gains the 4 new entries (oxc + Tauri CLI
    holder package.json + package-lock.json).
  - `Scanned:` summary string updated to list the two new
    lockfiles.
  - OSV-scanner picks up `--lockfile=` for both.
  - Two new `npm audit` steps: oxc-validator runtime + Studio
    Tauri CLI holder.
  - `npm audit signatures` block split into three (frontend / oxc
    / Tauri CLI), each preceded by `npm ci --ignore-scripts` in
    its own directory.
  - `check_new_install_scripts.py` invocation extended to diff
    both new lockfiles base->head, with `git show ... 2>/dev/null
    || echo '{}'` fallback for PRs whose base predates #5604.
  - `upload-artifact` paths extended for the new log files.

Deliberately NOT included: removing `continue-on-error` from the
existing `scan_npm_packages` job. That is a policy flip from
advisory to blocking and is orthogonal to install-path hardening.
2026-05-19 14:10:49 +00:00

130 lines
5 KiB
YAML

# SPDX-License-Identifier: AGPL-3.0-only
# Copyright 2026-present the Unsloth AI Inc. team. All rights reserved.
# PR-time smoke for the Tauri desktop wrapper. Builds the frontend and the
# Tauri Linux debug binary, with no codesigning. Catches:
# - tauri.conf.json drift
# - src-tauri Cargo.toml or rust source breakage
# - Tauri CLI version drift (we pin 2.10.1, matching release-desktop.yml)
# - frontend output not picked up by Tauri's distDir
#
# Linux-only on a free `ubuntu-latest` runner. Mac and Windows desktop builds
# stay in release-desktop.yml (manual `workflow_dispatch`) because they need
# code-signing secrets and ~30 min of runner time each.
name: Studio Tauri CI
on:
pull_request:
paths:
- 'studio/frontend/**'
- 'studio/src-tauri/**'
# CLI rename / signature change can break Tauri's spawned
# `unsloth studio` -- include unsloth_cli in the trigger set.
- 'unsloth_cli/**'
- '.github/workflows/studio-tauri-smoke.yml'
push:
branches: [main, pip]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
linux-debug-build:
name: Tauri Linux debug build (no codesign)
runs-on: ubuntu-22.04
timeout-minutes: 25
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Linux native deps for Tauri / WebKit2GTK
run: |
sudo apt-get update
sudo apt-get install -y \
libwebkit2gtk-4.1-dev libayatana-appindicator3-dev \
librsvg2-dev libxdo-dev libssl-dev patchelf
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: '24'
- uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable @ 2026-03-27
- uses: swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2.9.1
with:
workspaces: studio/src-tauri -> target
- name: Lockfile supply-chain audit (pre-install scan)
# Runs BEFORE any npm install / npm ci so the structural audit
# (lockfile_supply_chain_audit.py) catches an injection-pattern
# lockfile before a single postinstall script is executed.
run: python3 scripts/lockfile_supply_chain_audit.py
- name: Install pinned Tauri CLI (matches release-desktop.yml)
# `npm ci --prefix studio` consumes the committed
# studio/package-lock.json (shipped in #5604) and refuses to
# install if the resolved tree drifts from that lockfile. The
# pre-install audit above already verified the lockfile shape
# itself before any tarball-side lifecycle script runs.
run: npm ci --prefix studio --no-fund --no-audit
- name: Verify pinned Tauri CLI version
run: |
out="$(npx --prefix studio tauri --version)"
echo "$out"
[ "$out" = "tauri-cli 2.10.1" ] || { echo "::error::expected tauri-cli 2.10.1, got $out"; exit 1; }
- name: Frontend build (npm ci, vite)
working-directory: studio/frontend
# Lifecycle scripts (esbuild native-binary postinstall, etc.) are
# required for `vite build`. The pre-install lockfile structural
# audit (lockfile_supply_chain_audit.py) is the practical defence
# against the npm postinstall-dropper class -- it fires BEFORE any
# tarball runs, on the injection pattern itself rather than an
# advisory-DB lookup.
run: |
npm ci --no-fund --no-audit
npm run build
test -f dist/index.html
- name: Tauri debug build (Linux, no bundle, no codesign)
# `--debug` + `--no-bundle` keeps this lean: compiles the Rust crate,
# confirms the frontend dist is wired into Tauri, but skips the AppImage
# / .deb production. Code signing is irrelevant because we never produce
# a distributable artifact.
env:
TAURI_SIGNING_PRIVATE_KEY: ''
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ''
run: npx --prefix studio tauri build --debug --no-bundle
- name: Inspect produced binary
run: |
BIN=$(find studio/src-tauri/target/debug -maxdepth 1 -type f -executable 2>/dev/null \
| grep -Ev '\.(d|so|dylib|dll)$' \
| grep -Ev '/(deps|build|examples)$' \
| head -1)
echo "binary: $BIN"
if [ -z "$BIN" ]; then
echo "::error::Tauri debug binary not produced"
ls -la studio/src-tauri/target/debug/ || true
exit 1
fi
file "$BIN"
du -h "$BIN"
- name: Upload Tauri debug build
# Always upload so a green run leaves the binary inspectable too.
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: tauri-debug-build
path: |
studio/src-tauri/target/debug
studio/frontend/dist
retention-days: 3