Files
codex-security/.github/workflows/native-windows.yml
Michael D'Angelo 2d50d7aff8 chore(deps): reduce the dependency tree for evals, SDK and tooling (#2409)
* chore(deps): reduce the dependency tree for evals, SDK and tooling

* docs(evals): explain how to enable optional Promptfoo peers
2026-11-06 18:08:28 -08:00

116 lines
4.9 KiB
YAML

name: native-windows
on:
workflow_call:
inputs:
ref:
description: Source commit to build; defaults to the calling workflow commit.
type: string
default: ""
permissions:
contents: read
jobs:
primitives:
name: primitives / win32-${{ matrix.arch }}
runs-on: ${{ matrix.runner }}
timeout-minutes: 30
env:
CODEX_SECURITY_TEST_WINDOWS_SYMLINKS: required
strategy:
fail-fast: false
matrix:
include:
- runner: windows-2022
arch: x64
target: x86_64-pc-windows-msvc
- runner: windows-11-arm
arch: arm64
target: aarch64-pc-windows-msvc
defaults:
run:
shell: pwsh
working-directory: plugins/codex-security/native
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ inputs.ref || github.sha }}
persist-credentials: false
- name: Set up TypeScript tools
uses: ./.github/actions/setup-tools
with:
architecture: ${{ matrix.arch }}
compile: true
cache-dependency-path: plugins/codex-security/mcp-app/pnpm-lock.yaml
# Earlier checkouts compile with the SDK and install the helper separately.
- name: Install helper dependencies for an alternate source commit
if: inputs.ref != '' && inputs.ref != github.sha
working-directory: .
run: pnpm --dir plugins/codex-security/mcp-app install --frozen-lockfile
- name: Set up Rust
run: rustup toolchain install 1.97.1 --profile minimal --component rustfmt --component clippy --target ${{ matrix.target }}
- name: Check Rust source
run: |
cargo fmt --check
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
cargo clippy --locked --target ${{ matrix.target }} --lib --example windows-wide-launcher -- -D warnings
- name: Build and verify with Node.js 22
run: |
node build.mjs
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
node proof-policy-windows.mjs build
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
node check.mjs
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
node --test windows-files.test.mjs
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
$nativeNode = (Get-Command node).Source
$env:PATH = ""
& $nativeNode --expose-gc proof-windows.mjs
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
& $nativeNode proof-policy-windows.mjs
- name: Verify Windows proofs without symbolic links
env:
CODEX_SECURITY_TEST_WINDOWS_SYMLINKS: disabled
run: |
$nativeNode = (Get-Command node).Source
$env:PATH = ""
$primitivesJson = & $nativeNode --expose-gc proof-windows.mjs
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
$primitives = $primitivesJson | ConvertFrom-Json
if ($primitives.wideProcessAndPaths.cachedSymlinkTagsIncludingDanglingDirectories -ne $false -or $primitives.wideProcessAndPaths.completeWideDirectoryIteration -ne $true -or $primitives.handles.junctionMetadataAndFinalNames -ne $true) {
throw "The restricted proof did not report skipped symbolic links and verified directory and junction coverage."
}
$policyJson = & $nativeNode proof-policy-windows.mjs
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
$policy = $policyJson | ConvertFrom-Json
if ($policy.proof.policySymlinkBoundary -ne $false -or $policy.proof.directoryIdentity -ne $true -or $policy.proof.policyHelperRawPaths -ne $true) {
throw "The restricted policy proof did not report skipped symbolic links and verified directory identity."
}
- name: Set up Node.js 20
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: "20.0.0"
architecture: ${{ matrix.arch }}
- name: Verify the same artifact with Node.js 20
run: |
node check.mjs
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
node --test windows-files.test.mjs
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
$nativeNode = (Get-Command node).Source
$env:PATH = ""
& $nativeNode --expose-gc proof-windows.mjs
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
& $nativeNode proof-policy-windows.mjs
- name: Upload verified native artifact
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: native-platform-win32-${{ matrix.arch }}-${{ inputs.ref || github.sha }}
path: plugins/codex-security/native/dist/*/*.node
if-no-files-found: error
overwrite: true
retention-days: 7