up
Some checks failed
Docs CI / lint-and-preview (push) Has been cancelled
Signals CI & Image / signals-ci (push) Has been cancelled
Signals Reachability Scoring & Events / reachability-smoke (push) Has been cancelled
Signals Reachability Scoring & Events / sign-and-upload (push) Has been cancelled
AOC Guard CI / aoc-guard (push) Has been cancelled
AOC Guard CI / aoc-verify (push) Has been cancelled
Reachability Corpus Validation / validate-corpus (push) Has been cancelled
Reachability Corpus Validation / validate-ground-truths (push) Has been cancelled
Scanner Analyzers / Discover Analyzers (push) Has been cancelled
Scanner Analyzers / Validate Test Fixtures (push) Has been cancelled
Reachability Corpus Validation / determinism-check (push) Has been cancelled
Scanner Analyzers / Build Analyzers (push) Has been cancelled
Scanner Analyzers / Test Language Analyzers (push) Has been cancelled
Scanner Analyzers / Verify Deterministic Output (push) Has been cancelled
Notify Smoke Test / Notify Unit Tests (push) Has been cancelled
Notify Smoke Test / Notifier Service Tests (push) Has been cancelled
Notify Smoke Test / Notification Smoke Test (push) Has been cancelled
Policy Lint & Smoke / policy-lint (push) Has been cancelled
Some checks failed
Docs CI / lint-and-preview (push) Has been cancelled
Signals CI & Image / signals-ci (push) Has been cancelled
Signals Reachability Scoring & Events / reachability-smoke (push) Has been cancelled
Signals Reachability Scoring & Events / sign-and-upload (push) Has been cancelled
AOC Guard CI / aoc-guard (push) Has been cancelled
AOC Guard CI / aoc-verify (push) Has been cancelled
Reachability Corpus Validation / validate-corpus (push) Has been cancelled
Reachability Corpus Validation / validate-ground-truths (push) Has been cancelled
Scanner Analyzers / Discover Analyzers (push) Has been cancelled
Scanner Analyzers / Validate Test Fixtures (push) Has been cancelled
Reachability Corpus Validation / determinism-check (push) Has been cancelled
Scanner Analyzers / Build Analyzers (push) Has been cancelled
Scanner Analyzers / Test Language Analyzers (push) Has been cancelled
Scanner Analyzers / Verify Deterministic Output (push) Has been cancelled
Notify Smoke Test / Notify Unit Tests (push) Has been cancelled
Notify Smoke Test / Notifier Service Tests (push) Has been cancelled
Notify Smoke Test / Notification Smoke Test (push) Has been cancelled
Policy Lint & Smoke / policy-lint (push) Has been cancelled
This commit is contained in:
@@ -56,10 +56,41 @@ jobs:
|
||||
dotnet build src/Authority/StellaOps.Authority.Ingestion/StellaOps.Authority.Ingestion.csproj -c Release /p:RunAnalyzers=true /p:TreatWarningsAsErrors=true
|
||||
dotnet build src/Excititor/StellaOps.Excititor.Ingestion/StellaOps.Excititor.Ingestion.csproj -c Release /p:RunAnalyzers=true /p:TreatWarningsAsErrors=true
|
||||
|
||||
- name: Run analyzer tests
|
||||
- name: Run analyzer tests with coverage
|
||||
run: |
|
||||
mkdir -p $ARTIFACT_DIR
|
||||
dotnet test src/Aoc/__Tests/StellaOps.Aoc.Analyzers.Tests/StellaOps.Aoc.Analyzers.Tests.csproj -c Release --logger "trx;LogFileName=aoc-tests.trx" --results-directory $ARTIFACT_DIR
|
||||
dotnet test src/Aoc/__Tests/StellaOps.Aoc.Analyzers.Tests/StellaOps.Aoc.Analyzers.Tests.csproj -c Release \
|
||||
--settings src/Aoc/aoc.runsettings \
|
||||
--collect:"XPlat Code Coverage" \
|
||||
--logger "trx;LogFileName=aoc-analyzers-tests.trx" \
|
||||
--results-directory $ARTIFACT_DIR
|
||||
|
||||
- name: Run AOC library tests with coverage
|
||||
run: |
|
||||
dotnet test src/Aoc/__Tests/StellaOps.Aoc.Tests/StellaOps.Aoc.Tests.csproj -c Release \
|
||||
--settings src/Aoc/aoc.runsettings \
|
||||
--collect:"XPlat Code Coverage" \
|
||||
--logger "trx;LogFileName=aoc-lib-tests.trx" \
|
||||
--results-directory $ARTIFACT_DIR
|
||||
|
||||
- name: Run AOC CLI tests with coverage
|
||||
run: |
|
||||
dotnet test src/Aoc/__Tests/StellaOps.Aoc.Cli.Tests/StellaOps.Aoc.Cli.Tests.csproj -c Release \
|
||||
--settings src/Aoc/aoc.runsettings \
|
||||
--collect:"XPlat Code Coverage" \
|
||||
--logger "trx;LogFileName=aoc-cli-tests.trx" \
|
||||
--results-directory $ARTIFACT_DIR
|
||||
|
||||
- name: Generate coverage report
|
||||
run: |
|
||||
dotnet tool install --global dotnet-reportgenerator-globaltool || true
|
||||
reportgenerator \
|
||||
-reports:"$ARTIFACT_DIR/**/coverage.cobertura.xml" \
|
||||
-targetdir:"$ARTIFACT_DIR/coverage-report" \
|
||||
-reporttypes:"Html;Cobertura;TextSummary" || true
|
||||
if [ -f "$ARTIFACT_DIR/coverage-report/Summary.txt" ]; then
|
||||
cat "$ARTIFACT_DIR/coverage-report/Summary.txt"
|
||||
fi
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
@@ -96,13 +127,37 @@ jobs:
|
||||
- name: Run AOC verify
|
||||
env:
|
||||
STAGING_MONGO_URI: ${{ secrets.STAGING_MONGO_URI || vars.STAGING_MONGO_URI }}
|
||||
STAGING_POSTGRES_URI: ${{ secrets.STAGING_POSTGRES_URI || vars.STAGING_POSTGRES_URI }}
|
||||
run: |
|
||||
if [ -z "${STAGING_MONGO_URI:-}" ]; then
|
||||
echo "::warning::STAGING_MONGO_URI not set; skipping aoc verify"
|
||||
mkdir -p $ARTIFACT_DIR
|
||||
|
||||
# Prefer PostgreSQL, fall back to MongoDB (legacy)
|
||||
if [ -n "${STAGING_POSTGRES_URI:-}" ]; then
|
||||
echo "Using PostgreSQL for AOC verification"
|
||||
dotnet run --project src/Aoc/StellaOps.Aoc.Cli -- verify \
|
||||
--since "$AOC_VERIFY_SINCE" \
|
||||
--postgres "$STAGING_POSTGRES_URI" \
|
||||
--output "$ARTIFACT_DIR/aoc-verify.json" \
|
||||
--ndjson "$ARTIFACT_DIR/aoc-verify.ndjson" \
|
||||
--verbose || VERIFY_EXIT=$?
|
||||
elif [ -n "${STAGING_MONGO_URI:-}" ]; then
|
||||
echo "Using MongoDB for AOC verification (deprecated)"
|
||||
dotnet run --project src/Aoc/StellaOps.Aoc.Cli -- verify \
|
||||
--since "$AOC_VERIFY_SINCE" \
|
||||
--mongo "$STAGING_MONGO_URI" \
|
||||
--output "$ARTIFACT_DIR/aoc-verify.json" \
|
||||
--ndjson "$ARTIFACT_DIR/aoc-verify.ndjson" \
|
||||
--verbose || VERIFY_EXIT=$?
|
||||
else
|
||||
echo "::warning::Neither STAGING_POSTGRES_URI nor STAGING_MONGO_URI set; running dry-run verification"
|
||||
dotnet run --project src/Aoc/StellaOps.Aoc.Cli -- verify \
|
||||
--since "$AOC_VERIFY_SINCE" \
|
||||
--postgres "placeholder" \
|
||||
--dry-run \
|
||||
--verbose
|
||||
exit 0
|
||||
fi
|
||||
mkdir -p $ARTIFACT_DIR
|
||||
dotnet run --project src/Aoc/StellaOps.Aoc.Cli -- verify --since "$AOC_VERIFY_SINCE" --mongo "$STAGING_MONGO_URI" --output "$ARTIFACT_DIR/aoc-verify.json" --ndjson "$ARTIFACT_DIR/aoc-verify.ndjson" || VERIFY_EXIT=$?
|
||||
|
||||
if [ -n "${VERIFY_EXIT:-}" ] && [ "${VERIFY_EXIT}" -ne 0 ]; then
|
||||
echo "::error::AOC verify reported violations"; exit ${VERIFY_EXIT}
|
||||
fi
|
||||
|
||||
267
.gitea/workflows/reachability-corpus-ci.yml
Normal file
267
.gitea/workflows/reachability-corpus-ci.yml
Normal file
@@ -0,0 +1,267 @@
|
||||
name: Reachability Corpus Validation
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [ main ]
|
||||
paths:
|
||||
- 'tests/reachability/corpus/**'
|
||||
- 'tests/reachability/fixtures/**'
|
||||
- 'tests/reachability/StellaOps.Reachability.FixtureTests/**'
|
||||
- 'scripts/reachability/**'
|
||||
- '.gitea/workflows/reachability-corpus-ci.yml'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'tests/reachability/corpus/**'
|
||||
- 'tests/reachability/fixtures/**'
|
||||
- 'tests/reachability/StellaOps.Reachability.FixtureTests/**'
|
||||
- 'scripts/reachability/**'
|
||||
- '.gitea/workflows/reachability-corpus-ci.yml'
|
||||
|
||||
jobs:
|
||||
validate-corpus:
|
||||
runs-on: ubuntu-22.04
|
||||
env:
|
||||
DOTNET_NOLOGO: 1
|
||||
DOTNET_CLI_TELEMETRY_OPTOUT: 1
|
||||
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT: 1
|
||||
TZ: UTC
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup .NET 10 RC
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: 10.0.100
|
||||
include-prerelease: true
|
||||
|
||||
- name: Verify corpus manifest integrity
|
||||
run: |
|
||||
echo "Verifying corpus manifest..."
|
||||
cd tests/reachability/corpus
|
||||
if [ ! -f manifest.json ]; then
|
||||
echo "::error::Corpus manifest.json not found"
|
||||
exit 1
|
||||
fi
|
||||
echo "Manifest exists, checking JSON validity..."
|
||||
python3 -c "import json; json.load(open('manifest.json'))"
|
||||
echo "Manifest is valid JSON"
|
||||
|
||||
- name: Verify reachbench index integrity
|
||||
run: |
|
||||
echo "Verifying reachbench fixtures..."
|
||||
cd tests/reachability/fixtures/reachbench-2025-expanded
|
||||
if [ ! -f INDEX.json ]; then
|
||||
echo "::error::Reachbench INDEX.json not found"
|
||||
exit 1
|
||||
fi
|
||||
echo "INDEX exists, checking JSON validity..."
|
||||
python3 -c "import json; json.load(open('INDEX.json'))"
|
||||
echo "INDEX is valid JSON"
|
||||
|
||||
- name: Restore test project
|
||||
run: dotnet restore tests/reachability/StellaOps.Reachability.FixtureTests/StellaOps.Reachability.FixtureTests.csproj --configfile nuget.config
|
||||
|
||||
- name: Build test project
|
||||
run: dotnet build tests/reachability/StellaOps.Reachability.FixtureTests/StellaOps.Reachability.FixtureTests.csproj -c Release --no-restore
|
||||
|
||||
- name: Run corpus fixture tests
|
||||
run: |
|
||||
dotnet test tests/reachability/StellaOps.Reachability.FixtureTests/StellaOps.Reachability.FixtureTests.csproj \
|
||||
-c Release \
|
||||
--no-build \
|
||||
--logger "trx;LogFileName=corpus-results.trx" \
|
||||
--results-directory ./TestResults \
|
||||
--filter "FullyQualifiedName~CorpusFixtureTests"
|
||||
|
||||
- name: Run reachbench fixture tests
|
||||
run: |
|
||||
dotnet test tests/reachability/StellaOps.Reachability.FixtureTests/StellaOps.Reachability.FixtureTests.csproj \
|
||||
-c Release \
|
||||
--no-build \
|
||||
--logger "trx;LogFileName=reachbench-results.trx" \
|
||||
--results-directory ./TestResults \
|
||||
--filter "FullyQualifiedName~ReachbenchFixtureTests"
|
||||
|
||||
- name: Verify deterministic hashes
|
||||
run: |
|
||||
echo "Verifying SHA-256 hashes in corpus manifest..."
|
||||
chmod +x scripts/reachability/verify_corpus_hashes.sh || true
|
||||
if [ -f scripts/reachability/verify_corpus_hashes.sh ]; then
|
||||
scripts/reachability/verify_corpus_hashes.sh
|
||||
else
|
||||
echo "Hash verification script not found, using inline verification..."
|
||||
cd tests/reachability/corpus
|
||||
python3 << 'EOF'
|
||||
import json
|
||||
import hashlib
|
||||
import sys
|
||||
import os
|
||||
|
||||
with open('manifest.json') as f:
|
||||
manifest = json.load(f)
|
||||
|
||||
errors = []
|
||||
for entry in manifest:
|
||||
case_id = entry['id']
|
||||
lang = entry['language']
|
||||
case_dir = os.path.join(lang, case_id)
|
||||
for filename, expected_hash in entry['files'].items():
|
||||
filepath = os.path.join(case_dir, filename)
|
||||
if not os.path.exists(filepath):
|
||||
errors.append(f"{case_id}: missing {filename}")
|
||||
continue
|
||||
with open(filepath, 'rb') as f:
|
||||
actual_hash = hashlib.sha256(f.read()).hexdigest()
|
||||
if actual_hash != expected_hash:
|
||||
errors.append(f"{case_id}: {filename} hash mismatch (expected {expected_hash}, got {actual_hash})")
|
||||
|
||||
if errors:
|
||||
for err in errors:
|
||||
print(f"::error::{err}")
|
||||
sys.exit(1)
|
||||
print(f"All {len(manifest)} corpus entries verified")
|
||||
EOF
|
||||
fi
|
||||
|
||||
- name: Upload test results
|
||||
uses: actions/upload-artifact@v4
|
||||
if: always()
|
||||
with:
|
||||
name: corpus-test-results-${{ github.run_number }}
|
||||
path: ./TestResults/*.trx
|
||||
retention-days: 14
|
||||
|
||||
validate-ground-truths:
|
||||
runs-on: ubuntu-22.04
|
||||
env:
|
||||
TZ: UTC
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Validate ground-truth schema version
|
||||
run: |
|
||||
echo "Validating ground-truth files..."
|
||||
cd tests/reachability
|
||||
python3 << 'EOF'
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
|
||||
EXPECTED_SCHEMA = "reachbench.reachgraph.truth/v1"
|
||||
ALLOWED_VARIANTS = {"reachable", "unreachable"}
|
||||
errors = []
|
||||
|
||||
# Validate corpus ground-truths
|
||||
corpus_manifest = 'corpus/manifest.json'
|
||||
if os.path.exists(corpus_manifest):
|
||||
with open(corpus_manifest) as f:
|
||||
manifest = json.load(f)
|
||||
for entry in manifest:
|
||||
case_id = entry['id']
|
||||
lang = entry['language']
|
||||
truth_path = os.path.join('corpus', lang, case_id, 'ground-truth.json')
|
||||
if not os.path.exists(truth_path):
|
||||
errors.append(f"corpus/{case_id}: missing ground-truth.json")
|
||||
continue
|
||||
with open(truth_path) as f:
|
||||
truth = json.load(f)
|
||||
if truth.get('schema_version') != EXPECTED_SCHEMA:
|
||||
errors.append(f"corpus/{case_id}: wrong schema_version")
|
||||
if truth.get('variant') not in ALLOWED_VARIANTS:
|
||||
errors.append(f"corpus/{case_id}: invalid variant '{truth.get('variant')}'")
|
||||
if not isinstance(truth.get('paths'), list):
|
||||
errors.append(f"corpus/{case_id}: paths must be an array")
|
||||
|
||||
# Validate reachbench ground-truths
|
||||
reachbench_index = 'fixtures/reachbench-2025-expanded/INDEX.json'
|
||||
if os.path.exists(reachbench_index):
|
||||
with open(reachbench_index) as f:
|
||||
index = json.load(f)
|
||||
for case in index.get('cases', []):
|
||||
case_id = case['id']
|
||||
case_path = case.get('path', os.path.join('cases', case_id))
|
||||
for variant in ['reachable', 'unreachable']:
|
||||
truth_path = os.path.join('fixtures/reachbench-2025-expanded', case_path, 'images', variant, 'reachgraph.truth.json')
|
||||
if not os.path.exists(truth_path):
|
||||
errors.append(f"reachbench/{case_id}/{variant}: missing reachgraph.truth.json")
|
||||
continue
|
||||
with open(truth_path) as f:
|
||||
truth = json.load(f)
|
||||
if not truth.get('schema_version'):
|
||||
errors.append(f"reachbench/{case_id}/{variant}: missing schema_version")
|
||||
if not isinstance(truth.get('paths'), list):
|
||||
errors.append(f"reachbench/{case_id}/{variant}: paths must be an array")
|
||||
|
||||
if errors:
|
||||
for err in errors:
|
||||
print(f"::error::{err}")
|
||||
sys.exit(1)
|
||||
print("All ground-truth files validated successfully")
|
||||
EOF
|
||||
|
||||
determinism-check:
|
||||
runs-on: ubuntu-22.04
|
||||
env:
|
||||
TZ: UTC
|
||||
needs: validate-corpus
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Verify JSON determinism (sorted keys, no trailing whitespace)
|
||||
run: |
|
||||
echo "Checking JSON determinism..."
|
||||
cd tests/reachability
|
||||
python3 << 'EOF'
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
|
||||
def check_json_sorted(filepath):
|
||||
"""Check if JSON has sorted keys (deterministic)."""
|
||||
with open(filepath) as f:
|
||||
content = f.read()
|
||||
parsed = json.loads(content)
|
||||
reserialized = json.dumps(parsed, sort_keys=True, indent=2)
|
||||
# Normalize line endings
|
||||
content_normalized = content.replace('\r\n', '\n').strip()
|
||||
reserialized_normalized = reserialized.strip()
|
||||
return content_normalized == reserialized_normalized
|
||||
|
||||
errors = []
|
||||
json_files = []
|
||||
|
||||
# Collect JSON files from corpus
|
||||
for root, dirs, files in os.walk('corpus'):
|
||||
for f in files:
|
||||
if f.endswith('.json'):
|
||||
json_files.append(os.path.join(root, f))
|
||||
|
||||
# Check determinism
|
||||
non_deterministic = []
|
||||
for filepath in json_files:
|
||||
try:
|
||||
if not check_json_sorted(filepath):
|
||||
non_deterministic.append(filepath)
|
||||
except json.JSONDecodeError as e:
|
||||
errors.append(f"{filepath}: invalid JSON - {e}")
|
||||
|
||||
if non_deterministic:
|
||||
print(f"::warning::Found {len(non_deterministic)} non-deterministic JSON files (keys not sorted or whitespace differs)")
|
||||
for f in non_deterministic[:10]:
|
||||
print(f" - {f}")
|
||||
if len(non_deterministic) > 10:
|
||||
print(f" ... and {len(non_deterministic) - 10} more")
|
||||
|
||||
if errors:
|
||||
for err in errors:
|
||||
print(f"::error::{err}")
|
||||
sys.exit(1)
|
||||
|
||||
print(f"Checked {len(json_files)} JSON files")
|
||||
EOF
|
||||
Reference in New Issue
Block a user