# インフラ構成図

## 全体システム構成図

```mermaid
graph TB
    subgraph "開発者環境"
        DEV[開発者]
        IDE[エディタ/IDE]
    end

    subgraph "GitHub"
        REPO[clojure-lsp/clojure-lsp<br/>ソースコード]
        GHA[GitHub Actions<br/>CI/CD]
        GHR[GitHub Releases<br/>バイナリ配布]
        GHP[GitHub Pages<br/>clojure-lsp.io]
        DEV_BUILDS[clojure-lsp-dev-builds<br/>Nightly Releases]
    end

    subgraph "外部サービス"
        CLOJARS[Clojars<br/>Maven Repository]
        CACHIX[Cachix<br/>Nix Cache]
        SLACK[Slack<br/>Clojurians]
    end

    subgraph "エンドユーザー"
        USER[ユーザー]
        EDITOR[エディタ<br/>Emacs/VSCode/Vim等]
    end

    DEV -->|push/PR| REPO
    REPO -->|trigger| GHA
    GHA -->|deploy| GHR
    GHA -->|deploy| DEV_BUILDS
    GHA -->|deploy| CLOJARS
    GHA -->|deploy| GHP
    GHA -->|cache| CACHIX
    GHA -->|notify| SLACK

    USER -->|download| GHR
    USER -->|download| CLOJARS
    USER -->|download| DEV_BUILDS
    EDITOR -->|LSP protocol| IDE
```

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

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

    subgraph "CIワークフロー"
        LINT[lint<br/>ubuntu-22.04]
        UNIT[unit-test<br/>マトリクスビルド]
        JVM_INT[jvm-integration-test<br/>マトリクスビルド]
        GRAAL_BUILD[graalvm-build<br/>ubuntu-22.04]
        GRAAL_INT[graalvm-integration-test<br/>ubuntu-22.04]
    end

    subgraph "Nightlyワークフロー"
        NIGHTLY_RELEASE[release-dev-build]
        NIGHTLY_JAR[build-cli-jar]
        NIGHTLY_LINUX[linux-amd64/static]
        NIGHTLY_MACOS[macos-amd64/aarch64]
        NIGHTLY_WIN[windows]
        NIGHTLY_NOTIFY[notify]
    end

    subgraph "Releaseワークフロー"
        LIB_JAR[build-lib-jar]
        CLI_JAR[build-cli-jar]
        LINUX_AMD[linux-amd64]
        LINUX_STATIC[linux-amd64-static]
        LINUX_ARM[linux-aarch64]
        MACOS_AMD[macos-amd64]
        MACOS_ARM[macos-aarch64]
        WINDOWS[windows]
        RELEASE[release]
        UPLOAD[upload-to-release]
    end

    PUSH --> LINT
    PUSH --> UNIT
    PUSH --> JVM_INT
    PUSH --> GRAAL_BUILD
    PR --> LINT
    PR --> UNIT
    PR --> JVM_INT

    GRAAL_BUILD --> GRAAL_INT

    PUSH --> NIGHTLY_RELEASE
    NIGHTLY_RELEASE --> NIGHTLY_JAR
    NIGHTLY_JAR --> NIGHTLY_LINUX
    NIGHTLY_JAR --> NIGHTLY_MACOS
    NIGHTLY_JAR --> NIGHTLY_WIN
    NIGHTLY_LINUX --> NIGHTLY_NOTIFY
    NIGHTLY_MACOS --> NIGHTLY_NOTIFY

    TAG --> LIB_JAR
    TAG --> CLI_JAR
    LIB_JAR --> LINUX_AMD
    CLI_JAR --> LINUX_AMD
    LIB_JAR --> LINUX_STATIC
    CLI_JAR --> LINUX_STATIC
    LIB_JAR --> LINUX_ARM
    CLI_JAR --> LINUX_ARM
    LIB_JAR --> MACOS_AMD
    CLI_JAR --> MACOS_AMD
    LIB_JAR --> MACOS_ARM
    CLI_JAR --> MACOS_ARM
    LIB_JAR --> WINDOWS
    CLI_JAR --> WINDOWS
    LINUX_AMD --> RELEASE
    LINUX_STATIC --> RELEASE
    LINUX_ARM --> RELEASE
    MACOS_AMD --> RELEASE
    MACOS_ARM --> RELEASE
    WINDOWS --> RELEASE
    RELEASE --> UPLOAD
```

## ビルド環境構成図

```mermaid
graph TB
    subgraph "Linux AMD64 Build"
        UBUNTU22[ubuntu-22.04]
        GRAAL21_L[GraalVM 21]
        CLJ_L[Clojure CLI 1.12.0.1495]
        BB_L[Babashka 0.9.161]
        UPX_L[UPX]
        MUSL[musl libc<br/>静的ビルド用]
    end

    subgraph "Linux ARM64 Build"
        UBUNTU24_ARM[ubuntu-24.04-arm]
        GRAAL21_LA[GraalVM 21]
        CLJ_LA[Clojure CLI 1.12.0.1495]
        BB_LA[Babashka 0.9.161]
    end

    subgraph "macOS AMD64 Build"
        MACOS15[macos-15-intel]
        GRAAL21_M[GraalVM 21]
        CLJ_M[Clojure CLI 1.12.0.1495]
        BB_M[Babashka 0.9.161]
    end

    subgraph "macOS ARM64 Build"
        MACOS14[macos-14]
        GRAAL21_MA[GraalVM 21]
        CLJ_MA[Clojure CLI 1.12.0.1495]
        BB_MA[Babashka 0.9.161]
    end

    subgraph "Windows Build"
        WIN[windows-latest]
        GRAAL22[GraalVM 22.2.0 Java11]
        CLJ_W[Clojure CLI 1.12.0.1495]
        BB_W[Babashka 0.9.161]
        MSVC[MSVC]
        UPX_W[UPX]
    end

    UBUNTU22 --> GRAAL21_L --> CLJ_L --> BB_L --> UPX_L
    UBUNTU22 --> MUSL
    UBUNTU24_ARM --> GRAAL21_LA --> CLJ_LA --> BB_LA
    MACOS15 --> GRAAL21_M --> CLJ_M --> BB_M
    MACOS14 --> GRAAL21_MA --> CLJ_MA --> BB_MA
    WIN --> GRAAL22 --> MSVC --> CLJ_W --> BB_W --> UPX_W
```

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

```mermaid
graph TB
    subgraph "Unit Test Matrix"
        subgraph "Ubuntu 22.04"
            U_JDK11[JDK 11]
            U_JDK15[JDK 15]
            U_JDK17[JDK 17]
            U_JDK19[JDK 19]
        end
        subgraph "Windows Latest"
            W_JDK11[JDK 11]
        end
        subgraph "macOS Latest"
            M_JDK11[JDK 11]
        end
    end

    subgraph "JVM Integration Test Matrix"
        subgraph "Ubuntu 22.04 Int"
            UI_JDK11[JDK 11]
            UI_JDK15[JDK 15]
            UI_JDK17[JDK 17]
        end
        subgraph "Windows Latest Int"
            WI_JDK17[JDK 17]
        end
        subgraph "macOS Latest Int"
            MI_JDK17[JDK 17]
        end
    end

    subgraph "Test Tools"
        LEIN[Leiningen 2.9.1]
        BOOT[Boot 2.8.3]
        KAOCHA[Kaocha]
    end

    U_JDK11 --> KAOCHA
    U_JDK15 --> KAOCHA
    U_JDK17 --> KAOCHA
    U_JDK19 --> KAOCHA
    UI_JDK11 --> LEIN
    UI_JDK11 --> BOOT
```

## 配布チャネル構成図

```mermaid
graph TB
    subgraph "ビルドアーティファクト"
        JAR_LIB[clojure-lsp.jar<br/>ライブラリ]
        JAR_SERVER[clojure-lsp-server.jar<br/>サーバー]
        JAR_STANDALONE[clojure-lsp-standalone.jar<br/>スタンドアロン]
        BIN_UNIX[clojure-lsp<br/>Unix JVM埋込]
        BIN_WIN[clojure-lsp.bat<br/>Windows JVM埋込]
        NATIVE_LINUX[Linux Native]
        NATIVE_MACOS[macOS Native]
        NATIVE_WIN[Windows Native]
    end

    subgraph "配布先"
        GH_REL[GitHub Releases<br/>本番]
        GH_DEV[GitHub Releases<br/>dev-builds]
        CLOJARS[Clojars]
        CACHIX[Cachix<br/>Nix]
    end

    subgraph "エンドユーザー"
        PKG_MGR[パッケージマネージャー<br/>brew/scoop/nix等]
        DIRECT[直接ダウンロード]
        MVN[Maven/deps.edn]
    end

    JAR_LIB --> CLOJARS
    JAR_SERVER --> GH_REL
    JAR_SERVER --> CLOJARS
    JAR_STANDALONE --> GH_REL
    JAR_STANDALONE --> GH_DEV
    JAR_STANDALONE --> CLOJARS
    BIN_UNIX --> GH_REL
    BIN_WIN --> GH_REL
    NATIVE_LINUX --> GH_REL
    NATIVE_LINUX --> GH_DEV
    NATIVE_MACOS --> GH_REL
    NATIVE_MACOS --> GH_DEV
    NATIVE_WIN --> GH_REL
    NATIVE_WIN --> GH_DEV

    GH_REL --> DIRECT
    GH_REL --> PKG_MGR
    CLOJARS --> MVN
    CACHIX --> PKG_MGR
```

## Nixビルド構成図

```mermaid
graph TB
    subgraph "Nix Inputs"
        NIXPKGS[nixpkgs<br/>nixos-unstable]
        FLAKE_UTILS[flake-utils]
        CLJ_NIX[clj-nix]
    end

    subgraph "Nix Packages"
        CLJ_LSP_JDK[clojure-lsp-jdk<br/>mkCljBin]
        CLJ_LSP[clojure-lsp<br/>mkGraalBin]
    end

    subgraph "Build Dependencies"
        BB[babashka]
        UNZIP[unzip]
        JDK17[jdk17_headless]
    end

    subgraph "Output"
        NATIVE[Native Binary]
        OVERLAY[Nix Overlay]
    end

    NIXPKGS --> CLJ_LSP_JDK
    CLJ_NIX --> CLJ_LSP_JDK
    BB --> CLJ_LSP_JDK
    UNZIP --> CLJ_LSP_JDK
    JDK17 --> CLJ_LSP_JDK
    CLJ_LSP_JDK --> CLJ_LSP
    CLJ_LSP --> NATIVE
    CLJ_LSP --> OVERLAY
```

## ドキュメント生成構成図

```mermaid
graph LR
    subgraph "ソース"
        MD[Markdownファイル<br/>docs/]
        README[README.md]
        CHANGELOG[CHANGELOG.md]
        IMAGES[images/]
    end

    subgraph "ビルド"
        MKDOCS[MkDocs<br/>Docker Image]
        MATERIAL[Material Theme]
    end

    subgraph "出力"
        SITE[site/]
        GH_PAGES[GitHub Pages<br/>clojure-lsp.io]
    end

    MD --> MKDOCS
    README --> MKDOCS
    CHANGELOG --> MKDOCS
    IMAGES --> MKDOCS
    MKDOCS --> MATERIAL
    MATERIAL --> SITE
    SITE --> GH_PAGES
```
