Skip to content

Commit 60414de

Browse files
authored
support preinstalled local pixi (#98)
1 parent 4fc8d82 commit 60414de

File tree

9 files changed

+846
-109
lines changed

9 files changed

+846
-109
lines changed

.github/workflows/test.yml

+122-2
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ jobs:
195195
with:
196196
cache: false
197197
manifest-path: test/default/pixi.toml
198-
198+
199199
different-log-level:
200200
strategy:
201201
matrix:
@@ -230,6 +230,126 @@ jobs:
230230
# which pixi should be absolute
231231
which pixi | grep -q "^/"
232232
233+
existing-pixi-bin:
234+
strategy:
235+
matrix:
236+
os: [ubuntu-latest, macos-latest, windows-latest]
237+
ignore-reason: [ none, version, version-latest, url, bin-path]
238+
runs-on: ${{ matrix.os }}
239+
steps:
240+
- uses: actions/checkout@v4
241+
- name: Move pixi.toml
242+
run: mv test/default/* .
243+
- name: Create pixi directory and add to PATH
244+
run: |
245+
mkdir -p $HOME/custom-existing-pixi
246+
echo $HOME/custom-existing-pixi >> $GITHUB_PATH
247+
if: matrix.os != 'windows-latest'
248+
- name: Create pixi directory and add to PATH (Windows)
249+
run: |
250+
mkdir $env:USERPROFILE\custom-existing-pixi
251+
echo $env:USERPROFILE\custom-existing-pixi >> $env:GITHUB_PATH
252+
shell: pwsh
253+
if: matrix.os == 'windows-latest'
254+
- name: Download pixi binary (Ubuntu)
255+
run: |
256+
set -o pipefail
257+
curl -L --output $HOME/custom-existing-pixi/pixi https://github.com/prefix-dev/pixi/releases/download/v0.14.0/pixi-x86_64-unknown-linux-musl
258+
chmod +x $HOME/custom-existing-pixi/pixi
259+
if: matrix.os == 'ubuntu-latest'
260+
- name: Download pixi binary (macOS)
261+
run: |
262+
set -o pipefail
263+
curl -L --output $HOME/custom-existing-pixi/pixi https://github.com/prefix-dev/pixi/releases/download/v0.14.0/pixi-x86_64-apple-darwin
264+
chmod +x $HOME/custom-existing-pixi/pixi
265+
if: matrix.os == 'macos-latest'
266+
- name: Download pixi binary (Windows)
267+
run: |
268+
curl -L --output $HOME/custom-existing-pixi/pixi.exe https://github.com/prefix-dev/pixi/releases/download/v0.14.0/pixi-x86_64-pc-windows-msvc.exe
269+
if: matrix.os == 'windows-latest'
270+
- run: |
271+
echo "Path: $PATH"
272+
shell: bash
273+
- name: Verify pixi version (before setup-pixi)
274+
run: |
275+
pixi --version
276+
pixi --version | grep -q "pixi 0.14.0"
277+
shell: bash
278+
- name: Verify pixi path (before setup-pixi)
279+
run: |
280+
which pixi | grep -q $HOME/custom-existing-pixi/pixi
281+
shell: bash
282+
- name: Run Action (should use preinstalled pixi)
283+
uses: ./
284+
with:
285+
cache: false
286+
if: matrix.ignore-reason == 'none'
287+
- name: Run Action (version-latest should overwrite preinstalled pixi)
288+
uses: ./
289+
with:
290+
cache: false
291+
pixi-version: latest
292+
if: matrix.ignore-reason == 'version-latest'
293+
- name: Run Action (version should overwrite preinstalled pixi)
294+
uses: ./
295+
with:
296+
cache: false
297+
pixi-version: v0.16.0
298+
if: matrix.ignore-reason == 'version'
299+
- name: Run Action (url should overwrite preinstalled pixi)
300+
uses: ./
301+
with:
302+
cache: false
303+
pixi-url: |
304+
${{
305+
matrix.os == 'ubuntu-latest' &&
306+
'https://github.com/prefix-dev/pixi/releases/download/v0.16.0/pixi-x86_64-unknown-linux-musl'
307+
|| matrix.os == 'macos-latest' &&
308+
'https://github.com/prefix-dev/pixi/releases/download/v0.16.0/pixi-x86_64-apple-darwin'
309+
|| 'https://github.com/prefix-dev/pixi/releases/download/v0.16.0/pixi-x86_64-pc-windows-msvc.exe'
310+
}}
311+
if: matrix.ignore-reason == 'url'
312+
- name: Create custom bin directory
313+
run: mkdir custom-bin
314+
shell: bash
315+
if: matrix.ignore-reason == 'bin-path'
316+
- name: Run Action (pixi-bin-path should overwrite preinstalled pixi)
317+
uses: ./
318+
with:
319+
cache: false
320+
# this will implicitly set pixi-version to latest
321+
pixi-bin-path: custom-bin/pixi${{ matrix.os == 'windows-latest' && '.exe' || '' }}
322+
if: matrix.ignore-reason == 'bin-path'
323+
- name: Verify pixi version (after setup-pixi) - still at 0.14.0
324+
run: |
325+
pixi --version
326+
pixi --version | grep -q 0.14.0
327+
shell: bash
328+
if: matrix.ignore-reason == 'none'
329+
- name: Verify pixi version (after setup-pixi) - should be 0.16.0
330+
run: |
331+
pixi --version
332+
pixi --version | grep -q 0.16.0
333+
shell: bash
334+
if: matrix.ignore-reason != 'none' && matrix.ignore-reason != 'bin-path' && matrix.ignore-reason != 'version-latest'
335+
- name: Verify pixi version (after setup-pixi) - should be latest
336+
run: |
337+
pixi --version
338+
pixi --version | grep -vq 0.14.0
339+
pixi --version | grep -vq 0.16.0
340+
shell: bash
341+
if: matrix.ignore-reason == 'bin-path' || matrix.ignore-reason == 'version-latest'
342+
- name: Verify pixi path (after setup-pixi, no ignore reason)
343+
run: |
344+
which pixi | grep -q $HOME/custom-existing-pixi/pixi
345+
shell: bash
346+
if: matrix.ignore-reason == 'none'
347+
- name: Verify pixi path (after setup-pixi, ignore reason)
348+
run: |
349+
which pixi | grep -vq $HOME/custom-existing-pixi/pixi
350+
shell: bash
351+
if: matrix.ignore-reason != 'none'
352+
233353
auth-token:
234354
strategy:
235355
matrix:
@@ -573,7 +693,7 @@ jobs:
573693
cache-write: false
574694
cache-key: test-cache-${{ github.sha }}-${{ github.run_attempt }}-
575695
# check the action logs to see if the cache write was skipped
576-
696+
577697
custom-pyproject-manifest-path:
578698
strategy:
579699
matrix:

README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ GitHub Action to set up the [pixi](https://github.com/prefix-dev/pixi) package m
2525
```yml
2626
- uses: prefix-dev/[email protected]
2727
with:
28-
pixi-version: v0.18.0
28+
pixi-version: v0.19.1
2929
cache: true
3030
auth-host: prefix.dev
3131
auth-token: ${{ secrets.PREFIX_DEV_TOKEN }}
@@ -304,6 +304,9 @@ On self-hosted runners, you also might want to alter the default pixi install lo
304304
pixi-bin-path: ${{ runner.temp }}/bin/pixi
305305
```
306306

307+
You can also use a preinstalled local version of pixi on the runner by not setting any of the `pixi-version`,
308+
`pixi-url` or `pixi-bin-path` inputs. This action will then try to find a local version of pixi in the runner's PATH.
309+
307310
## More examples
308311

309312
If you want to see more examples, you can take a look at the [GitHub Workflows of this repository](.github/workflows/test.yml).

0 commit comments

Comments
 (0)