mirror of
https://github.com/stablyai/orca.git
synced 2026-10-01 08:01:56 +00:00
* ci: stage heavy checks and measure affected-test selection * fix(ci): exercise the real Git boundary in unit selection planning * Harden review cancellation and CI demand reporting
168 lines
5.2 KiB
YAML
168 lines
5.2 KiB
YAML
name: Unit tests
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
node_versions:
|
|
description: JSON array of Node.js major versions to test.
|
|
required: true
|
|
type: string
|
|
|
|
runner:
|
|
description: Hosted runner for the unit shards; relay integration keeps its x86 host.
|
|
required: false
|
|
default: ubuntu-latest
|
|
type: string
|
|
|
|
selection_mode:
|
|
description: Shadow validates selection; selected applies it only to draft PRs.
|
|
required: false
|
|
default: shadow
|
|
type: string
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
plan:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 5
|
|
outputs:
|
|
shards: ${{ steps.plan.outputs.shards }}
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
fetch-depth: 2
|
|
persist-credentials: false
|
|
- uses: ./.github/actions/install-node-dependencies
|
|
- name: Plan unit selection
|
|
id: plan
|
|
env:
|
|
ORCA_UNIT_SELECTION_MODE: ${{ inputs.selection_mode }}
|
|
run: node config/scripts/ci-unit-plan.mjs
|
|
- uses: actions/upload-artifact@v7
|
|
continue-on-error: true
|
|
with:
|
|
name: unit-selection-attempt-${{ github.run_attempt }}
|
|
path: ci-shards/unit-selection.json
|
|
retention-days: 14
|
|
|
|
test:
|
|
needs: plan
|
|
name: tests node ${{ matrix.node }} ${{ matrix.shard.index }}/${{ matrix.shard.count }}
|
|
runs-on: ${{ inputs.runner }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
node: ${{ fromJSON(inputs.node_versions) }}
|
|
shard: ${{ fromJSON(needs.plan.outputs.shards) }}
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- uses: ./.github/actions/install-node-dependencies
|
|
with:
|
|
native-runtime: node
|
|
node-version: ${{ matrix.node }}
|
|
cache-electron-package: 'true'
|
|
|
|
- name: Install Electron package binary for tests
|
|
run: node config/scripts/install-electron-package-binary.mjs
|
|
|
|
- uses: actions/download-artifact@v8
|
|
continue-on-error: true
|
|
with:
|
|
name: unit-selection-attempt-${{ github.run_attempt }}
|
|
path: ci-shards/
|
|
|
|
- name: Test shard
|
|
env:
|
|
ORCA_BALANCE_UNIT_SHARDS: '1'
|
|
ORCA_BACKGROUND_LAUNCH: '1'
|
|
run: |
|
|
export ORCA_SHARD_SOURCE_SHA="$(git rev-parse HEAD)"
|
|
pnpm exec vitest run --config config/vitest.config.ts \
|
|
--shard=${{ matrix.shard.index }}/${{ matrix.shard.count }}
|
|
|
|
- name: Upload unit shard assignment
|
|
if: always()
|
|
# Diagnostic upload outages must not change the test verdict.
|
|
continue-on-error: true
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: unit-shard-node-${{ matrix.node }}-${{ matrix.shard.index }}-attempt-${{ github.run_attempt }}
|
|
path: ci-shards/
|
|
retention-days: 14
|
|
if-no-files-found: warn
|
|
|
|
selection_evidence:
|
|
needs: test
|
|
if: ${{ !cancelled() }}
|
|
continue-on-error: true
|
|
runs-on: ubuntu-slim
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
sparse-checkout: config/scripts/ci-unit-selection-review.mjs
|
|
sparse-checkout-cone-mode: false
|
|
persist-credentials: false
|
|
- uses: actions/setup-node@v6
|
|
with:
|
|
node-version: '24'
|
|
- uses: actions/download-artifact@v8
|
|
with:
|
|
pattern: unit-shard-node-*-attempt-${{ github.run_attempt }}
|
|
path: unit-evidence/
|
|
- name: Compare selection with full results
|
|
continue-on-error: true
|
|
run: node config/scripts/ci-unit-selection-review.mjs unit-evidence
|
|
- uses: actions/upload-artifact@v7
|
|
if: always()
|
|
continue-on-error: true
|
|
with:
|
|
name: unit-selection-review-attempt-${{ github.run_attempt }}
|
|
path: unit-evidence/selection-review.json
|
|
retention-days: 30
|
|
|
|
relay_integration:
|
|
name: relay integration node ${{ matrix.node }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
node: ${{ fromJSON(inputs.node_versions) }}
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- uses: ./.github/actions/install-node-dependencies
|
|
with:
|
|
native-runtime: node
|
|
node-version: ${{ matrix.node }}
|
|
cache-electron-package: 'true'
|
|
cache-dependency-path: |
|
|
pnpm-lock.yaml
|
|
cloud/pnpm-lock.yaml
|
|
|
|
# These two tests import the cloud relay workspace directly. Keeping them in one job
|
|
# avoids installing and building the same workspace once per unit-test shard.
|
|
- name: Install relay integration dependencies
|
|
working-directory: cloud
|
|
run: |
|
|
npx --yes pnpm@10.24.0 --filter '@orca-cloud/relay...' install --frozen-lockfile --ignore-scripts
|
|
npx --yes pnpm@10.24.0 --filter '@orca-cloud/relay^...' build
|
|
|
|
- name: Test relay integration contracts
|
|
env:
|
|
ORCA_BACKGROUND_LAUNCH: '1'
|
|
run: >-
|
|
pnpm exec vitest run --config config/vitest.config.ts
|
|
tests/e2e/relay-region-compatibility.unit.test.ts
|
|
tests/e2e/relay-region-correction.unit.test.ts
|