Skip to content

Commit

Permalink
Add support for setup-pixi
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelzw committed Oct 20, 2023
1 parent 3420088 commit 78a8550
Show file tree
Hide file tree
Showing 6 changed files with 2,056 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# GitHub syntax highlighting
pixi.lock linguist-language=YAML

15 changes: 15 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,18 @@ jobs:
pytest-md
pytest-emoji
- uses: ./.

test-pixi:
name: Run tests (setup-pixi)
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4
- name: Set up micromamba environment
uses: prefix-dev/[email protected]
- uses: ./.
with:
custom-pytest: pixi run pytest
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
**/.pytest_cache/
venv/
.idea/
.pixi
26 changes: 20 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,14 @@ If you want to change the time zone of the job summary, you may want to use the

## Activating `conda` environments

This action uses `bash -l {0}` as the shell to run `pytest` in,
i.e., the login shell that also sources your `.bash_profile`.
When using `bash` in GitHub Actions, it doesn't source your `.bash_profile` by default.
If you want to use a `conda` environment, you need to make sure to add it into your `.bash_profile` s.t.
the `conda` environment automatically gets activated.
[mamba-org/setup-micromamba](https://github.com/mamba-org/setup-micromamba)
### setup-micromamba

This action uses `bash -l {0}` as the shell to run `pytest` in,
i.e., the login shell that also sources your `.bash_profile`.
When using `bash` in GitHub Actions, it doesn't source your `.bash_profile` by default.
If you want to use a `conda` environment, you need to make sure to add it into your `.bash_profile` s.t.
the `conda` environment automatically gets activated.
[mamba-org/setup-micromamba](https://github.com/mamba-org/setup-micromamba)
does this automatically for you.

```yml
Expand All @@ -68,6 +70,18 @@ does this automatically for you.
- uses: pavelzw/pytest-action@v2
```

### setup-pixi

You can also use [pixi](https://github.com/prefix-dev/pixi) to work with conda environments.
For this, use the [setup-pixi](https://github.com/prefix-dev/setup-pixi) action with `custom-pytest: pixi run pytest`:

```yml
- uses: prefix-dev/[email protected]
- uses: pavelzw/pytest-action@v2
with:
custom-pytest: pixi run pytest
```

## Example Usage

```yml
Expand Down
Loading

0 comments on commit 78a8550

Please sign in to comment.