CI/CD 流水線

PR Ready

Lint → 平行測試 → Docker 建置 → 暫存環境 → 核准 → 正式環境。

7 個節點 · 7 條連接pr ready
github-actionscicddockerdeployment
視覺化
Lint 與型別檢查cicd

以嚴格模式執行 ESLint 與 TypeScript 編譯器。

parallel單元測試
parallel整合測試
單元測試cicd

執行 Jest 單元測試並設定覆蓋率門檻。

sequential建置 Docker 映像
整合測試cicd

針對測試資料庫執行 Playwright 整合測試。

sequential建置 Docker 映像
建置 Docker 映像docker

建置多架構映像並推送至 GHCR。

sequential部署至暫存環境
部署至暫存環境infra

將新映像部署至暫存環境。

sequential正式環境核准
正式環境核准human

團隊負責人審閱暫存環境後,核准部署至正式環境。

sequential部署至正式環境
部署至正式環境infra

以藍綠部署方式部署至正式環境,並支援自動回滾。

ex-github-actions-ci-cd.osop.yaml
# GitHub Actions CI/CD — OSOP Portable Workflow
#
# Full CI/CD pipeline: lint and type-check, run unit and integration tests
# in parallel, build a Docker image, deploy to staging, wait for manual
# approval, then promote to production.
#
# Use alongside .github/workflows/ or validate: osop validate github-actions-ci-cd.osop.yaml

osop_version: "1.0"
id: "github-actions-ci-cd"
name:"CI/CD 流水線"
description:"Lint → 平行測試 → Docker 建置 → 暫存環境 → 核准 → 正式環境。"
version: "1.0.0"
tags: [github-actions, cicd, docker, deployment]

nodes:
  - id: "lint"
    type: "cicd"
    subtype: "test"
    name: "Lint 與型別檢查"
    description: "以嚴格模式執行 ESLint 與 TypeScript 編譯器。"
    config:
      commands: ["npx eslint .", "npx tsc --noEmit"]

  - id: "unit_tests"
    type: "cicd"
    subtype: "test"
    name: "單元測試"
    description: "執行 Jest 單元測試並設定覆蓋率門檻。"
    config:
      command: "npx jest --coverage --ci"
      coverage_threshold: 80

  - id: "integration_tests"
    type: "cicd"
    subtype: "test"
    name: "整合測試"
    description: "針對測試資料庫執行 Playwright 整合測試。"
    config:
      command: "npx playwright test"

  - id: "build_docker"
    type: "docker"
    name: "建置 Docker 映像"
    description: "建置多架構映像並推送至 GHCR。"
    config:
      registry: "ghcr.io"
      platforms: ["linux/amd64", "linux/arm64"]

  - id: "deploy_staging"
    type: "infra"
    name: "部署至暫存環境"
    description: "將新映像部署至暫存環境。"
    config:
      environment: "staging"
      strategy: "rolling"

  - id: "approval_gate"
    type: "human"
    subtype: "review"
    name: "正式環境核准"
    description: "團隊負責人審閱暫存環境後,核准部署至正式環境。"

  - id: "deploy_production"
    type: "infra"
    name: "部署至正式環境"
    description: "以藍綠部署方式部署至正式環境,並支援自動回滾。"
    config:
      environment: "production"
      strategy: "blue-green"
      rollback_on_failure: true

edges:
  - from: "lint"
    to: "unit_tests"
    mode: "parallel"
  - from: "lint"
    to: "integration_tests"
    mode: "parallel"
  - from: "unit_tests"
    to: "build_docker"
    mode: "sequential"
  - from: "integration_tests"
    to: "build_docker"
    mode: "sequential"
  - from: "build_docker"
    to: "deploy_staging"
    mode: "sequential"
  - from: "deploy_staging"
    to: "approval_gate"
    mode: "sequential"
  - from: "approval_gate"
    to: "deploy_production"
    mode: "sequential"