# インフラ構成図

## 全体構成図

```mermaid
graph TB
    subgraph "開発者環境"
        DEV[開発者]
        EDITOR[エディタ/IDE<br/>VS Code, NeoVim等]
        LSP[lua-language-server<br/>ローカル実行]
    end

    subgraph "GitHub"
        REPO[GitHub Repository<br/>LuaLS/lua-language-server]
        ACTIONS[GitHub Actions]
        RELEASES[GitHub Releases]
        ISSUES[GitHub Issues]
    end

    subgraph "配布チャネル"
        VSCODE_MKT[Visual Studio<br/>Marketplace]
        LUAROCKS[LuaRocks]
        HOMEBREW[Homebrew]
    end

    DEV --> |コード編集| EDITOR
    EDITOR <--> |LSP Protocol| LSP
    DEV --> |push/PR| REPO
    REPO --> |Webhook| ACTIONS
    ACTIONS --> |リリース| RELEASES
    RELEASES --> |配布| VSCODE_MKT
    RELEASES --> |配布| LUAROCKS
    RELEASES --> |配布| HOMEBREW
    ISSUES --> |翻訳Bot| ACTIONS
```

## CI/CD パイプライン構成図

```mermaid
flowchart LR
    subgraph "トリガー"
        PUSH[Push to master]
        TAG[Tag Creation]
        PR[Pull Request]
    end

    subgraph "GitHub Actions Runners"
        subgraph "Linux"
            UBUNTU22[ubuntu-22.04<br/>linux-x64]
            UBUNTU24ARM[ubuntu-24.04-arm<br/>linux-arm64]
        end
        subgraph "macOS"
            MACOS[macos-latest<br/>darwin-x64/arm64]
            MACOS14[macos-14<br/>darwin-arm64 test]
        end
        subgraph "Windows"
            WIN[windows-latest<br/>win32-ia32/x64]
        end
    end

    subgraph "出力"
        ARTIFACTS[GitHub Artifacts]
        RELEASE[GitHub Releases]
    end

    PUSH --> UBUNTU22 & UBUNTU24ARM & MACOS & WIN
    TAG --> UBUNTU22 & UBUNTU24ARM & MACOS & WIN
    PR --> UBUNTU22 & MACOS & WIN

    UBUNTU22 & UBUNTU24ARM & MACOS & WIN --> ARTIFACTS
    TAG --> RELEASE
```

## ビルドワークフロー詳細図

```mermaid
flowchart TD
    subgraph "build.yml"
        A[Checkout<br/>submodules: recursive] --> B[Setup luamake]
        B --> C{Platform?}
        C --> |Linux| D[Install Zig<br/>snap install zig]
        D --> E[Setup zig-cc-wrapper]
        E --> F[luamake build]
        C --> |macOS/Windows| F
        F --> G[Upload Artifacts]
        G --> H{Is Tag?}
        H --> |Yes| I[Package tarball/zip]
        I --> J[Publish to Releases]
        H --> |No| K[End]
        J --> K
    end
```

## テストワークフロー構成図

```mermaid
flowchart LR
    subgraph "test.yml"
        TRIGGER[Push / PR] --> CHECKOUT[Checkout]
        CHECKOUT --> SETUP[Setup luamake]
        SETUP --> BUILD[Build]
    end

    subgraph "Matrix"
        BUILD --> |ubuntu-22.04| LINUX[linux-x64]
        BUILD --> |macos-14| MAC[darwin-arm64]
        BUILD --> |windows-latest| WIN[win32-x64]
    end
```

## Docker ビルド環境図

```mermaid
graph TB
    subgraph "Dockerfile"
        BASE[Ubuntu 18.04]
        BASE --> APT[apt-get update]
        APT --> PPA1[add-apt-repository<br/>ubuntu-toolchain-r/test]
        APT --> PPA2[add-apt-repository<br/>git-core/ppa]
        PPA1 --> PKG[Install packages<br/>git, gcc-9, g++-9,<br/>wget, ninja-build]
        PPA2 --> PKG
        PKG --> ALT[update-alternatives<br/>gcc/g++ -> 9.x]
    end
```

## 依存関係図

```mermaid
graph LR
    subgraph "External Dependencies"
        BEELUA[bee.lua]
        LUAMAKE[luamake]
        LPEGLABEL[LPegLabel]
        LUAPARSER[LuaParser]
        LUAGLOB[lua-glob]
        UTILITY[utility]
        JSON[json.lua]
        EMMYCODE[EmmyLuaCodeStyle]
        INSPECT[inspect.lua]
    end

    subgraph "Build Tools"
        GCC[GCC 9.x]
        NINJA[Ninja]
        ZIG[Zig]
    end

    subgraph "lua-language-server"
        LSS[lua-language-server]
    end

    BEELUA --> LSS
    LUAMAKE --> LSS
    LPEGLABEL --> LSS
    LUAPARSER --> LSS
    LUAGLOB --> LSS
    UTILITY --> LSS
    JSON --> LSS
    EMMYCODE --> LSS
    INSPECT --> LSS

    GCC --> |compile| LSS
    NINJA --> |build system| LSS
    ZIG --> |Linux cross-compile| LSS
```

## ワークフロー一覧図

```mermaid
graph TB
    subgraph "Workflows"
        BUILD[build.yml<br/>ビルド・リリース]
        TEST[test.yml<br/>テスト実行]
        CHANGELOG[changelog.yml<br/>変更履歴チェック]
        TRANSLATE[translate.yml<br/>Issue翻訳]
    end

    subgraph "Triggers"
        PUSH_MASTER[Push to master]
        PUSH_TAG[Tag push]
        PR_MASTER[PR to master]
        ISSUE[Issue/Comment]
    end

    PUSH_MASTER --> BUILD
    PUSH_MASTER --> TEST
    PUSH_TAG --> BUILD
    PR_MASTER --> BUILD
    PR_MASTER --> TEST
    PR_MASTER --> CHANGELOG
    ISSUE --> TRANSLATE
```

## プラットフォーム対応マトリックス

```mermaid
graph LR
    subgraph "Platforms"
        LX64[linux-x64]
        LARM64[linux-arm64]
        DX64[darwin-x64]
        DARM64[darwin-arm64]
        W32[win32-ia32]
        W64[win32-x64]
    end

    subgraph "Runners"
        U22[ubuntu-22.04]
        U24ARM[ubuntu-24.04-arm]
        MAC[macos-latest]
        WINR[windows-latest]
    end

    U22 --> LX64
    U24ARM --> LARM64
    MAC --> DX64
    MAC --> DARM64
    WINR --> W32
    WINR --> W64
```
