# Nova Central CI Pipeline Contract (v1.5)
#
# This is the single source of truth for the CI/CD pipeline. Both
# .github/workflows/ci.yml (dev) and
# .github/workflows/ci.yml (GitHub Actions, production) implement the
# stages, commands, triggers, and runner declared here.
# scripts/run_ci.sh mirrors the same stages for shell reproducibility.
#
# A test (tests/test_pipeline_contract.py) validates that both workflow
# YAMLs conform to this contract and that run_ci.sh runs the same commands.
#
# The contract does NOT replace workflow YAML syntax — it declares the
# *intent* that the forge-specific workflows implement. The workflow files
# use GitHub Actions syntax (checkout, setup-python, run blocks);
# this contract declares what those blocks must contain.
#
# Validated against schemas/pipeline.schema.json.

name: acdl-ci
environment: dev
triggers:
  push: [main]
  pull_request: [main]
runner: ubuntu-latest
python_version: "3.12"

stages:
  - name: lint
    description: Compile all Python files (py_compile)
    command: |
      python3 -m py_compile \
        core/confidence_signal.py \
        core/outbox_writer.py \
        core/contract_resolver.py \
        core/lambda/contract_ingestor.py \
        adapters/terraform/adapter.py \
        adapters/terraform/policy/checkov_adapter.py \
        scripts/push_consumer_image.py
    required: true

  - name: test
    description: Run the pytest test suite offline
    command: python3 -m pytest tests/ -v --tb=short
    install: pip install -r requirements-test.txt
    required: true

  - name: check-only
    description: Run the platform pipeline offline (no AWS/Checkov/DynamoDB)
    command: bash scripts/run_platform.sh --check-only
    install: pip install jsonschema pyyaml boto3
    required: true