Skip to content
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
16b639b
Add global install
olivier-lacroix Aug 12, 2025
291c5e9
Add global envs to the cache
olivier-lacroix Aug 12, 2025
909d1a3
Add a test
olivier-lacroix Aug 12, 2025
9c5fbfb
Add build
olivier-lacroix Aug 12, 2025
e2d59d7
two caches for global install
olivier-lacroix Aug 13, 2025
d6ea1f9
Switch to async / await for clarity
olivier-lacroix Aug 13, 2025
ad3658c
harmonise
olivier-lacroix Aug 13, 2025
1a0e016
Refactor cache functions
olivier-lacroix Aug 13, 2025
ec4c98d
build
olivier-lacroix Aug 13, 2025
8927cbd
Merge branch 'main' into global-environments
olivier-lacroix Aug 13, 2025
ea706e4
build
olivier-lacroix Aug 13, 2025
4bcd5d9
run-install: false
olivier-lacroix Aug 13, 2025
4edd1e0
no manifest
olivier-lacroix Aug 13, 2025
9a46b80
package name fix
olivier-lacroix Aug 13, 2025
ba80cd3
Fail on lockfile unavailable
olivier-lacroix Aug 13, 2025
12fbb6b
revert cache-key changes
olivier-lacroix Sep 7, 2025
74ba845
Merge branch 'main' into global-environments
olivier-lacroix Sep 7, 2025
6f1ba83
update build
olivier-lacroix Sep 7, 2025
4487817
lint
olivier-lacroix Sep 7, 2025
c8b6bb6
Add doc in README
olivier-lacroix Sep 7, 2025
6133f5a
Remove global cache ;-(
olivier-lacroix Sep 13, 2025
f6e1490
add test that combines global and project install
olivier-lacroix Sep 14, 2025
d445a5a
Apply suggestions from code review
pavelzw Sep 22, 2025
a2d0eb8
Fix python version check in GitHub Actions workflow
pavelzw Sep 22, 2025
426da31
bump version to 0.9.1
pavelzw Sep 22, 2025
c9a5acc
Fix path for Python executable in workflow
pavelzw Sep 22, 2025
4c45e14
Fix typo in global environments section
pavelzw Sep 22, 2025
ee4987b
Fix typo in test.yml for windows-latest check
pavelzw Sep 22, 2025
70346a5
Fix python executable path in test workflow
pavelzw Sep 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
run: |
set -euo pipefail
latest_version="$(jq -r '.version' package.json)"
count_expected=20
count_expected=21
count_actual="$(grep -c "setup-pixi@v$latest_version" README.md || true)"
if [ "$count_actual" -ne "$count_expected" ]; then
echo "::error file=README.md::Expected $count_expected mentions of \`setup-pixi@v$latest_version\` in README.md, but found $count_actual."
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,30 @@ jobs:
pixi run python --version | grep -q 3.11
pixi run test | grep -q "Hello world"

global-environments:
Comment thread
pavelzw marked this conversation as resolved.
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: ./
with:
Comment thread
olivier-lacroix marked this conversation as resolved.
run-install: false
global-environments: |
cowpy
keyring --with keyrings.google-artifactregistry-auth
- run: |
set -o pipefail
cowpy hello world
keyring --list-backends | grep "keyrings.gauth.GooglePythonAuth"
shell: bash
if: matrix.os != 'windows-latest'
- run: |
cowpy hello world
keyring --list-backends | findstr "keyrings.gauth.GooglePythonAuth"
if: matrix.os == 'windows-latest'

no-run-install:
strategy:
matrix:
Expand Down
33 changes: 28 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,15 @@ To see all available input arguments, see the [`action.yml`](action.yml) file.

### Caching

The action supports caching of the pixi environment.
By default, caching is enabled if a `pixi.lock` file is present.
The action supports caching of the project and global pixi environments.
By default, caching is enabled if a `pixi.lock` file is present for project environments.
It will then use the `pixi.lock` file to generate a hash of the environment and cache it.
For global environments, a hash is generated from the list of globally installed environments.
If the cache is hit, the action will skip the installation and use the cached environment.
You can specify the behavior by setting the `cache` input argument.

If you need to customize your cache-key, you can use the `cache-key` input argument.
This will be the prefix of the cache key. The full cache key will be `<cache-key><conda-arch>-<hash>`.
If you need to customize your cache-key, you can use the `cache-key` and `global-cache-key` input arguments.
These will be the prefixes of the cache keys. The full cache keys will be `<cache-key><conda-arch>-<hash>` and `<global-cache-key><conda-arch>-<hash>` respectively.

#### Only save caches on `main`

Expand Down Expand Up @@ -143,14 +144,34 @@ The following example will install both the `py311` and the `py312` environment
> [!WARNING]
> If you don't specify any environment, the `default` environment will be installed and cached, even if you use other environments.

### Global Environments

You can specify `pixi global install` commands by setting the `global-environments` input argument.

This will create one environement per line, install and cache them.

This is useful in particular to install executables that are needed for `pixi install` to work properly. For instance, the `keyring`, or `gcloud` executables. The following example shows how to install both in separate global environments

```yml
- uses: prefix-dev/setup-pixi@v0.9.0
with:
global-environments: |
google-cloud-sdk
keyring --with keyrings.google-artifactregistry-auth
- run: |
gcloud --version
keyring --list-backends
```

### Authentication

There are currently three ways to authenticate with pixi:
There are currently five ways to authenticate with pixi:

- using a token
- using a username and password
- using a conda-token
- using an S3 key pair
- using keyring for PyPI registries

For more information, see the [pixi documentation](https://prefix.dev/docs/pixi/authentication).

Expand Down Expand Up @@ -223,6 +244,8 @@ You can specify whether to use keyring to look up credentials for PyPI.
pypi-keyring-provider: subprocess # one of 'subprocess', 'disabled'
```

You can use the [`global-environments`](#global-environments) input to install `keyring` and its backends.

### Custom shell wrapper

`setup-pixi` allows you to run command inside of the pixi environment by specifying a custom shell wrapper with `shell: pixi run bash -e {0}`.
Expand Down
11 changes: 10 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ inputs:
environments:
description: |
A space-separated list of environments to install. If not specified, only the default environment is installed.
global-environments:
description: |
A newline-separated list of packages to install globally with `pixi global install`.
activate-environment:
description: |
If the installed environment should be "activated" for the current job, modifying `$GITHUB_ENV` and
Expand All @@ -33,11 +36,17 @@ inputs:
frozen:
description: Whether to use `pixi install --frozen`. Defaults to `false`.
cache:
description: Whether to cache the pixi environment. Defaults to `true`. Only works if `pixi.lock` is present.
description: |
Whether to cache the project and/or global environment(s). Defaults to `true`. Only works if `pixi.lock` is present
for project environment(s).
cache-key:
description: |
Cache key prefix to use for caching the pixi environment.
Defaults to `pixi-`. The full cache key is `<cache-key><conda-arch>-<sha-256-of-pixi-lock>`.
global-cache-key:
description: |
Cache key prefix to use for caching the global environments.
Defaults to `pixi-global-`. The full cache key is `<global-cache-key><conda-arch>-<sha-256-of-global-environments>`.
cache-write:
description: |
Whether to write to the cache or only read from it. Defaults to `true`.
Expand Down
Loading
Loading