name: standard-devops-pipeline

on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main

stages:
  - validate
  - build
  - test
  - security_scan
  - package
  - deploy_staging
  - approval
  - deploy_production
  - observe

jobs:
  validate:
    commands:
      - echo "Check branch policy and commit metadata"
      - echo "Validate configuration files"

  build:
    commands:
      - echo "Build application artifact"
      - echo "Build container image"

  test:
    commands:
      - echo "Run unit tests"
      - echo "Run integration tests"

  security_scan:
    commands:
      - echo "Scan dependencies"
      - echo "Scan container image"

  deploy_staging:
    strategy: rolling
    commands:
      - echo "Deploy to staging namespace"
      - echo "Run smoke tests"

  deploy_production:
    strategy: canary
    traffic_steps:
      - 10
      - 30
      - 60
      - 100
    rollback_on:
      - error_rate_above_threshold
      - latency_slo_breach

  observe:
    commands:
      - echo "Publish deployment marker"
      - echo "Check SLO dashboard"
