From 2e6dfa6280f19b19379b628be96a192fb2343f37 Mon Sep 17 00:00:00 2001 From: Pavel Zwerschke Date: Fri, 2 Aug 2024 10:38:41 +0200 Subject: [PATCH 1/3] docs: Mention pixi exec in GHA docs --- docs/advanced/github_actions.md | 23 +++++++++++++++++++++++ docs/advanced/updates_github_actions.md | 3 +-- docs/reference/cli.md | 2 +- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/docs/advanced/github_actions.md b/docs/advanced/github_actions.md index 395cb8203..6fd36ad33 100644 --- a/docs/advanced/github_actions.md +++ b/docs/advanced/github_actions.md @@ -235,6 +235,29 @@ If you want to use PowerShell, you need to specify `-Command` as well. There are some custom shells provided by GitHub that have slightly different behavior, see [`jobs..steps[*].shell`](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell) in the documentation. 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. +#### One-off shell wrapper using `pixi exec` + +With `pixi exec`, you can also run a one-off command inside a temporary pixi environment. + +```yaml +- run: | # (1)! + zstd --version + shell: pixi exec --spec zstd -- bash -e {0} +``` + +1. everything here will be run inside of the temporary pixi environment + +```yaml +- run: | # (1)! + import ruamel.yaml + # ... + shell: pixi exec --spec python --spec ruamel.yaml -- python {0} +``` + +1. everything here will be run inside of the temporary pixi environment + +See [here](../reference/cli.md#exec) for more information about `pixi exec`. + ### Environment activation Instead of using a custom shell wrapper, you can also make all pixi-installed binaries available to subsequent steps by "activating" the installed environment in the currently running job. diff --git a/docs/advanced/updates_github_actions.md b/docs/advanced/updates_github_actions.md index c76e5ec01..8cf5c2663 100644 --- a/docs/advanced/updates_github_actions.md +++ b/docs/advanced/updates_github_actions.md @@ -41,8 +41,7 @@ jobs: run-install: false - name: Update lockfiles run: | - pixi global install pixi-diff-to-markdown - pixi update --json --no-install | pixi-diff-to-markdown >> diff.md + pixi update --json --no-install | pixi exec pixi-diff-to-markdown >> diff.md - name: Create pull request uses: peter-evans/create-pull-request@v6 with: diff --git a/docs/reference/cli.md b/docs/reference/cli.md index 5a9168a00..f47f2957c 100644 --- a/docs/reference/cli.md +++ b/docs/reference/cli.md @@ -94,7 +94,7 @@ pixi add --feature featurex numpy ``` !!! tip - If you want to use a non default pinning strategy, you can set it using [pixi's configuration](reference/pixi_configuration#pinning-strategy). + If you want to use a non default pinning strategy, you can set it using [pixi's configuration](./pixi_configuration.md#pinning-strategy). ``` pixi config set pinning-strategy no-pin --global ``` From 5d5d76a55e57c80b81f8b75b5208c9b8f37e9dbe Mon Sep 17 00:00:00 2001 From: Pavel Zwerschke Date: Fri, 2 Aug 2024 10:42:47 +0200 Subject: [PATCH 2/3] . --- docs/advanced/updates_github_actions.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/advanced/updates_github_actions.md b/docs/advanced/updates_github_actions.md index 8cf5c2663..4073180e3 100644 --- a/docs/advanced/updates_github_actions.md +++ b/docs/advanced/updates_github_actions.md @@ -41,6 +41,7 @@ jobs: run-install: false - name: Update lockfiles run: | + set -o pipefail pixi update --json --no-install | pixi exec pixi-diff-to-markdown >> diff.md - name: Create pull request uses: peter-evans/create-pull-request@v6 From d4682b8f06ec6e8775a90d65fb7951f46778631c Mon Sep 17 00:00:00 2001 From: Pavel Zwerschke Date: Fri, 2 Aug 2024 11:17:24 +0200 Subject: [PATCH 3/3] . --- docs/advanced/github_actions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/advanced/github_actions.md b/docs/advanced/github_actions.md index 6fd36ad33..2fca1d26d 100644 --- a/docs/advanced/github_actions.md +++ b/docs/advanced/github_actions.md @@ -251,7 +251,7 @@ With `pixi exec`, you can also run a one-off command inside a temporary pixi env - run: | # (1)! import ruamel.yaml # ... - shell: pixi exec --spec python --spec ruamel.yaml -- python {0} + shell: pixi exec --spec python=3.11.* --spec ruamel.yaml -- python {0} ``` 1. everything here will be run inside of the temporary pixi environment