Skip to content

Commit

Permalink
Add support for --locked and --frozen (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelzw authored Oct 3, 2023
1 parent 041b177 commit e2bb9e2
Show file tree
Hide file tree
Showing 12 changed files with 1,434 additions and 25 deletions.
15 changes: 9 additions & 6 deletions .github/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,24 @@ changelog:
labels:
- ignore for release
categories:
- title: New features
- title: 💥 Breaking changes
labels:
- breaking
- title: ✨ New features
labels:
- enhancement
- title: CI
- title: 👷🏻 CI
labels:
- ci
- title: Bug fixes
- title: 🐛 Bug fixes
labels:
- bug
- title: Documentation
- title: 📝 Documentation
labels:
- documentation
- title: Dependency updates
- title: ⬆️ Dependency updates
labels:
- dependencies
- title: Other changes
- title: 🤷🏻 Other changes
labels:
- "*"
97 changes: 97 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,38 @@ jobs:
- uses: ./
with:
pixi-version: v0.1.0
# pixi 0.1.0 doesn't support --locked
locked: false
- run: pixi --version | grep -q "pixi 0.1.0"

frozen:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Move pixi.toml
run: mv test/default/* .
- uses: ./
with:
frozen: true
- run: pixi run python --version | grep -q 3.11

locked:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Move pixi.toml
run: mv test/default/* .
- uses: ./
with:
locked: true
- run: pixi run python --version | grep -q 3.11

custom-pixi-url:
runs-on: ubuntu-latest
steps:
Expand All @@ -75,6 +105,8 @@ jobs:
- uses: ./
with:
pixi-url: https://github.com/prefix-dev/pixi/releases/download/v0.0.8/pixi-x86_64-unknown-linux-musl
# pixi 0.0.8 doesn't support --locked
locked: false
- run: pixi --version | grep -q "pixi 0.0.8"

custom-manifest-path:
Expand Down Expand Up @@ -438,3 +470,68 @@ jobs:
# pixi-version: 0.1.0
# - run: exit 1
# if: success()

# test-frozen-and-locked:
# runs-on: ${{ matrix.os }}
# strategy:
# fail-fast: false
# matrix:
# os: [windows-latest, ubuntu-latest, macos-latest]
# steps:
# - uses: actions/checkout@v4
# - name: Move pixi files
# run: mv test/default/* .
# - uses: ./
# with:
# pixi-version: v0.5.0
# frozen: true
# locked: true
# - run: exit 1
# if: success()

# test-frozen-no-lockfile:
# runs-on: ${{ matrix.os }}
# strategy:
# fail-fast: false
# matrix:
# os: [windows-latest, ubuntu-latest, macos-latest]
# steps:
# - uses: actions/checkout@v4
# - name: Move pixi files
# run: mv test/no-lockfile/* .
# - uses: ./
# with:
# frozen: true
# - run: exit 1
# if: success()

# test-locked-no-lockfile:
# runs-on: ${{ matrix.os }}
# strategy:
# fail-fast: false
# matrix:
# os: [windows-latest, ubuntu-latest, macos-latest]
# steps:
# - uses: actions/checkout@v4
# - name: Move pixi files
# run: mv test/no-lockfile/* .
# - uses: ./
# with:
# locked: true
# - run: exit 1
# if: success()

# test-lockfile-not-up-to-date:
# runs-on: ${{ matrix.os }}
# strategy:
# fail-fast: false
# matrix:
# os: [windows-latest, ubuntu-latest, macos-latest]
# steps:
# - uses: actions/checkout@v4
# - name: Move pixi files
# run: mv test/lockfile-not-up-to-date/* .
# - uses: ./
# # locked: true is implicit
# - run: exit 1
# if: success()
33 changes: 24 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ GitHub Action to set up the [pixi](https://github.com/prefix-dev/pixi) package m
## Usage

```yml
- uses: prefix-dev/setup-pixi@v0.2.1
- uses: prefix-dev/setup-pixi@v0.3.0
with:
pixi-version: v0.3.0
pixi-version: v0.5.0
cache: true
auth-host: prefix.dev
auth-token: ${{ secrets.PREFIX_DEV_TOKEN }}
Expand All @@ -34,7 +34,7 @@ GitHub Action to set up the [pixi](https://github.com/prefix-dev/pixi) package m
> [!WARNING]
> 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.2.1`) to avoid breaking changes.
> Please pin the versions of this action to a specific version (i.e., `prefix-dev/setup-pixi@v0.3.0`) 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).

## Features
Expand Down Expand Up @@ -71,7 +71,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).

```yml
- uses: prefix-dev/setup-pixi@v0.2.1
- uses: prefix-dev/setup-pixi@v0.3.0
with:
auth-host: prefix.dev
auth-token: ${{ secrets.PREFIX_DEV_TOKEN }}
Expand All @@ -83,7 +83,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.

```yml
- uses: prefix-dev/setup-pixi@v0.2.1
- uses: prefix-dev/setup-pixi@v0.3.0
with:
auth-host: custom-artifactory.com
auth-username: ${{ secrets.PIXI_USERNAME }}
Expand All @@ -96,7 +96,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).

```yml
- uses: prefix-dev/setup-pixi@v0.2.1
- uses: prefix-dev/setup-pixi@v0.3.0
with:
auth-host: anaconda.org # or my-quetz-instance.com
conda-token: ${{ secrets.CONDA_TOKEN }}
Expand Down Expand Up @@ -128,6 +128,21 @@ You can even run python scripts like this:
> This file does not have the executable bit set, so you cannot use `shell: pixi run {0}` directly but instead have to use `shell: pixi run bash {0}`.
> See the [official documentation](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#custom-shell) and [ADR 0277](https://github.com/actions/runner/blob/main/docs/adrs/0277-run-action-shell-options.md) for more information about how the `shell:` input works in GitHub Actions.

### `--frozen` and `--locked`

You can specify whether `setup-pixi` should run `pixi install --frozen` or `pixi install --locked` depending on the `frozen` or the `locked` input argument.
See the [official documentation](https://prefix.dev/docs/pixi/cli#install) for more information about the `--frozen` and `--locked` flags.

```yml
- uses: prefix-dev/[email protected]
with:
locked: true
# or
frozen: true
```

If you don't specify anything, the default behavior is to run `pixi install --locked` if a `pixi.lock` file is present and `pixi install` otherwise.

### Debugging

There are two types of debug logging that you can enable.
Expand All @@ -138,7 +153,7 @@ The first one is the debug logging of the action itself.
This can be enabled by running the action with the `RUNNER_DEBUG` environment variable set to `true`.

```yml
- uses: prefix-dev/setup-pixi@v0.2.1
- uses: prefix-dev/setup-pixi@v0.3.0
env:
RUNNER_DEBUG: true
```
Expand All @@ -156,7 +171,7 @@ The second type is the debug logging of the pixi executable.
This can be specified by setting the `log-level` input.

```yml
- uses: prefix-dev/setup-pixi@v0.2.1
- uses: prefix-dev/setup-pixi@v0.3.0
with:
# one of `q`, `default`, `v`, `vv`, or `vvv`.
log-level: vvv
Expand All @@ -180,7 +195,7 @@ If you set `post-cleanup` to `true`, the action will delete the following files:
If nothing is specified, `setup-pixi` will default to `true`.

```yml
- uses: prefix-dev/setup-pixi@v0.2.1
- uses: prefix-dev/setup-pixi@v0.3.0
with:
post-cleanup: false
```
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ inputs:
description: Path to the manifest file (i.e., `pixi.toml`) to use for the pixi CLI. Defaults to `pixi.toml`.
run-install:
description: Whether to run `pixi install` after setting up the environment. Defaults to `true`.
locked:
description: Whether to use `pixi install --locked`. Defaults to `true` when the lockfile is present, otherwise `false`.
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.
cache-key:
Expand Down
22 changes: 21 additions & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions dist/post.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "setup-pixi",
"version": "0.2.1",
"version": "0.3.0",
"private": true,
"description": "Action to set up the pixi package manager.",
"scripts": {
Expand Down Expand Up @@ -30,7 +30,7 @@
"zod": "^3.22.2"
},
"devDependencies": {
"@types/node": "^20.8.0",
"@types/node": "^20.8.2",
"@typescript-eslint/eslint-plugin": "^6.7.3",
"@typescript-eslint/parser": "^6.7.3",
"eslint": "^8.50.0",
Expand Down
Loading

0 comments on commit e2bb9e2

Please sign in to comment.