Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: fix --env and extend actions examples #1005

Merged
merged 4 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
4 changes: 4 additions & 0 deletions docs/advanced/github_actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ The following example will install both the `py311` and the `py312` environment
environments: >- # (1)!
py311
py312
- run: |
pixi run -e py311 test
pixi run -e py312 test

ruben-arts marked this conversation as resolved.
Show resolved Hide resolved
```

1. separated by spaces, equivalent to
Expand Down
52 changes: 26 additions & 26 deletions docs/design_proposals/multi_environment_proposal.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,31 +263,31 @@ pixi run test

```yaml title=".github/workflows/test.yml"
jobs:
tests:
name: Test ${{ matrix.environment }}
runs-on: ubuntu-latest
strategy:
matrix:
environment:
- pl017
- pl018
- pl019
- pl020
- py39
- py310
- py311
- py312
steps:
tests-per-env:
runs-on: ubuntu-latest
strategy:
matrix:
environment: [py311, py312]
steps:
- uses: actions/checkout@v4
- uses: prefix-dev/[email protected]
- uses: prefix-dev/[email protected]
with:
environments: ${{ matrix.environment }}
- name: Run tasks
run: |
pixi run --environment ${{ matrix.environment }} test
tests-with-multiple-envs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: prefix-dev/[email protected]
with:
# already installs the corresponding environment and caches it
environments: ${{ matrix.environment }}
- name: Install dependencies
run: |
pixi run --env ${{ matrix.environment }} postinstall
pixi run --env ${{ matrix.environment }} test
environments: pl017 pl018
- run: |
pixi run -e pl017 test
pixi run -e pl018 test
```

??? tip "Test vs Production example"
This is an example of a project that has a `test` feature and `prod` environment.
The `prod` environment is a production environment that contains the run dependencies.
Expand Down Expand Up @@ -342,9 +342,9 @@ pixi run test
FROM ghcr.io/prefix-dev/pixi:latest # this doesn't exist yet
WORKDIR /app
COPY . .
RUN pixi run --env prod postinstall
RUN pixi run --environment prod postinstall
EXPOSE 8080
CMD ["/usr/local/bin/pixi", "run", "--env", "prod", "serve"]
CMD ["/usr/local/bin/pixi", "run", "--environment", "prod", "serve"]
```

??? tip "Multiple machines from one project"
Expand Down Expand Up @@ -402,13 +402,13 @@ pixi run test
```

```shell title="Running the project on a cuda machine"
pixi run train-model --env cuda
pixi run train-model --environment cuda
# will execute `python train.py --cuda`
# fails if not on linux-64 or win-64 with cuda 12.1
```

```shell title="Running the project with mlx"
pixi run train-model --env mlx
pixi run train-model --environment mlx
# will execute `python train.py --mlx`
# fails if not on osx-arm64
```
Expand Down
Loading