# prefix-dev/setup-pixi architecture

> Architecture diagram of the GitHub repository prefix-dev/setup-pixi, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/prefix-dev/setup-pixi
- Repository: https://github.com/prefix-dev/setup-pixi

## Overview

##### Main Components

a) Action Core Components:
- Input Handler (options.ts)
- Main Action Logic (main.ts)
- Post-cleanup Logic (post.ts)
- Cache Management (cache.ts)
- Environment Activation (activate.ts)
- Utility Functions (util.ts)

b) External Systems:
- GitHub Actions Runtime
- GitHub Cache Service
- Pixi Package Manager
- Authentication Services (prefix.dev, artifactory, anaconda.org)

**┌─────────────────────────────────────── GitHub Actions Environment ───────────────────────────────────────┐**

- ┌─────────────────── setup-pixi Action ───────────────────────┐                                       │
- ┌─────────────────────────┐       │
- ┌─────────────┐         ┌──────────────┐                  │      │   GitHub Cache Service  │       │
- Inputs    │         │  Main Logic  │                  │      └─────────────────────────┘       │
- Handler     ├────────►│  Controller  │◄──────Cache─────────────────────────┘                    │
- ┘         └──────┬───────┘                  │                                        │
- ┌─────────────────────────┐       │
- ┌─────────────┐               │                           │      │  Authentication Services│       │
- Environment  │               ▼                           │      │  - prefix.dev           │       │
- Activation   │◄────────┌──────────────┐                 │      │  - artifactory          │       │
- ┘         │ Pixi Manager │◄────Auth────────────────│  - anaconda.org        │       │
- ┘                 │      └─────────────────────────┘       │
- ┌─────────────┐               │                           │                                        │
- Post-cleanup │◄──────────────┘                           │                                        │
- ┘                                           │                                        │
- ┘                                         │
- ┘

##### Key Interactions to Highlight

a) Input Flow:
- Action inputs → Input Handler → Main Logic Controller
- Support for various configuration options (cache, auth, environments)

b) Cache Flow:
- Main Logic ↔ GitHub Cache Service
- Cache key generation and validation
- Environment storage and retrieval

c) Authentication Flow:
- Main Logic → Authentication Services
- Support for multiple auth methods (token, username/password, conda-token)

d) Environment Management:
- Pixi Manager → Environment Activation
- Environment variable and path modifications
- Multiple environment support

##### Important Notes

- Version information for compatibility
- Cleanup process for self-hosted runners
- Cache optimization paths
- Relationship with GitHub Actions environment variables

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph GH["GitHub Actions Environment"]
        subgraph SA["setup-pixi Action"]
            IH["Input Handler"]:::core
            MC["Main Logic Controller"]:::core
            CM["Cache Management"]:::core
            EA["Environment Activation"]:::core
            PC["Post-cleanup"]:::core
            UT["Utility Functions"]:::core
            PM["Pixi Manager"]:::core

            IH --> MC
            MC --> PM
            MC <--> CM
            PM --> EA
            PM --> PC
            MC --> UT
            EA --> UT
        end

        GCS["GitHub Cache Service"]:::external
        
        subgraph AS["Authentication Services"]
            PD["prefix.dev"]:::auth
            AR["artifactory"]:::auth
            AN["anaconda.org"]:::auth
        end

        CM <--> GCS
        PM <--> AS
    end

    %% Click events for component mapping
    click IH "https://github.com/prefix-dev/setup-pixi/blob/main/src/options.ts"
    click MC "https://github.com/prefix-dev/setup-pixi/blob/main/src/main.ts"
    click PC "https://github.com/prefix-dev/setup-pixi/blob/main/src/post.ts"
    click CM "https://github.com/prefix-dev/setup-pixi/blob/main/src/cache.ts"
    click EA "https://github.com/prefix-dev/setup-pixi/blob/main/src/activate.ts"
    click UT "https://github.com/prefix-dev/setup-pixi/blob/main/src/util.ts"
    click SA "https://github.com/prefix-dev/setup-pixi/blob/main/action.yml"
    click AS "https://github.com/prefix-dev/setup-pixi/tree/main/test/auth/"
    click PM "https://github.com/prefix-dev/setup-pixi/tree/main/test/private-package/"

    %% Styling
    classDef core fill:#a2d2ff,stroke:#333,stroke-width:2px
    classDef external fill:#90be6d,stroke:#333,stroke-width:2px
    classDef auth fill:#f9c74f,stroke:#333,stroke-width:2px

    %% Legend
    subgraph Legend
        C1["Core Components"]:::core
        E1["External Services"]:::external
        A1["Authentication Services"]:::auth
    end
```
