Skip to content
Merged
Changes from all commits
Commits
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
65 changes: 48 additions & 17 deletions docs/integration/ci/github_actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ We created [prefix-dev/setup-pixi](https://github.com/prefix-dev/setup-pixi) to
## Usage

```yaml
- uses: prefix-dev/setup-pixi@v0.8.3
- uses: prefix-dev/setup-pixi@v0.8.13
with:
pixi-version: v0.50.0
cache: true
Expand All @@ -19,7 +19,7 @@ We created [prefix-dev/setup-pixi](https://github.com/prefix-dev/setup-pixi) to

!!!warning "Pin your action versions"
Since pixi is not yet stable, the API of this action may change between minor versions.
Please pin the versions of this action to a specific version (i.e., `prefix-dev/setup-pixi@v0.8.3`) to avoid breaking changes.
Please pin the versions of this action to a specific version (i.e., `prefix-dev/setup-pixi@v0.8.13`) to avoid breaking changes.
You can automatically update the version of this action by using [Dependabot](https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot).

Put the following in your `.github/dependabot.yml` file to enable Dependabot for your GitHub Actions:
Expand Down Expand Up @@ -61,7 +61,7 @@ You can specify the behavior by setting the `cache` input argument.
This can be done by setting the `cache-write` argument.

```yaml
- uses: prefix-dev/setup-pixi@v0.8.3
- uses: prefix-dev/setup-pixi@v0.8.13
with:
cache: true
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
Expand Down Expand Up @@ -106,7 +106,7 @@ test:
environment: [py311, py312]
steps:
- uses: actions/checkout@v4
- uses: prefix-dev/setup-pixi@v0.8.3
- uses: prefix-dev/setup-pixi@v0.8.13
with:
environments: ${{ matrix.environment }}
```
Expand All @@ -116,7 +116,7 @@ test:
The following example will install both the `py311` and the `py312` environment on the runner.

```yaml
- uses: prefix-dev/setup-pixi@v0.8.3
- uses: prefix-dev/setup-pixi@v0.8.13
with:
environments: >- # (1)!
py311
Expand Down Expand Up @@ -157,7 +157,7 @@ Specify the token using the `auth-token` input argument.
This form of authentication (bearer token in the request headers) is mainly used at [prefix.dev](https://prefix.dev).

```yaml
- uses: prefix-dev/setup-pixi@v0.8.3
- uses: prefix-dev/setup-pixi@v0.8.13
with:
auth-host: prefix.dev
auth-token: ${{ secrets.PREFIX_DEV_TOKEN }}
Expand All @@ -169,7 +169,7 @@ Specify the username and password using the `auth-username` and `auth-password`
This form of authentication (HTTP Basic Auth) is used in some enterprise environments with [artifactory](https://jfrog.com/artifactory) for example.

```yaml
- uses: prefix-dev/setup-pixi@v0.8.3
- uses: prefix-dev/setup-pixi@v0.8.13
with:
auth-host: custom-artifactory.com
auth-username: ${{ secrets.PIXI_USERNAME }}
Expand All @@ -182,7 +182,7 @@ Specify the conda-token using the `conda-token` input argument.
This form of authentication (token is encoded in URL: `https://my-quetz-instance.com/t/<token>/get/custom-channel`) is used at [anaconda.org](https://anaconda.org) or with [quetz instances](https://github.com/mamba-org/quetz).

```yaml
- uses: prefix-dev/setup-pixi@v0.8.3
- uses: prefix-dev/setup-pixi@v0.8.13
with:
auth-host: anaconda.org # (1)!
auth-conda-token: ${{ secrets.CONDA_TOKEN }}
Expand All @@ -196,7 +196,7 @@ Specify the S3 key pair using the `auth-access-key-id` and `auth-secret-access-k
You can also specify the session token using the `auth-session-token` input argument.

```yaml
- uses: prefix-dev/setup-pixi@v0.8.3
- uses: prefix-dev/setup-pixi@v0.8.13
with:
auth-host: s3://my-s3-bucket
auth-s3-access-key-id: ${{ secrets.ACCESS_KEY_ID }}
Expand Down Expand Up @@ -279,15 +279,15 @@ To this end, `setup-pixi` adds all environment variables set when executing `pix
As a result, all installed binaries can be accessed without having to call `pixi run`.

```yaml
- uses: prefix-dev/setup-pixi@v0.8.3
- uses: prefix-dev/setup-pixi@v0.8.13
with:
activate-environment: true
```

If you are installing multiple environments, you will need to specify the name of the environment that you want to be activated.

```yaml
- uses: prefix-dev/setup-pixi@v0.8.3
- uses: prefix-dev/setup-pixi@v0.8.13
with:
environments: >-
py311
Expand All @@ -304,7 +304,7 @@ You can specify whether `setup-pixi` should run `pixi install --frozen` or `pixi
See the [official documentation](https://prefix.dev/docs/pixi/cli#install) for more information about the `--frozen` and `--locked` flags.

```yaml
- uses: prefix-dev/setup-pixi@v0.8.3
- uses: prefix-dev/setup-pixi@v0.8.13
with:
locked: true
# or
Expand Down Expand Up @@ -334,7 +334,7 @@ The second type is the debug logging of the pixi executable.
This can be specified by setting the `log-level` input.

```yaml
- uses: prefix-dev/setup-pixi@v0.8.3
- uses: prefix-dev/setup-pixi@v0.8.13
with:
log-level: vvv # (1)!
```
Expand All @@ -361,7 +361,7 @@ If nothing is specified, `post-cleanup` will default to `true`.
On self-hosted runners, you also might want to alter the default pixi install location to a temporary location. You can use `pixi-bin-path: ${{ runner.temp }}/bin/pixi` to do this.

```yaml
- uses: prefix-dev/setup-pixi@v0.8.3
- uses: prefix-dev/setup-pixi@v0.8.13
with:
post-cleanup: true
pixi-bin-path: ${{ runner.temp }}/bin/pixi # (1)!
Expand All @@ -377,7 +377,7 @@ You can also use a preinstalled local version of pixi on the runner by not setti
This can be overwritten by setting the `manifest-path` input argument.

```yaml
- uses: prefix-dev/setup-pixi@v0.8.3
- uses: prefix-dev/setup-pixi@v0.8.13
with:
manifest-path: pyproject.toml
```
Expand All @@ -387,7 +387,7 @@ This can be overwritten by setting the `manifest-path` input argument.
If you only want to install pixi and not install the current workspace, you can use the `run-install` option.

```yml
- uses: prefix-dev/setup-pixi@v0.8.3
- uses: prefix-dev/setup-pixi@v0.8.13
with:
run-install: false
```
Expand All @@ -398,12 +398,43 @@ You can also download pixi from a custom URL by setting the `pixi-url` input arg
Optionally, you can combine this with the `pixi-url-bearer-token` input argument to authenticate the download request.

```yml
- uses: prefix-dev/setup-pixi@v0.8.10
- uses: prefix-dev/setup-pixi@v0.8.13
with:
pixi-url: https://pixi-mirror.example.com/releases/download/v0.48.0/pixi-x86_64-unknown-linux-musl
pixi-url-bearer-token: ${{ secrets.PIXI_MIRROR_BEARER_TOKEN }}
```

The `pixi-url` input argument can also be a [Handlebars](https://handlebarsjs.com/) template string.
It will be rendered with the following variables:

- `version`: The version of pixi that is being installed (`latest` or a version like `v0.48.0`).
- `latest`: A boolean indicating if the version is `latest`.
- `pixiFile`: The name of the pixi binary to download, as determined by the system of the runner (e.g., `pixi-x86_64-unknown-linux-musl`).

By default, `pixi-url` is equivalent to the following template:

```yml
- uses: prefix-dev/setup-pixi@v0.8.13
with:
pixi-url: |
{{#if latest~}}
https://github.com/prefix-dev/pixi/releases/latest/download/{{pixiFile}}
{{~else~}}
https://github.com/prefix-dev/pixi/releases/download/{{version}}/{{pixiFile}}
{{~/if}}
```

### Setting inputs from environment variables

Alternatively to setting the inputs in the `with` section, you can also set each of them using environment variables.
The corresponding environment variable names are derived from the input names by converting them to uppercase, replacing hyphens with underscores, and prefixing them with `SETUP_PIXI_`.

For example, the `pixi-bin-path` input can be set using the `SETUP_PIXI_PIXI_BIN_PATH` environment variable.

This is particularly useful if executing the action on a self-hosted runner.

Inputs always take precedence over environment variables.

## More examples

If you want to see more examples, you can take a look at the [GitHub Workflows of the `setup-pixi` repository](https://github.com/prefix-dev/setup-pixi/blob/main/.github/workflows/test.yml).