-
Notifications
You must be signed in to change notification settings - Fork 10
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
Add pwsh
as pixi shells to the tests and documentation
#79
Merged
pavelzw
merged 13 commits into
prefix-dev:main
from
ruben-arts:misc/add_shell_test_for_pwsh_cmd
Feb 17, 2024
+16
−6
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
5559df1
test: add pwsh and cmd as pixi shells
ruben-arts a947576
fix: use actual cmd and pwsh code.
ruben-arts 7b7e0b8
fix: use more github like shell call for cmd
ruben-arts dcfb5d2
fix: use `cmd.exe` instead of %COMSPEC%
ruben-arts 83b4e65
fix: don't use echo off
ruben-arts 2ec3573
fix: simplify cmd command
ruben-arts 765ee17
fix: ignore cmd.exe's existence
ruben-arts b704c12
bump pixi version
pavelzw 903a49b
Update README.md
ruben-arts 8abe675
use bash -e
pavelzw c8a5be9
bash -e in tests
pavelzw 6963a4f
Update README.md
ruben-arts 6cad0da
Update README.md
pavelzw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ GitHub Action to set up the [pixi](https://github.com/prefix-dev/pixi) package m | |
```yml | ||
- uses: prefix-dev/[email protected] | ||
with: | ||
pixi-version: v0.13.0 | ||
pixi-version: v0.14.0 | ||
cache: true | ||
auth-host: prefix.dev | ||
auth-token: ${{ secrets.PREFIX_DEV_TOKEN }} | ||
|
@@ -193,17 +193,17 @@ This form of authentication (token is encoded in URL: `https://my-quetz-instance | |
|
||
### Custom shell wrapper | ||
|
||
`setup-pixi` allows you to run command inside of the pixi environment by specifying a custom shell wrapper with `shell: pixi run bash {0}`. | ||
`setup-pixi` allows you to run command inside of the pixi environment by specifying a custom shell wrapper with `shell: pixi run bash -e {0}`. | ||
This can be useful if you want to run commands inside of the pixi environment, but don't want to use the `pixi run` command for each command. | ||
|
||
```yml | ||
- run: | # everything here will be run inside of the pixi environment | ||
python --version | ||
pip install -e --no-deps . | ||
shell: pixi run bash {0} | ||
shell: pixi run bash -e {0} | ||
``` | ||
|
||
You can even run python scripts like this: | ||
You can even run Python scripts like this: | ||
|
||
```yml | ||
- run: | # everything here will be run inside of the pixi environment | ||
|
@@ -212,9 +212,17 @@ You can even run python scripts like this: | |
shell: pixi run python {0} | ||
``` | ||
|
||
If you want to use PowerShell, you need to specify `-Command` as well. | ||
```yml | ||
- run: | # everything here will be run inside of the pixi environment | ||
python --version | Select-String "3.11" | ||
shell: pixi run pwsh -Command {0} # pwsh works on all platforms | ||
``` | ||
|
||
> [!NOTE] | ||
> Under the hood, the `shell: xyz {0}` option is implemented by creating a temporary script file and calling `xyz` with that script file as an argument. | ||
> 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}`. | ||
ruben-arts marked this conversation as resolved.
Show resolved
Hide resolved
|
||
> There are some custom shells provided by GitHub that have slightly different behavior, see [`jobs.<job_id>.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. | ||
|
||
### `--frozen` and `--locked` | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering why this even works 🤔 shouldn't it be
-File
? The thing in{0}
will be replaced by a path to the script at runtime...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I started with
-File
but changed to-Command
because that is what github uses: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshellThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interesting... we unfortunately don't have the power to do this :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's also change the bash shell to
bash -e
while we're at itThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also find it super weird that there is different bash behavior when specifying
bash
or not specifying anything on unix...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah no clue this whole shell thing isn't the most ergonomic feature.