# インフラ構成図

## 全体構成図

```mermaid
graph TB
    subgraph "開発者環境"
        DEV[開発者]
    end

    subgraph "GitHub"
        REPO[webpack/webpack<br/>リポジトリ]
        ISSUES[Issues / PRs]
        BOT[webpack-bot<br/>open-bot.yaml]
    end

    subgraph "GitHub Actions CI/CD"
        subgraph "テストワークフロー"
            LINT[Lint Job<br/>ubuntu-latest]
            BASIC[Basic Test Job<br/>ubuntu-latest]
            UNIT[Unit Test Job<br/>ubuntu-latest]
            INT[Integration Test Jobs<br/>ubuntu/windows/macos<br/>Node 10.x-25.x<br/>Part a/b]
            TEST262[Test262 Job<br/>ubuntu-latest]
            TYPES[Types Coverage Job<br/>ubuntu-latest]
        end

        subgraph "リリースワークフロー"
            RELEASE[Release Job<br/>Changesets]
            ANNOUNCE[Release Announcement<br/>Discord通知]
        end

        subgraph "その他ワークフロー"
            BENCH[Benchmark Jobs<br/>4 shards + memory]
            PKGPR[pkg.pr.new<br/>PRプレビュー公開]
            DEPREV[Dependency Review]
            DEPBOT_WF[Dependabot<br/>Auto-merge]
            EXAMPLES[Update Examples<br/>週次スケジュール]
        end
    end

    subgraph "外部サービス"
        NPM[npm Registry]
        CODECOV[Codecov]
        CODSPEED[CodSpeed]
        DISCORD[Discord]
        PKGPRNEW[pkg.pr.new]
        DEPENDABOT[Dependabot]
    end

    DEV -->|push / PR| REPO
    REPO -->|trigger| LINT
    LINT -->|pass| BASIC
    BASIC -->|pass| UNIT
    BASIC -->|pass| INT
    BASIC -->|pass| TEST262
    REPO -->|PR trigger| TYPES
    REPO -->|push to main| RELEASE
    RELEASE -->|published| ANNOUNCE
    REPO -->|push/PR| BENCH
    REPO -->|push/PR| PKGPR
    REPO -->|PR| DEPREV
    REPO -->|PR| DEPBOT_WF

    RELEASE -->|publish| NPM
    UNIT -->|coverage| CODECOV
    INT -->|coverage| CODECOV
    TEST262 -->|coverage| CODECOV
    BENCH -->|results| CODSPEED
    ANNOUNCE -->|webhook| DISCORD
    PKGPR -->|publish| PKGPRNEW
    DEPENDABOT -->|PR| REPO
    BOT -->|auto-label/comment| ISSUES
```

## CI/CDパイプライン詳細図

```mermaid
graph LR
    subgraph "トリガー"
        PUSH[push to main]
        PR[Pull Request]
    end

    subgraph "Lint & 静的解析"
        L1[ESLint]
        L2[Prettier]
        L3[cspell]
        L4[TypeScript型チェック]
        L5[TS 5.0互換性検証]
    end

    subgraph "テスト"
        T1[Basic Test]
        T2[Unit Test]
        T3[Integration Test<br/>マトリクス実行]
        T4[Test262<br/>ECMAScript仕様テスト]
    end

    subgraph "品質レポート"
        Q1[Codecov<br/>カバレッジ]
        Q2[CodSpeed<br/>ベンチマーク]
    end

    subgraph "リリース"
        R1[Changesets<br/>バージョニング]
        R2[npm publish]
        R3[Discord通知]
    end

    PUSH --> L1 & L2 & L3 & L4
    PR --> L1 & L2 & L3 & L4
    L4 --> L5
    L1 & L2 & L3 & L4 --> T1
    T1 --> T2 & T3 & T4
    T2 --> Q1
    T3 --> Q1
    T4 --> Q1
    PUSH --> Q2
    PR --> Q2
    PUSH --> R1
    R1 -->|published| R2
    R2 --> R3
```

## テストマトリクス構成図

```mermaid
graph TB
    subgraph "OS"
        OS1[ubuntu-latest]
        OS2[windows-latest]
        OS3[macos-latest]
    end

    subgraph "Node.js バージョン"
        N1[10.x]
        N2[12.x]
        N3[14.x]
        N4[16.x]
        N5[18.x]
        N6[20.x]
        N7[22.x]
        N8[24.x]
        N9[25.x]
        N10[lts/*]
    end

    subgraph "テストパート"
        PA[Part A]
        PB[Part B]
    end

    subgraph "特殊構成"
        MAIN[main branches<br/>依存関係テスト<br/>ubuntu + lts/*]
        LEGACY[レガシーNode<br/>Jest 27.x ダウングレード<br/>ubuntu + 10.x/12.x/14.x/16.x]
    end

    OS1 & OS2 & OS3 --> N6 & N7 & N8 & N9
    N6 & N7 & N8 & N9 --> PA & PB
    OS1 --> N1 & N2 & N3 & N4 & N5
    N1 & N2 & N3 & N4 --> LEGACY
    OS1 --> N10
    N10 --> MAIN
```

## シークレット・認証フロー図

```mermaid
graph LR
    subgraph "GitHub Secrets"
        S1[GITHUB_TOKEN]
        S2[CODECOV_TOKEN]
        S3[CODSPEED_TOKEN]
        S4[DISCORD_WEBHOOK]
        S5[BOT_APP_ID]
        S6[BOT_PRIVATE_KEY]
    end

    subgraph "認証方式"
        A1[OIDC<br/>id-token: write]
        A2[GitHub App Token<br/>create-github-app-token]
    end

    subgraph "利用先"
        U1[npm publish]
        U2[Codecov upload]
        U3[CodSpeed upload]
        U4[Discord Webhook]
        U5[Dependabot auto-merge]
        U6[PR/Issue操作]
    end

    A1 --> U1
    S1 --> U6
    S2 --> U2
    S3 --> U3
    S4 --> U4
    S5 & S6 --> A2
    A2 --> U5
```
