Skip to main content
The prefix-dev/setup-pixi action makes it easy to use Pixi in GitHub Actions workflows.

Quick Start

.github/workflows/ci.yml
Pin the action version (e.g., prefix-dev/setup-pixi@v0.9.4) to avoid breaking changes. Use Dependabot to keep it updated.

Version Pinning with Dependabot

Automatically update the action version:
.github/dependabot.yml

Key Features

Caching

Automatic caching speeds up workflows by reusing installed environments.

Project Environment Caching

Enabled by default when pixi.lock exists:

Global Environment Caching

Disabled by default, expires monthly:

Custom Cache Keys

Customize cache key prefixes:

Save Caches Only on Main

Prevent hitting the 10GB cache limit:

Multiple Environments

Test across different Python versions or configurations.

Environment Configuration

pixi.toml

Matrix Strategy

Multiple Environments in One Job

If you don’t specify environments, only the default environment is cached, even if you use others.

Global Environments

Install tools needed before pixi install runs:

Authentication

Token Authentication

For prefix.dev and similar services:
Always use GitHub secrets for sensitive information. Never commit credentials to your repository.

Username and Password

For Artifactory and enterprise environments:

Conda Token

For anaconda.org and Quetz:

S3 Authentication

See the S3 documentation and authentication guide for details.

PyPI Keyring Provider

Custom Shell Wrapper

Run commands inside the Pixi environment without pixi run:
The {0} placeholder is replaced with a temporary script file created by GitHub Actions.

One-off Commands with pixi exec

Run commands in a temporary environment:

Environment Activation

Activate the environment for all subsequent steps:

With Multiple Environments

This is useful for non-shell steps that need binaries on the PATH.

Lock File Management

—frozen Flag

Reject any changes to the lockfile:

—locked Flag

Only install if lockfile is up-to-date:
By default, the action runs:
  • pixi install --locked if pixi.lock exists
  • pixi install otherwise
See the official documentation for more details.

Debugging

Action Debug Logging

Enable by re-running the workflow in debug mode via the GitHub UI.

Pixi Debug Logging

The log level defaults to vv when action debug logging is enabled.

Self-Hosted Runners

Configure cleanup and custom paths for self-hosted runners:
Post-cleanup removes:
  • .pixi environment
  • Pixi binary
  • Rattler cache
  • Other rattler files in ~/.rattler

Use Pre-installed Pixi

If Pixi is already installed on the runner, omit version configuration:
The action will use the Pixi found in PATH.

Advanced Configuration

pyproject.toml as Manifest

Use pyproject.toml instead of pixi.toml:
The action auto-detects pyproject.toml if it contains [tool.pixi.workspace] and no pixi.toml exists.

Working Directory for Monorepos

Custom Download URL

Download Pixi from a custom mirror:

Install-Only Mode

Only install Pixi without running pixi install:

Complete Example

.github/workflows/ci.yml

Best Practices

Pin Versions

Always pin the action version and use Dependabot for updates.

Cache Wisely

Only save caches on main branch to avoid hitting the 10GB limit.

Use Secrets

Store all sensitive data in GitHub Secrets, never in code.

Matrix Testing

Test across multiple OS and Python versions for better coverage.

Locked Installs

Use locked: true in CI to ensure reproducible builds.

More Examples

For additional examples, see the setup-pixi test workflows.