426e9eeabd
Benchmark Bridge Tests / benchmark (bunx @biomejs/biome check packages/lifeops-bench/src, benchmark-lint) (push) Waiting to run
Benchmark Bridge Tests / benchmark (bunx vitest run --config packages/lifeops-bench/vitest.config.ts --root packages/lifeops-bench --passWithNoTests, benchmark-tests) (push) Waiting to run
Build Agent Image / build-and-push (push) Waiting to run
Chat shell gestures / Chat shell gesture + parity e2e (push) Waiting to run
ci / test (push) Waiting to run
ci / lint-and-format (push) Waiting to run
ci / build (push) Waiting to run
ci / dev-startup (push) Waiting to run
Cloud Gateway Discord / Test (push) Waiting to run
Cloud Gateway Webhook / Test (push) Waiting to run
Cloud Tests / lint-and-types (push) Waiting to run
Cloud Tests / unit-tests (push) Waiting to run
Cloud Tests / integration-tests (push) Waiting to run
Cloud Tests / e2e-tests (push) Blocked by required conditions
CodeQL Advanced / Analyze (javascript-typescript) (push) Waiting to run
Deploy Apps Worker (Product 2) / Determine environment (push) Waiting to run
Deploy Apps Worker (Product 2) / Deploy apps worker to apps-control host (${{ needs.determine-env.outputs.environment }}) (push) Blocked by required conditions
Deploy Eliza Provisioning Worker / Determine environment (push) Waiting to run
Deploy Eliza Provisioning Worker / Deploy worker to Hetzner host (${{ needs.determine-env.outputs.environment }} @ ${{ needs.determine-env.outputs.deployment_sha }}) (push) Blocked by required conditions
Dev Smoke / Classify changed paths (push) Waiting to run
Dev Smoke / bun run dev onboarding chat (push) Blocked by required conditions
Dev Smoke / Vite HMR dependency-level smoke (push) Blocked by required conditions
Electrobun Submodule Guard / electrobun gitlink is fetchable (push) Waiting to run
gitleaks / gitleaks (push) Waiting to run
Markdown Links / Relative Markdown Links (push) Waiting to run
Publish @elizaos/example-code / check_npm (push) Waiting to run
Publish @elizaos/example-code / publish_npm (push) Blocked by required conditions
Publish @elizaos/plugin-elizacloud / verify_version (push) Waiting to run
Publish @elizaos/plugin-elizacloud / publish_npm (push) Blocked by required conditions
Quality (Extended) / Homepage Build (PR smoke) (push) Waiting to run
Quality (Extended) / Comment-only diff guard (push) Waiting to run
Quality (Extended) / Format + Type Safety Ratchet (push) Waiting to run
Quality (Extended) / Develop Gate (secret scan + UI determinism) (push) Waiting to run
Quality (Extended) / Develop Gate (lint) (push) Waiting to run
Sandbox Live Smoke / Sandbox live smoke (push) Waiting to run
Snap Build & Test / Build Snap (amd64) (push) Waiting to run
Snap Build & Test / Build Snap (arm64) (push) Waiting to run
supply-chain / sbom (push) Waiting to run
supply-chain / vulnerability-scan (push) Waiting to run
Build, Push & Deploy to Phala Cloud / build-and-push (push) Waiting to run
Test Packaging / Validate Packaging Configs (push) Waiting to run
Test Packaging / PyPI on Python ${{ matrix.python }} (push) Waiting to run
Test Packaging / Pack & Test JS Tarballs (push) Waiting to run
Test Packaging / elizaos CLI global-install smoke (node + bun) (push) Waiting to run
UI Fixture E2E / ui-fixture-e2e (push) Waiting to run
UI Fixture E2E / fixture-e2e (push) Waiting to run
UI Story Gate / story-gate (push) Waiting to run
vault-ci / test (macos-latest) (push) Waiting to run
vault-ci / test (ubuntu-latest) (push) Waiting to run
vault-ci / test (windows-latest) (push) Waiting to run
vault-ci / app-core wiring tests (push) Waiting to run
verify-patches / verify patches/CHECKSUMS.sha256 (push) Waiting to run
Voice Benchmark Smoke / voice-emotion fixture smoke (push) Waiting to run
Voice Benchmark Smoke / voiceagentbench fixture smoke (push) Waiting to run
Voice Benchmark Smoke / voicebench-quality unit smoke (push) Waiting to run
Voice Benchmark Smoke / voicebench TypeScript unit (no audio) (push) Waiting to run
Voice Benchmark Smoke / voice bench smoke summary (push) Blocked by required conditions
Windows CI / windows ([bun run --cwd packages/app-core test bun run --cwd packages/elizaos test bun run --cwd packages/cloud/shared test], app-and-cli) (push) Waiting to run
Windows CI / windows ([bun run --cwd packages/scenario-runner test bun run --cwd packages/vault test bun run --cwd packages/security test bun run --cwd plugins/plugin-coding-tools test], framework-packages) (push) Waiting to run
Windows CI / windows ([bun run --cwd plugins/plugin-elizacloud test bun run --cwd plugins/plugin-discord test bun run --cwd plugins/plugin-anthropic test bun run --cwd plugins/plugin-openai test bun run --cwd plugins/plugin-app-control test bun run --cwd plugins/pl… (push) Waiting to run
Windows CI / windows ([node packages/scripts/run-turbo.mjs run build --filter=@elizaos/core --filter=@elizaos/shared --filter=@elizaos/agent --concurrency=4 node packages/scripts/run-bash-linux-only.mjs scripts/verify-riscv64-buildpaths.sh node packages/scripts/run… (push) Waiting to run
Windows CI / windows ([node packages/scripts/run-turbo.mjs run typecheck --filter=@elizaos/core --filter=@elizaos/shared --filter=@elizaos/cloud-shared --concurrency=4 bun run --cwd packages/core test bun run --cwd packages/shared test], core-runtime, 75) (push) Waiting to run
Test Packaging / Build & Test PyPI Package (push) Waiting to run
Voice Workbench / headless workbench (mocked backends) (push) Has been cancelled
Voice Workbench / real acoustic lane (nightly, provisioned only) (push) Has been cancelled
182 lines
8.5 KiB
YAML
182 lines
8.5 KiB
YAML
name: coverage-gate
|
|
|
|
# SOC2 CC4.1 — track unit-test coverage on changed files. ENFORCED (issue #9943):
|
|
# a PR that changes source under packages/plugins/apps must change at least one
|
|
# unit test that can emit coverage. Every surviving changed executable source
|
|
# must appear in LCOV and clear the line-coverage floor. A source-aware
|
|
# classifier strips TypeScript-only syntax before excluding modules with no
|
|
# runtime code; declarations and deleted files are not targets. LCOV LF:0 never
|
|
# proves type-only status. Source covered only by e2e/live lanes still needs a
|
|
# focused unit test in this gate. Docs-only PRs do not spend coverage time.
|
|
# Standalone Node self-tests are excluded only when listed in the manifest that
|
|
# the Develop PR Test Integrity job executes on every PR.
|
|
# A test-only PR (changed tests, no changed source) executes its changed tests —
|
|
# gating the run steps on changed *source* let such PRs go vacuously green with
|
|
# the new test never running (#15849); the per-file floor simply has no source
|
|
# to enforce against.
|
|
#
|
|
# The per-package coverage floors live in the shared base vitest config
|
|
# (packages/test/vitest/default.config.ts, sourced from coverage-policy.mjs) and
|
|
# apply on a `--coverage` run. This changed-files gate is the second layer: it
|
|
# enforces a per-changed-file floor (`threshold` below), set to a ratchetable 50%
|
|
# — raise it toward the long-term 70% target as suites fill in. See issue #9943
|
|
# (the umbrella) and #10104 for the broader test-gating audit.
|
|
|
|
on:
|
|
pull_request:
|
|
branches: [develop, main]
|
|
paths:
|
|
- "packages/**"
|
|
- "plugins/**"
|
|
- "apps/**"
|
|
|
|
# cancel superseded in-flight runs for the same PR to free hosted-runner
|
|
# capacity. only cancels pull_request runs; push runs on protected branches
|
|
# (main/develop) are never cancelled mid-flight.
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
env:
|
|
NODE_VERSION: "24.15.0"
|
|
|
|
jobs:
|
|
coverage:
|
|
name: coverage on changed files
|
|
runs-on: ${{ fromJSON(vars.HETZNER_FLEET_ONLINE == 'false' && '["ubuntu-24.04"]' || '["self-hosted","hetzner-robot"]') }}
|
|
steps:
|
|
- name: Checkout
|
|
# actions/checkout@v4
|
|
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Setup Node.js for source classification
|
|
# The classifier is Node-based and runs before optional Bun workspace
|
|
# setup, including for JSON-only PRs on runners without system Node.
|
|
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e
|
|
with:
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
|
|
- name: Determine changed files
|
|
id: changed
|
|
# Three-dot diff (merge-base..HEAD) so a branch trailing develop does not
|
|
# count develop-side files it never touched. Logic lives in the script so
|
|
# its path/diff boundary rules are regression-tested (issue #15845).
|
|
run: |
|
|
bash scripts/security/coverage-changed-files.sh \
|
|
"${{ github.event.pull_request.base.sha }}" \
|
|
"${{ github.event.pull_request.head.sha }}" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Require changed tests for changed source
|
|
if: steps.changed.outputs.files != '' && steps.changed.outputs.bun_tests == '' && steps.changed.outputs.vitest_tests == '' && steps.changed.outputs.node_tests == ''
|
|
run: |
|
|
echo "Changed source files require at least one changed Bun or Vitest unit test:"
|
|
printf '%s\n' "${{ steps.changed.outputs.files }}"
|
|
exit 1
|
|
|
|
- name: Setup Bun workspace
|
|
if: steps.changed.outputs.bun_tests != '' || steps.changed.outputs.vitest_tests != ''
|
|
# Keep dependency setup behind the changed-test check so docs-only and
|
|
# test-free source PRs either skip or fail before spending setup time.
|
|
# Not gated on changed source: a test-only PR (files == '') must still
|
|
# execute its changed tests, or the suite goes vacuously green (#15849).
|
|
uses: ./.github/actions/setup-bun-workspace
|
|
with:
|
|
install-native-deps: "false"
|
|
install-protoc: "false"
|
|
setup-python: "false"
|
|
|
|
- name: Run changed registered Node self-tests
|
|
if: steps.changed.outputs.node_tests != ''
|
|
run: |
|
|
while IFS= read -r self_test; do
|
|
[ -n "$self_test" ] || continue
|
|
node "$self_test"
|
|
done <<'EOF'
|
|
${{ steps.changed.outputs.node_tests }}
|
|
EOF
|
|
|
|
- name: Run changed Bun tests with coverage
|
|
if: steps.changed.outputs.bun_tests != ''
|
|
run: |
|
|
cat > "$RUNNER_TEMP/changed-tests.txt" <<'EOF'
|
|
${{ steps.changed.outputs.bun_tests }}
|
|
EOF
|
|
mapfile -t changed_tests < <(grep -v '^$' "$RUNNER_TEMP/changed-tests.txt" || true)
|
|
if [ "${#changed_tests[@]}" -eq 0 ]; then
|
|
echo "no changed Bun-native test files; skipping coverage run"
|
|
exit 0
|
|
fi
|
|
shared_tests=()
|
|
process_isolated_tests=()
|
|
for test_file in "${changed_tests[@]}"; do
|
|
case "$test_file" in
|
|
packages/cloud/api/v1/voice/session/__tests__/harness-real-server.test.ts|packages/tools/voice-evidence-harness/src/cli-run.test.ts)
|
|
process_isolated_tests+=("$test_file")
|
|
;;
|
|
*) shared_tests+=("$test_file") ;;
|
|
esac
|
|
done
|
|
# This lane runs before workspace builds, so package defaults point at
|
|
# absent dist files; source exports keep changed tests self-contained.
|
|
if [ "${#shared_tests[@]}" -gt 0 ]; then
|
|
bun test --conditions=eliza-source "${shared_tests[@]}" --coverage --coverage-reporter=lcov --coverage-dir=coverage/bun/shared
|
|
fi
|
|
# Bun module mocks remain process-global despite `--isolate`. Tests
|
|
# listed here run in fresh processes and emit separate LCOV files;
|
|
# the gate below already aggregates every coverage/**/lcov.info.
|
|
for index in "${!process_isolated_tests[@]}"; do
|
|
ELIZA_PROCESS_ISOLATED_TEST=1 bun test --conditions=eliza-source "${process_isolated_tests[$index]}" --coverage --coverage-reporter=lcov --coverage-dir="coverage/bun/isolated-$index"
|
|
done
|
|
env:
|
|
# Tests must produce LCOV under this coverage root; the enforced gate
|
|
# recursively aggregates process-isolated and shared outputs.
|
|
BUN_COVERAGE_DIR: coverage/bun
|
|
|
|
- name: Build core for changed Vitest tests
|
|
if: steps.changed.outputs.vitest_tests != ''
|
|
# Vitest package configs may exercise source graphs that still depend on
|
|
# the standard built core/logger/contracts/cloud-routing entrypoints.
|
|
run: bun run --cwd packages/core build
|
|
|
|
- name: Run changed Vitest tests with coverage
|
|
if: steps.changed.outputs.vitest_tests != ''
|
|
run: |
|
|
cat > "$RUNNER_TEMP/changed-vitest-tests.txt" <<'EOF'
|
|
${{ steps.changed.outputs.vitest_tests }}
|
|
EOF
|
|
mapfile -t changed_tests < <(grep -v '^$' "$RUNNER_TEMP/changed-vitest-tests.txt" || true)
|
|
if [ "${#changed_tests[@]}" -eq 0 ]; then
|
|
echo "no changed Vitest test files; skipping coverage run"
|
|
exit 0
|
|
fi
|
|
node packages/scripts/run-changed-vitest-coverage.mjs "${changed_tests[@]}"
|
|
|
|
- name: Apply coverage gate (enforced)
|
|
# Runs whenever changed tests ran, including test-only PRs (files == '').
|
|
# With no changed source, executing the changed tests is the gate:
|
|
# Bun may not emit LCOV when it only ran tests, and there is no per-file
|
|
# floor to enforce (#15849).
|
|
if: steps.changed.outputs.bun_tests != '' || steps.changed.outputs.vitest_tests != '' || steps.changed.outputs.node_tests != ''
|
|
env:
|
|
COVERAGE_GATE_ENFORCE: "1" # enforced (issue #9943)
|
|
run: |
|
|
mapfile -t lcov_files < <(find coverage -name lcov.info -type f | sort)
|
|
if [ "${#lcov_files[@]}" -eq 0 ]; then
|
|
if [ -z "${{ steps.changed.outputs.files }}" ]; then
|
|
echo "changed tests ran; no changed source files require LCOV enforcement"
|
|
exit 0
|
|
fi
|
|
echo "changed tests ran but no coverage/lcov.info files were produced"
|
|
exit 1
|
|
fi
|
|
awk \
|
|
-v changed="${{ steps.changed.outputs.files }}" \
|
|
-v threshold=50 \
|
|
-f scripts/security/coverage-gate.awk \
|
|
"${lcov_files[@]}"
|