159 lines
6.5 KiB
YAML
159 lines
6.5 KiB
YAML
name: PR checks
|
|
|
|
on:
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: ci-${{ github.event.pull_request.number || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
changes:
|
|
name: Detect changed scopes
|
|
# The 3090 runs branches from this private repository only.
|
|
if: github.event_name == 'workflow_dispatch' || github.event.pull_request.head.repo.full_name == github.repository
|
|
runs-on: [self-hosted, linux, x64, xiaoyi-3090]
|
|
timeout-minutes: 5
|
|
outputs:
|
|
web: ${{ steps.filter.outputs.web }}
|
|
agent: ${{ steps.filter.outputs.agent }}
|
|
rust: ${{ steps.filter.outputs.rust }}
|
|
security: ${{ steps.filter.outputs.security }}
|
|
steps:
|
|
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
|
|
with:
|
|
persist-credentials: false
|
|
fetch-depth: 0
|
|
- uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
|
|
with:
|
|
node-version: '24.22.1'
|
|
package-manager-cache: false
|
|
- name: Classify PR paths
|
|
id: filter
|
|
run: node scripts/ci/detect-pr-changes.mjs --event "${{ github.event_name }}" --base "${{ github.event.pull_request.base.sha }}" --head "${{ github.event.pull_request.head.sha || github.sha }}"
|
|
|
|
security:
|
|
name: White-label and secret leak gate
|
|
needs: changes
|
|
if: ${{ always() && needs.changes.result == 'success' && needs.changes.outputs.security == 'true' }}
|
|
runs-on: [self-hosted, linux, x64, xiaoyi-3090]
|
|
timeout-minutes: 10
|
|
steps:
|
|
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
|
|
with:
|
|
persist-credentials: false
|
|
fetch-depth: 0
|
|
- uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
|
|
with:
|
|
node-version: '24.22.1'
|
|
package-manager-cache: false
|
|
- name: Check PR diff secrets and white-label rules
|
|
run: node scripts/ci/check-pr-security.mjs --base "${{ github.event.pull_request.base.sha }}" --head "${{ github.event.pull_request.head.sha || github.sha }}"
|
|
|
|
web:
|
|
name: Web, TypeScript and script gates
|
|
needs: changes
|
|
if: ${{ always() && needs.changes.result == 'success' && needs.changes.outputs.web == 'true' }}
|
|
runs-on: [self-hosted, linux, x64, xiaoyi-3090]
|
|
timeout-minutes: 30
|
|
env:
|
|
CI: true
|
|
NEXT_TELEMETRY_DISABLED: 1
|
|
steps:
|
|
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
|
|
with:
|
|
persist-credentials: false
|
|
- uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
|
|
with:
|
|
node-version: '24.22.1'
|
|
package-manager-cache: false
|
|
- name: Install locked dependencies
|
|
id: dependencies
|
|
run: |
|
|
npm ci --legacy-peer-deps --no-audit --no-fund
|
|
npm run prisma:generate
|
|
- name: Legacy storage boundary gate
|
|
if: ${{ !cancelled() && steps.dependencies.outcome == 'success' }}
|
|
run: npm run storage:legacy-boundary
|
|
- name: TypeScript
|
|
if: ${{ !cancelled() && steps.dependencies.outcome == 'success' }}
|
|
run: npm run typecheck -- --incremental false
|
|
- name: Node script tests
|
|
if: ${{ !cancelled() && steps.dependencies.outcome == 'success' }}
|
|
run: npm run test:scripts
|
|
- name: Web tests
|
|
if: ${{ !cancelled() && steps.dependencies.outcome == 'success' }}
|
|
run: npm test -- --maxWorkers=2
|
|
|
|
agent:
|
|
name: Xiaoyi Agent JS and 20-template contract
|
|
needs: changes
|
|
if: ${{ always() && needs.changes.result == 'success' && needs.changes.outputs.agent == 'true' }}
|
|
runs-on: [self-hosted, linux, x64, xiaoyi-3090]
|
|
timeout-minutes: 20
|
|
env:
|
|
CI: true
|
|
steps:
|
|
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
|
|
with:
|
|
persist-credentials: false
|
|
- uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
|
|
with:
|
|
node-version: '24.22.1'
|
|
package-manager-cache: false
|
|
- name: Install locked agent dependencies
|
|
id: dependencies
|
|
run: npm --prefix apps/detail-agent-pi ci --no-audit --no-fund
|
|
- name: Agent tests and white-label checks
|
|
if: ${{ !cancelled() && steps.dependencies.outcome == 'success' }}
|
|
run: npm run test:agent
|
|
- name: 20-template offline contract smoke tests
|
|
if: ${{ !cancelled() && steps.dependencies.outcome == 'success' }}
|
|
run: node --test evals/xiaoyi-golden/tests/*.test.mjs
|
|
- name: Knowledge contract drift
|
|
if: ${{ !cancelled() && steps.dependencies.outcome == 'success' }}
|
|
env:
|
|
KB_SOURCE: ${{ vars.XIAOYI_KB_CONTRACT_SOURCE }}
|
|
KB_RELEASE: ${{ vars.XIAOYI_KB_CONTRACT_RELEASE }}
|
|
run: |
|
|
if [[ -z "$KB_SOURCE" && -z "$KB_RELEASE" ]]; then
|
|
echo "No snapshot paths configured. The contract smoke test runs in the Node script suite." >> "$GITHUB_STEP_SUMMARY"
|
|
else
|
|
: "${KB_SOURCE:?Set the source snapshot path}" "${KB_RELEASE:?Set the release snapshot path}"
|
|
node scripts/check-kb-contract-drift.mjs "$KB_SOURCE" "$KB_RELEASE"
|
|
fi
|
|
|
|
rust:
|
|
name: Windows Rust cross-check and core unit tests
|
|
needs: changes
|
|
if: ${{ always() && needs.changes.result == 'success' && needs.changes.outputs.rust == 'true' }}
|
|
runs-on: [self-hosted, linux, x64, xiaoyi-3090]
|
|
timeout-minutes: 45
|
|
defaults:
|
|
run:
|
|
working-directory: apps/detail-photocraft
|
|
env:
|
|
CARGO_INCREMENTAL: 0
|
|
CARGO_PROFILE_DEV_DEBUG: 0
|
|
CARGO_BUILD_JOBS: 4
|
|
CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER: x86_64-w64-mingw32-gcc-win32
|
|
CC_x86_64_pc_windows_gnu: x86_64-w64-mingw32-gcc-win32
|
|
CXX_x86_64_pc_windows_gnu: x86_64-w64-mingw32-g++-win32
|
|
steps:
|
|
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
|
|
with:
|
|
persist-credentials: false
|
|
- name: Install the Windows Rust target
|
|
run: rustup toolchain install 1.95.0 --profile minimal --target x86_64-pc-windows-gnu
|
|
- name: Check Windows client
|
|
run: rustup run 1.95.0 cargo check --locked --target x86_64-pc-windows-gnu -p photocraft --all-targets
|
|
- name: Run core crate unit tests
|
|
run: rustup run 1.95.0 cargo test --locked -p photocraft-geom -p photocraft-color -p photocraft-doc -p photocraft-format -p photocraft-ops -p photocraft-psd -p photocraft-text
|
|
- name: Clean debug artifacts to preserve runner disk
|
|
if: always()
|
|
run: rm -rf target/debug target/x86_64-pc-windows-gnu/debug
|