Compare commits

..
18 Commits
Author SHA1 Message Date
Pavel Zwerschke e2bb9e2af8 Add support for --locked and --frozen (#21) 2023-10-03 11:52:52 +00:00
dependabot[bot]anddependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 041b177283 Bump the dev-dependencies group with 3 updates (#20)
Bumps the dev-dependencies group with 3 updates: [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node), [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) and [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser).


Updates `@types/node` from 20.6.5 to 20.8.0
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Updates `@typescript-eslint/eslint-plugin` from 6.7.2 to 6.7.3
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.7.3/packages/eslint-plugin)

Updates `@typescript-eslint/parser` from 6.7.2 to 6.7.3
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.7.3/packages/parser)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: dev-dependencies
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: dev-dependencies
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: dev-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-02 07:13:20 +02:00
Pavel Zwerschke c2b1b0900e Add proper auth test (#13) 2023-09-29 14:03:10 +00:00
dependabot[bot]anddependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> fa1893576e Bump the dev-dependencies group with 4 updates (#19)
Bumps the dev-dependencies group with 4 updates: [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node), [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin), [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) and [eslint](https://github.com/eslint/eslint).


Updates `@types/node` from 20.6.2 to 20.6.5
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Updates `@typescript-eslint/eslint-plugin` from 6.7.0 to 6.7.2
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.7.2/packages/eslint-plugin)

Updates `@typescript-eslint/parser` from 6.7.0 to 6.7.2
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.7.2/packages/parser)

Updates `eslint` from 8.49.0 to 8.50.0
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.49.0...v8.50.0)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: dev-dependencies
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: dev-dependencies
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: dev-dependencies
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: dev-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-25 11:36:59 +00:00
dependabot[bot]dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>Pavel Zwerschke
2d8ad6d40b Bump @actions/core from 1.10.0 to 1.10.1 (#18)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Pavel Zwerschke <pavelzw@gmail.com>
2023-09-18 07:50:14 +00:00
dependabot[bot] 3386b66ca6 Bump the dev-dependencies group with 3 updates (#17) 2023-09-18 08:57:59 +02:00
Pavel Zwerschke f2b00643d1 Improve error messages (#16) 2023-09-13 13:53:07 +00:00
dependabot[bot] baaee6ddca Bump the dev-dependencies group with 1 update (#12) 2023-09-11 08:13:20 +02:00
dependabot[bot]anddependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 0588e20b3b Bump actions/checkout from 3 to 4 (#9)
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-10 08:49:39 +00:00
dependabot[bot]anddependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> cd462a6dae Bump the dev-dependencies group with 4 updates (#10)
Bumps the dev-dependencies group with 4 updates: [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node), [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin), [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) and [eslint](https://github.com/eslint/eslint).


Updates `@types/node` from 20.5.9 to 20.6.0
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Updates `@typescript-eslint/eslint-plugin` from 6.5.0 to 6.6.0
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.6.0/packages/eslint-plugin)

Updates `@typescript-eslint/parser` from 6.5.0 to 6.6.0
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.6.0/packages/parser)

Updates `eslint` from 8.48.0 to 8.49.0
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.48.0...v8.49.0)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: dev-dependencies
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: dev-dependencies
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: dev-dependencies
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: dev-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-10 08:41:40 +00:00
Pavel Zwerschke 1004096c21 Migrate to prefix-dev 2023-09-10 10:20:06 +02:00
Pavel Zwerschke 3416289b3a Add shields (#8) 2023-09-09 19:32:59 +00:00
Pavel Zwerschke 4a577033f0 Bump version 2023-09-09 21:08:33 +02:00
Pavel Zwerschke 9f7faaabfb Add readme (#7) 2023-09-09 19:01:56 +00:00
Pavel Zwerschke f6701cc41d Remove generate-run-shell (#6) 2023-09-09 18:12:08 +00:00
Pavel Zwerschke 1a516323cb Add more tests (#5) 2023-09-09 20:04:57 +02:00
Pavel Zwerschke b1283a4612 Bump version 2023-09-07 18:38:48 +02:00
Pavel Zwerschke e250ab868e readme 2023-09-07 18:38:26 +02:00
26 changed files with 10352 additions and 510 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

+9 -6
View File
@@ -3,21 +3,24 @@ changelog:
labels:
- ignore for release
categories:
- title: New features
- title: 💥 Breaking changes
labels:
- breaking
- title: ✨ New features
labels:
- enhancement
- title: CI
- title: 👷🏻 CI
labels:
- ci
- title: Bug fixes
- title: 🐛 Bug fixes
labels:
- bug
- title: Documentation
- title: 📝 Documentation
labels:
- documentation
- title: Dependency updates
- title: ⬆️ Dependency updates
labels:
- dependencies
- title: Other changes
- title: 🤷🏻 Other changes
labels:
- "*"
+1 -1
View File
@@ -11,7 +11,7 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v2
+1 -1
View File
@@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v2
+1 -1
View File
@@ -12,7 +12,7 @@ jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: Quantco/ui-actions/version-metadata@v1
id: version-metadata
with:
+404 -58
View File
@@ -9,19 +9,38 @@ on:
jobs:
default:
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Move pixi.toml
run: mv test/default/* .
- uses: ./
- run: |
set -o pipefail
pixi info
test -f .pixi/env/bin/python
./.pixi/env/bin/python --version | grep -q 3.11
shell: bash
if: matrix.os != 'windows-latest'
- run: |
set -o pipefail
pixi info
test -f .pixi/env/python.exe
./.pixi/env/python.exe --version | grep -q 3.11
shell: bash
if: matrix.os == 'windows-latest'
- run: |
pixi run python --version | grep -q 3.11
pixi run test | grep -q "Hello world"
no-run-install:
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Move pixi.toml
@@ -31,9 +50,13 @@ jobs:
run-install: false
- run: |
! test -d .pixi
shell: bash
custom-pixi-version:
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Move pixi.toml
@@ -41,8 +64,38 @@ jobs:
- uses: ./
with:
pixi-version: v0.1.0
# pixi 0.1.0 doesn't support --locked
locked: false
- run: pixi --version | grep -q "pixi 0.1.0"
frozen:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Move pixi.toml
run: mv test/default/* .
- uses: ./
with:
frozen: true
- run: pixi run python --version | grep -q 3.11
locked:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Move pixi.toml
run: mv test/default/* .
- uses: ./
with:
locked: true
- run: pixi run python --version | grep -q 3.11
custom-pixi-url:
runs-on: ubuntu-latest
steps:
@@ -52,10 +105,15 @@ jobs:
- uses: ./
with:
pixi-url: https://github.com/prefix-dev/pixi/releases/download/v0.0.8/pixi-x86_64-unknown-linux-musl
# pixi 0.0.8 doesn't support --locked
locked: false
- run: pixi --version | grep -q "pixi 0.0.8"
custom-manifest-path:
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: ./
@@ -65,7 +123,7 @@ jobs:
different-log-level:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
@@ -73,49 +131,47 @@ jobs:
run: mv test/default/* .
- uses: ./
with:
log-level: debug
# run-shell:
# strategy:
# matrix:
# os: [ubuntu-latest, macos-latest]
# runs-on: ${{ matrix.os }}
# steps:
# - uses: actions/checkout@v4
# - name: Move pixi.toml
# run: mv test/default/* .
# - uses: ./
# with:
# generate-run-shell: true
# - run: python --version | grep -q "3.11"
# shell: pixi-shell {0}
log-level: v
custom-bin-path:
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Move pixi.toml
run: mv test/default/* .
- name: Create bin directory
run: mkdir bin
- uses: ./
with:
pixi-bin-path: bin/pixi
pixi-bin-path: custom-bin/pixi${{ matrix.os == 'windows-latest' && '.exe' || '' }}
- run: |
which pixi | grep -q "..."
test -f custom-bin/pixi${{ matrix.os == 'windows-latest' && '.exe' || '' }}
pixi --help
which pixi | grep -q custom-bin/pixi
# which pixi should be absolute
which pixi | grep -q "^/"
auth-token:
runs-on: windows-latest
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Move pixi.toml
run: mv test/default/* .
- uses: ./
with:
auth-host: TODO
auth-token: TODO
# TODO
# - run:
auth-host: https://custom-conda-registry.com
auth-token: custom-token
- run: |
grep -q "BearerToken" ~/.rattler/rattler_auth_store.json
grep -q "custom-conda-registry.com" ~/.rattler/rattler_auth_store.json
grep -q "custom-token" ~/.rattler/rattler_auth_store.json
# all other platforms have the credentials stored in the keychain
# https://github.com/prefix-dev/pixi/issues/330
if: matrix.os == 'ubuntu-latest'
auth-username-password:
strategy:
@@ -128,41 +184,81 @@ jobs:
run: mv test/default/* .
- uses: ./
with:
auth-host: TODO
auth-username: TODO
auth-password: TODO
auth-host: https://custom-conda-registry.com
auth-username: custom-username
auth-password: custom-password
- run: |
grep -q "BasicHTTP" ~/.rattler/rattler_auth_store.json
grep -q "custom-conda-registry.com" ~/.rattler/rattler_auth_store.json
grep -q "custom-username" ~/.rattler/rattler_auth_store.json
grep -q "custom-password" ~/.rattler/rattler_auth_store.json
# all other platforms have the credentials stored in the keychain
# https://github.com/prefix-dev/pixi/issues/330
if: matrix.os == 'ubuntu-latest'
auth-conda-token:
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Move pixi.toml
run: mv test/default/* .
- uses: ./
with:
auth-host: TODO
auth-conda-token: TODO
auth-host: https://custom-conda-registry.com
auth-conda-token: custom-conda-token
- run: |
grep "CondaToken" ~/.rattler/rattler_auth_store.json
cat ~/.rattler/rattler_auth_store.json
grep -q "custom-conda-registry.com" ~/.rattler/rattler_auth_store.json
grep -q "custom-conda-token" ~/.rattler/rattler_auth_store.json
# all other platforms have the credentials stored in the keychain
# https://github.com/prefix-dev/pixi/issues/330
if: matrix.os == 'ubuntu-latest'
post-cleanup:
# not implemented yet
if: false
name: post-cleanup ${{ matrix.post-cleanup }}
auth-token-install:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Move pixi.toml
run: mv test/auth/* .
- uses: ./
with:
auth-host: https://repo.prefix.dev
auth-token: ${{ secrets.PREFIX_DEV_TOKEN }}
- name: Ensure private-package is installed
run: |
test -f .pixi/env/conda-meta/private-package-0.0.1-0.json
pixi-shell:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Move pixi.toml
run: mv test/default/* .
- uses: ./
- run: |
python --version | grep -q "3.11"
shell: pixi run bash {0}
- run: |
import sys
print(sys.version)
print("Hello world")
shell: pixi run python {0}
post-cleanup-linux:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- post-cleanup: 'none'
env-exists: ''
cache-exists: ''
pixi-dir-exists: ''
- post-cleanup: 'environment'
env-exists: '! '
cache-exists: ''
pixi-dir-exists: ''
- post-cleanup: 'all'
env-exists: '! '
cache-exists: '! '
pixi-dir-exists: '! '
post-cleanup: ['true', 'false']
steps:
- uses: actions/checkout@v4
- name: Move pixi.toml
@@ -171,21 +267,271 @@ jobs:
with:
run: |
set -euxo pipefail
${{ matrix.env-exists }}test -d .pixi
${{ matrix.cache-exists }}test -d ~/.cache/rattler
${{ matrix.pixi-dir-exists }}test -f ~/.pixi
${{ matrix.post-cleanup == 'true' && '! ' || '' }}test -d .pixi
${{ matrix.post-cleanup == 'true' && '! ' || '' }}test -d ~/.rattler
${{ matrix.post-cleanup == 'true' && '! ' || '' }}test -d ~/.cache/rattler
${{ matrix.post-cleanup == 'true' && '! ' || '' }}test -f ~/.pixi/bin/pixi
- uses: ./
with:
post-cleanup: ${{ matrix.post-cleanup }}
# ~/.rattler is only created if the user has logged in
auth-host: https://custom-conda-registry.com
auth-token: custom-token
post-cleanup-linux-no-login:
runs-on: ubuntu-latest
strategy:
matrix:
post-cleanup: ['true', 'false']
steps:
- uses: actions/checkout@v4
- name: Move pixi.toml
run: mv test/default/* .
- uses: lisanna-dettwyler/action-post-run@d053b9b43d788b87a409f6cdb3b6fc87c6c8a4fe
with:
run: |
set -euxo pipefail
${{ matrix.post-cleanup == 'true' && '! ' || '' }}test -d .pixi
! test -d ~/.rattler
${{ matrix.post-cleanup == 'true' && '! ' || '' }}test -d ~/.cache/rattler
${{ matrix.post-cleanup == 'true' && '! ' || '' }}test -f ~/.pixi/bin/pixi
- uses: ./
with:
post-cleanup: ${{ matrix.post-cleanup }}
post-cleanup-macos:
runs-on: macos-latest
strategy:
matrix:
post-cleanup: ['true', 'false']
steps:
- uses: actions/checkout@v4
- name: Move pixi.toml
run: mv test/default/* .
- uses: lisanna-dettwyler/action-post-run@d053b9b43d788b87a409f6cdb3b6fc87c6c8a4fe
with:
run: |
set -euxo pipefail
${{ matrix.post-cleanup == 'true' && '! ' || '' }}test -d .pixi
${{ matrix.post-cleanup == 'true' && '! ' || '' }}test -d ~/Library/Caches/rattler
${{ matrix.post-cleanup == 'true' && '! ' || '' }}test -f ~/.pixi/bin/pixi
- uses: ./
with:
post-cleanup: ${{ matrix.post-cleanup }}
post-cleanup-windows:
runs-on: windows-latest
strategy:
matrix:
post-cleanup: ['true', 'false']
steps:
- uses: actions/checkout@v4
- name: Move pixi.toml
run: mv test/default/* .
- uses: lisanna-dettwyler/action-post-run@d053b9b43d788b87a409f6cdb3b6fc87c6c8a4fe
with:
run: |
set -euxo pipefail
${{ matrix.post-cleanup == 'true' && '! ' || '' }}test -d .pixi
${{ matrix.post-cleanup == 'true' && '! ' || '' }}test -d "$LOCALAPPDATA/rattler"
${{ matrix.post-cleanup == 'true' && '! ' || '' }}test -f ~/.pixi/bin/pixi
- uses: ./
with:
post-cleanup: ${{ matrix.post-cleanup }}
no-lockfile:
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Move pixi.toml
run: mv test/no-lockfile/* .
- uses: ./
- run: |
set -o pipefail
pixi info
test -f .pixi/env/bin/python
./.pixi/env/bin/python --version | grep -q 3.11
shell: bash
if: matrix.os != 'windows-latest'
- run: |
set -o pipefail
pixi info
test -f .pixi/env/python.exe
./.pixi/env/python.exe --version | grep -q 3.11
shell: bash
if: matrix.os == 'windows-latest'
- run: |
pixi run python --version | grep -q 3.11
pixi run test | grep -q "Hello world"
test-cache1:
name: Test cache 1/2
timeout-minutes: 10
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- name: Move pixi files
run: mv test/default/* .
- uses: ./
with:
cache: true
cache-key: test-cache-${{ github.sha }}-${{ github.run_attempt }}-
# check the action logs to see if the cache was written
- run: |
test -f .pixi/env/bin/python
if: matrix.os != 'windows-latest'
- run: |
test -f .pixi/env/python.exe
if: matrix.os == 'windows-latest'
test-cache2:
name: Test cache 2/2
timeout-minutes: 10
needs: test-cache1
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- name: Move pixi files
run: mv test/default/* .
- uses: ./
with:
cache: true
cache-key: test-cache-${{ github.sha }}-${{ github.run_attempt }}-
# check the action logs to see if the cache was restored
- run: |
test -f .pixi/env/bin/python
if: matrix.os != 'windows-latest'
- run: |
test -f .pixi/env/python.exe
if: matrix.os == 'windows-latest'
test-cache-no-write:
name: Test cache no write
timeout-minutes: 10
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- name: Move pixi files
run: mv test/default/* .
- uses: ./
with:
cache: true
cache-write: false
cache-key: test-cache-${{ github.sha }}-${{ github.run_attempt }}-
# check the action logs to see if the cache write was skipped
# not properly testable
# https://github.com/actions/runner/issues/2347
# https://github.com/orgs/community/discussions/15452
# test-cache-fail-no-lockfile:
# runs-on: ${{ matrix.os }}
# strategy:
# fail-fast: false
# matrix:
# os: [windows-latest, ubuntu-latest, macos-latest]
# steps:
# - uses: actions/checkout@v4
# - name: Move pixi files
# run: mv test/no-lockfile/* .
# - uses: ./
# with:
# cache: true
# cache-key: test-cache-no-lockfile-${{ github.sha }}-${{ github.run_attempt }}-
# - run: exit 1
# if: success()
# test-incorrect-version:
# runs-on: ${{ matrix.os }}
# strategy:
# fail-fast: false
# matrix:
# os: [windows-latest, ubuntu-latest, macos-latest]
# steps:
# - uses: actions/checkout@v4
# - name: Move pixi files
# run: mv test/default/* .
# - uses: ./
# with:
# pixi-version: 0.1.0
# - run: exit 1
# if: success()
# test-frozen-and-locked:
# runs-on: ${{ matrix.os }}
# strategy:
# fail-fast: false
# matrix:
# os: [windows-latest, ubuntu-latest, macos-latest]
# steps:
# - uses: actions/checkout@v4
# - name: Move pixi files
# run: mv test/default/* .
# - uses: ./
# with:
# pixi-version: v0.5.0
# frozen: true
# locked: true
# - run: exit 1
# if: success()
# test-frozen-no-lockfile:
# runs-on: ${{ matrix.os }}
# strategy:
# fail-fast: false
# matrix:
# os: [windows-latest, ubuntu-latest, macos-latest]
# steps:
# - uses: actions/checkout@v4
# - name: Move pixi files
# run: mv test/no-lockfile/* .
# - uses: ./
# with:
# frozen: true
# - run: exit 1
# if: success()
# test-locked-no-lockfile:
# runs-on: ${{ matrix.os }}
# strategy:
# fail-fast: false
# matrix:
# os: [windows-latest, ubuntu-latest, macos-latest]
# steps:
# - uses: actions/checkout@v4
# - name: Move pixi files
# run: mv test/no-lockfile/* .
# - uses: ./
# with:
# locked: true
# - run: exit 1
# if: success()
# test-lockfile-not-up-to-date:
# runs-on: ${{ matrix.os }}
# strategy:
# fail-fast: false
# matrix:
# os: [windows-latest, ubuntu-latest, macos-latest]
# steps:
# - uses: actions/checkout@v4
# - name: Move pixi files
# run: mv test/lockfile-not-up-to-date/* .
# - uses: ./
# # locked: true is implicit
# - run: exit 1
# if: success()
+212
View File
@@ -0,0 +1,212 @@
<h1 align="center">
[![License][license-badge]][license]
[![CI][build-badge]][build]
[![Latest release][latest-release-badge]][releases]
[![Project Chat][chat-badge]][chat-url]
[license-badge]: https://img.shields.io/github/license/prefix-dev/setup-pixi?style=flat-square
[license]: ./LICENSE
[build-badge]: https://img.shields.io/github/actions/workflow/status/prefix-dev/setup-pixi/test.yml?style=flat-square
[build]: https://github.com/prefix-dev/setup-pixi/actions/
[latest-release-badge]: https://img.shields.io/github/v/tag/prefix-dev/setup-pixi?style=flat-square&label=latest&sort=semver
[releases]: https://github.com/prefix-dev/setup-pixi/releases
[chat-badge]: https://img.shields.io/discord/1082332781146800168.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2&style=flat-square
[chat-url]: https://discord.gg/kKV8ZxyzY4
</h1>
# setup-pixi 📦
GitHub Action to set up the [pixi](https://github.com/prefix-dev/pixi) package manager.
## Usage
```yml
- uses: prefix-dev/setup-pixi@v0.3.0
with:
pixi-version: v0.5.0
cache: true
auth-host: prefix.dev
auth-token: ${{ secrets.PREFIX_DEV_TOKEN }}
- run: pixi run test
```
> [!WARNING]
> Since pixi is not yet stable, the API of this action may change between minor versions.
> Please pin the versions of this action to a specific version (i.e., `prefix-dev/setup-pixi@v0.3.0`) to avoid breaking changes.
> You can automatically update the version of this action by using [Dependabot](https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot).
## Features
To see all available input arguments, see the [`action.yml`](action.yml) file.
### Caching
The action supports caching of the pixi environment. To enable caching, set `cache: true`.
It will then use the `pixi.lock` file to generate a hash of the environment and cache it.
If the cache is hit, the action will skip the installation and use the cached environment.
If you need to customize your cache-key, you can use the `cache-key` input argument.
This will be the prefix of the cache key. The full cache key will be `<cache-key><conda-arch>-<hash>`.
### Authentication
There are currently three ways to authenticate with pixi:
- using a token
- using a username and password
- using a conda-token
For more information, see the [pixi documentation](https://prefix.dev/docs/pixi/authentication).
> [!WARNING]
> Please only store sensitive information using [GitHub secrets](https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions). Do not store them in your repository.
> When your sensitive information is stored in a GitHub secret, you can access it using the `${{ secrets.SECRET_NAME }}` syntax.
> These secrets will always be masked in the logs.
#### Token
Specify the token using the `auth-token` input argument.
This form of authentication (bearer token in the request headers) is mainly used at [prefix.dev](https://prefix.dev).
```yml
- uses: prefix-dev/setup-pixi@v0.3.0
with:
auth-host: prefix.dev
auth-token: ${{ secrets.PREFIX_DEV_TOKEN }}
```
#### Username and password
Specify the username and password using the `auth-username` and `auth-password` input arguments.
This form of authentication (HTTP Basic Auth) is used in some enterprise environments with [artifactory](https://jfrog.com/artifactory) for example.
```yml
- uses: prefix-dev/setup-pixi@v0.3.0
with:
auth-host: custom-artifactory.com
auth-username: ${{ secrets.PIXI_USERNAME }}
auth-password: ${{ secrets.PIXI_PASSWORD }}
```
#### Conda-token
Specify the conda-token using the `conda-token` input argument.
This form of authentication (token is encoded in URL: `https://my-quetz-instance.com/t/<token>/get/custom-channel`) is used at [anaconda.org](https://anaconda.org) or with [quetz instances](https://github.com/mamba-org/quetz).
```yml
- uses: prefix-dev/setup-pixi@v0.3.0
with:
auth-host: anaconda.org # or my-quetz-instance.com
conda-token: ${{ secrets.CONDA_TOKEN }}
```
### 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}`.
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}
```
You can even run python scripts like this:
```yml
- run: | # everything here will be run inside of the pixi environment
import my_package
print("Hello world!")
shell: pixi run python {0}
```
> [!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}`.
> 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`
You can specify whether `setup-pixi` should run `pixi install --frozen` or `pixi install --locked` depending on the `frozen` or the `locked` input argument.
See the [official documentation](https://prefix.dev/docs/pixi/cli#install) for more information about the `--frozen` and `--locked` flags.
```yml
- uses: prefix-dev/setup-pixi@v0.3.0
with:
locked: true
# or
frozen: true
```
If you don't specify anything, the default behavior is to run `pixi install --locked` if a `pixi.lock` file is present and `pixi install` otherwise.
### Debugging
There are two types of debug logging that you can enable.
#### Debug logging of the action
The first one is the debug logging of the action itself.
This can be enabled by running the action with the `RUNNER_DEBUG` environment variable set to `true`.
```yml
- uses: prefix-dev/setup-pixi@v0.3.0
env:
RUNNER_DEBUG: true
```
Alternatively, you can enable debug logging for the action by re-running the action in debug mode:
![Re-run in debug mode](.github/assets/enable-debug-logging-light.png#gh-light-mode-only)
![Re-run in debug mode](.github/assets/enable-debug-logging-dark.png#gh-dark-mode-only)
> For more information about debug logging in GitHub Actions, see [the official documentation](https://docs.github.com/en/actions/monitoring-and-troubleshooting-workflows/enabling-debug-logging).
#### Debug logging of pixi
The second type is the debug logging of the pixi executable.
This can be specified by setting the `log-level` input.
```yml
- uses: prefix-dev/setup-pixi@v0.3.0
with:
# one of `q`, `default`, `v`, `vv`, or `vvv`.
log-level: vvv
```
If nothing is specified, `setup-pixi` will default to `default` or `vv` depending on if [debug logging is enabled for the action](#debug-logging-of-the-action).
### Post action cleanup
On self hosted runners, it may happen that some files are persisted between jobs.
This can lead to problems or secrets getting leaked between job runs.
To avoid this, you can use the `post-cleanup` input to specify the post cleanup behavior of the action (i.e., what happens _after_ all your commands have been executed).
If you set `post-cleanup` to `true`, the action will delete the following files:
- `.pixi` environment
- the pixi binary
- the rattler cache
- other rattler files in `~/.rattler`
If nothing is specified, `setup-pixi` will default to `true`.
```yml
- uses: prefix-dev/setup-pixi@v0.3.0
with:
post-cleanup: false
```
## More examples
If you want to see more examples, you can take a look at the [GitHub Workflows of this repository](.github/workflows/test.yml).
## Local Development
1. Clone this repository.
1. Run `pnpm install` inside the repository (if you don't have [`pnpm`](https://github.com/pnpm/pnpm) installed, you can install it with `npm install -g pnpm` or `brew install pnpm`).
1. Run `pnpm dev` for live transpilation of the TypeScript source code.
1. To test the action, you can run [`act`](https://github.com/nektos/act) (inside docker) or use :sparkles: CI driven development :sparkles:.
+11 -11
View File
@@ -13,20 +13,24 @@ inputs:
log-level:
description: |
Log level for the pixi CLI.
One of `quiet`, `warn`, `info`, `debug`, or `trace`.
One of `q`, `default`, `v`, `vv`, or `vvv`.
manifest-path:
description: Path to the manifest file (i.e., `pixi.toml`) to use for the pixi CLI. Defaults to `pixi.toml`.
run-install:
description: Whether to run `pixi install` after setting up the environment. Defaults to `true`.
generate-run-shell:
description: |
Whether to generate a custom shell script that allows to use it in the workflow file using `run: pixi-shell {0}`.
locked:
description: Whether to use `pixi install --locked`. Defaults to `true` when the lockfile is present, otherwise `false`.
frozen:
description: Whether to use `pixi install --frozen`. Defaults to `false`.
cache:
description: Whether to cache the pixi environment. Defaults to `true`. Only works if `pixi.lock` is present.
cache-key:
description: |
Cache key prefix to use for caching the pixi environment.
Defaults to `pixi-{conda-arch}`.
Defaults to `pixi-`. The full cache key is `<cache-key><conda-arch>-<sha-256-of-pixi-lock>`.
cache-write:
description: |
Whether to write to the cache or only read from it. Defaults to `true`.
pixi-bin-path:
description: |
Path to the pixi binary to use. Defaults to `~/.pixi/bin/pixi`.
@@ -45,12 +49,8 @@ inputs:
description: Conda token to use for authentication.
post-cleanup:
description: |
What kind of cleanup the action should do in the post step.
One of `none`, `environment` or `all`.
If `none`, no cleanup is done.
If `environment`, the pixi environment is removed.
If `all`, the pixi environment, the pixi CLI are removed and the rattler cache is cleared.
Defaults to `all`.
If the action should clean up after itself. Defaults to `true`.
If `true`, the pixi environment, the pixi binary and the rattler files in ~/.rattler and ~/.cache/rattler are removed.
runs:
using: node20
Generated Vendored
+281 -219
View File
@@ -33,9 +33,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// node_modules/.pnpm/@actions+core@1.10.0/node_modules/@actions/core/lib/utils.js
// node_modules/.pnpm/@actions+core@1.10.1/node_modules/@actions/core/lib/utils.js
var require_utils = __commonJS({
"node_modules/.pnpm/@actions+core@1.10.0/node_modules/@actions/core/lib/utils.js"(exports) {
"node_modules/.pnpm/@actions+core@1.10.1/node_modules/@actions/core/lib/utils.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.toCommandProperties = exports.toCommandValue = void 0;
@@ -65,9 +65,9 @@ var require_utils = __commonJS({
}
});
// node_modules/.pnpm/@actions+core@1.10.0/node_modules/@actions/core/lib/command.js
// node_modules/.pnpm/@actions+core@1.10.1/node_modules/@actions/core/lib/command.js
var require_command = __commonJS({
"node_modules/.pnpm/@actions+core@1.10.0/node_modules/@actions/core/lib/command.js"(exports) {
"node_modules/.pnpm/@actions+core@1.10.1/node_modules/@actions/core/lib/command.js"(exports) {
"use strict";
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
if (k2 === void 0)
@@ -99,11 +99,11 @@ var require_command = __commonJS({
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.issue = exports.issueCommand = void 0;
var os6 = __importStar(require("os"));
var os7 = __importStar(require("os"));
var utils_1 = require_utils();
function issueCommand(command, properties, message) {
const cmd = new Command(command, properties, message);
process.stdout.write(cmd.toString() + os6.EOL);
process.stdout.write(cmd.toString() + os7.EOL);
}
exports.issueCommand = issueCommand;
function issue(name, message = "") {
@@ -500,9 +500,9 @@ var init_esm_node = __esm({
}
});
// node_modules/.pnpm/@actions+core@1.10.0/node_modules/@actions/core/lib/file-command.js
// node_modules/.pnpm/@actions+core@1.10.1/node_modules/@actions/core/lib/file-command.js
var require_file_command = __commonJS({
"node_modules/.pnpm/@actions+core@1.10.0/node_modules/@actions/core/lib/file-command.js"(exports) {
"node_modules/.pnpm/@actions+core@1.10.1/node_modules/@actions/core/lib/file-command.js"(exports) {
"use strict";
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
if (k2 === void 0)
@@ -535,7 +535,7 @@ var require_file_command = __commonJS({
Object.defineProperty(exports, "__esModule", { value: true });
exports.prepareKeyValueMessage = exports.issueFileCommand = void 0;
var fs4 = __importStar(require("fs"));
var os6 = __importStar(require("os"));
var os7 = __importStar(require("os"));
var uuid_1 = (init_esm_node(), __toCommonJS(esm_node_exports));
var utils_1 = require_utils();
function issueFileCommand(command, message) {
@@ -546,7 +546,7 @@ var require_file_command = __commonJS({
if (!fs4.existsSync(filePath)) {
throw new Error(`Missing file at path: ${filePath}`);
}
fs4.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os6.EOL}`, {
fs4.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os7.EOL}`, {
encoding: "utf8"
});
}
@@ -560,7 +560,7 @@ var require_file_command = __commonJS({
if (convertedValue.includes(delimiter2)) {
throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter2}"`);
}
return `${key}<<${delimiter2}${os6.EOL}${convertedValue}${os6.EOL}${delimiter2}`;
return `${key}<<${delimiter2}${os7.EOL}${convertedValue}${os7.EOL}${delimiter2}`;
}
exports.prepareKeyValueMessage = prepareKeyValueMessage;
}
@@ -1570,9 +1570,9 @@ var require_auth = __commonJS({
}
});
// node_modules/.pnpm/@actions+core@1.10.0/node_modules/@actions/core/lib/oidc-utils.js
// node_modules/.pnpm/@actions+core@1.10.1/node_modules/@actions/core/lib/oidc-utils.js
var require_oidc_utils = __commonJS({
"node_modules/.pnpm/@actions+core@1.10.0/node_modules/@actions/core/lib/oidc-utils.js"(exports) {
"node_modules/.pnpm/@actions+core@1.10.1/node_modules/@actions/core/lib/oidc-utils.js"(exports) {
"use strict";
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
function adopt(value) {
@@ -1637,7 +1637,7 @@ var require_oidc_utils = __commonJS({
Error Code : ${error2.statusCode}
Error Message: ${error2.result.message}`);
Error Message: ${error2.message}`);
});
const id_token = (_a2 = res.result) === null || _a2 === void 0 ? void 0 : _a2.value;
if (!id_token) {
@@ -1668,9 +1668,9 @@ var require_oidc_utils = __commonJS({
}
});
// node_modules/.pnpm/@actions+core@1.10.0/node_modules/@actions/core/lib/summary.js
// node_modules/.pnpm/@actions+core@1.10.1/node_modules/@actions/core/lib/summary.js
var require_summary = __commonJS({
"node_modules/.pnpm/@actions+core@1.10.0/node_modules/@actions/core/lib/summary.js"(exports) {
"node_modules/.pnpm/@actions+core@1.10.1/node_modules/@actions/core/lib/summary.js"(exports) {
"use strict";
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
function adopt(value) {
@@ -1962,9 +1962,9 @@ var require_summary = __commonJS({
}
});
// node_modules/.pnpm/@actions+core@1.10.0/node_modules/@actions/core/lib/path-utils.js
// node_modules/.pnpm/@actions+core@1.10.1/node_modules/@actions/core/lib/path-utils.js
var require_path_utils = __commonJS({
"node_modules/.pnpm/@actions+core@1.10.0/node_modules/@actions/core/lib/path-utils.js"(exports) {
"node_modules/.pnpm/@actions+core@1.10.1/node_modules/@actions/core/lib/path-utils.js"(exports) {
"use strict";
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
if (k2 === void 0)
@@ -2012,9 +2012,9 @@ var require_path_utils = __commonJS({
}
});
// node_modules/.pnpm/@actions+core@1.10.0/node_modules/@actions/core/lib/core.js
// node_modules/.pnpm/@actions+core@1.10.1/node_modules/@actions/core/lib/core.js
var require_core = __commonJS({
"node_modules/.pnpm/@actions+core@1.10.0/node_modules/@actions/core/lib/core.js"(exports) {
"node_modules/.pnpm/@actions+core@1.10.1/node_modules/@actions/core/lib/core.js"(exports) {
"use strict";
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
if (k2 === void 0)
@@ -2076,7 +2076,7 @@ var require_core = __commonJS({
var command_1 = require_command();
var file_command_1 = require_file_command();
var utils_1 = require_utils();
var os6 = __importStar(require("os"));
var os7 = __importStar(require("os"));
var path4 = __importStar(require("path"));
var oidc_utils_1 = require_oidc_utils();
var ExitCode;
@@ -2144,7 +2144,7 @@ Support boolean input list: \`true | True | TRUE | false | False | FALSE\``);
if (filePath) {
return file_command_1.issueFileCommand("OUTPUT", file_command_1.prepareKeyValueMessage(name, value));
}
process.stdout.write(os6.EOL);
process.stdout.write(os7.EOL);
command_1.issueCommand("set-output", { name }, utils_1.toCommandValue(value));
}
exports.setOutput = setOutput;
@@ -2152,15 +2152,15 @@ Support boolean input list: \`true | True | TRUE | false | False | FALSE\``);
command_1.issue("echo", enabled2 ? "on" : "off");
}
exports.setCommandEcho = setCommandEcho;
function setFailed2(message) {
function setFailed3(message) {
process.exitCode = ExitCode.Failure;
error2(message);
}
exports.setFailed = setFailed2;
function isDebug2() {
exports.setFailed = setFailed3;
function isDebug3() {
return process.env["RUNNER_DEBUG"] === "1";
}
exports.isDebug = isDebug2;
exports.isDebug = isDebug3;
function debug5(message) {
command_1.issueCommand("debug", {}, message);
}
@@ -2178,7 +2178,7 @@ Support boolean input list: \`true | True | TRUE | false | False | FALSE\``);
}
exports.notice = notice;
function info3(message) {
process.stdout.write(message + os6.EOL);
process.stdout.write(message + os7.EOL);
}
exports.info = info3;
function startGroup(name) {
@@ -3886,12 +3886,12 @@ var require_manifest = __commonJS({
exports._readLinuxVersionFile = exports._getOsVersion = exports._findMatch = void 0;
var semver = __importStar(require_semver());
var core_1 = require_core();
var os6 = require("os");
var os7 = require("os");
var cp = require("child_process");
var fs4 = require("fs");
function _findMatch(versionSpec, stable, candidates, archFilter) {
return __awaiter(this, void 0, void 0, function* () {
const platFilter = os6.platform();
const platFilter = os7.platform();
let result;
let match;
let file;
@@ -3928,7 +3928,7 @@ var require_manifest = __commonJS({
}
exports._findMatch = _findMatch;
function _getOsVersion() {
const plat = os6.platform();
const plat = os7.platform();
let version3 = "";
if (plat === "darwin") {
version3 = cp.execSync("sw_vers -productVersion").toString();
@@ -4101,7 +4101,7 @@ var require_toolrunner = __commonJS({
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.argStringToArray = exports.ToolRunner = void 0;
var os6 = __importStar(require("os"));
var os7 = __importStar(require("os"));
var events = __importStar(require("events"));
var child = __importStar(require("child_process"));
var path4 = __importStar(require("path"));
@@ -4156,12 +4156,12 @@ var require_toolrunner = __commonJS({
_processLineBuffer(data, strBuffer, onLine) {
try {
let s = strBuffer + data.toString();
let n = s.indexOf(os6.EOL);
let n = s.indexOf(os7.EOL);
while (n > -1) {
const line = s.substring(0, n);
onLine(line);
s = s.substring(n + os6.EOL.length);
n = s.indexOf(os6.EOL);
s = s.substring(n + os7.EOL.length);
n = s.indexOf(os7.EOL);
}
return s;
} catch (err) {
@@ -4330,7 +4330,7 @@ var require_toolrunner = __commonJS({
}
const optionsNonNull = this._cloneExecOptions(this.options);
if (!optionsNonNull.silent && optionsNonNull.outStream) {
optionsNonNull.outStream.write(this._getCommandString(optionsNonNull) + os6.EOL);
optionsNonNull.outStream.write(this._getCommandString(optionsNonNull) + os7.EOL);
}
const state = new ExecState(optionsNonNull, this.toolPath);
state.on("debug", (message) => {
@@ -4816,7 +4816,7 @@ var require_tool_cache = __commonJS({
var io = __importStar(require_io());
var fs4 = __importStar(require("fs"));
var mm = __importStar(require_manifest());
var os6 = __importStar(require("os"));
var os7 = __importStar(require("os"));
var path4 = __importStar(require("path"));
var httpm = __importStar(require_lib());
var semver = __importStar(require_semver());
@@ -5095,7 +5095,7 @@ var require_tool_cache = __commonJS({
function cacheDir(sourceDir, tool, version3, arch3) {
return __awaiter(this, void 0, void 0, function* () {
version3 = semver.clean(version3) || version3;
arch3 = arch3 || os6.arch();
arch3 = arch3 || os7.arch();
core5.debug(`Caching tool ${tool} ${version3} ${arch3}`);
core5.debug(`source dir: ${sourceDir}`);
if (!fs4.statSync(sourceDir).isDirectory()) {
@@ -5114,7 +5114,7 @@ var require_tool_cache = __commonJS({
function cacheFile(sourceFile, targetFile, tool, version3, arch3) {
return __awaiter(this, void 0, void 0, function* () {
version3 = semver.clean(version3) || version3;
arch3 = arch3 || os6.arch();
arch3 = arch3 || os7.arch();
core5.debug(`Caching tool ${tool} ${version3} ${arch3}`);
core5.debug(`source file: ${sourceFile}`);
if (!fs4.statSync(sourceFile).isFile()) {
@@ -5136,7 +5136,7 @@ var require_tool_cache = __commonJS({
if (!versionSpec) {
throw new Error("versionSpec parameter is required");
}
arch3 = arch3 || os6.arch();
arch3 = arch3 || os7.arch();
if (!isExplicitVersion(versionSpec)) {
const localVersions = findAllVersions(toolName, arch3);
const match = evaluateVersions(localVersions, versionSpec);
@@ -5159,7 +5159,7 @@ var require_tool_cache = __commonJS({
exports.find = find2;
function findAllVersions(toolName, arch3) {
const versions = [];
arch3 = arch3 || os6.arch();
arch3 = arch3 || os7.arch();
const toolPath = path4.join(_getCacheDirectory(), toolName);
if (fs4.existsSync(toolPath)) {
const children2 = fs4.readdirSync(toolPath);
@@ -5210,7 +5210,7 @@ var require_tool_cache = __commonJS({
});
}
exports.getManifestFromRepo = getManifestFromRepo;
function findFromManifest(versionSpec, stable, manifest, archFilter = os6.arch()) {
function findFromManifest(versionSpec, stable, manifest, archFilter = os7.arch()) {
return __awaiter(this, void 0, void 0, function* () {
const match = yield mm._findMatch(versionSpec, stable, manifest, archFilter);
return match;
@@ -6554,7 +6554,7 @@ var require_internal_pattern = __commonJS({
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Pattern = void 0;
var os6 = __importStar(require("os"));
var os7 = __importStar(require("os"));
var path4 = __importStar(require("path"));
var pathHelper = __importStar(require_internal_path_helper());
var assert_1 = __importDefault(require("assert"));
@@ -6647,7 +6647,7 @@ var require_internal_pattern = __commonJS({
if (pattern === "." || pattern.startsWith(`.${path4.sep}`)) {
pattern = _Pattern.globEscape(process.cwd()) + pattern.substr(1);
} else if (pattern === "~" || pattern.startsWith(`~${path4.sep}`)) {
homedir = homedir || os6.homedir();
homedir = homedir || os7.homedir();
assert_1.default(homedir, "Unable to determine HOME directory");
assert_1.default(pathHelper.hasAbsoluteRoot(homedir), `Expected HOME directory to be a rooted path. Actual '${homedir}'`);
pattern = _Pattern.globEscape(homedir) + pattern.substr(1);
@@ -18941,12 +18941,12 @@ var init_sanitizer = __esm({
});
// node_modules/.pnpm/@azure+core-http@3.0.3/node_modules/@azure/core-http/dist-esm/src/util/inspect.js
var import_util2, custom;
var import_util, custom;
var init_inspect = __esm({
"node_modules/.pnpm/@azure+core-http@3.0.3/node_modules/@azure/core-http/dist-esm/src/util/inspect.js"() {
"use strict";
import_util2 = require("util");
custom = import_util2.inspect.custom;
import_util = require("util");
custom = import_util.inspect.custom;
}
});
@@ -18983,14 +18983,14 @@ var init_restError = __esm({
// node_modules/.pnpm/@azure+logger@1.0.4/node_modules/@azure/logger/dist-esm/src/log.js
function log(message, ...args) {
process.stderr.write(`${import_util3.default.format(message, ...args)}${import_os2.EOL}`);
process.stderr.write(`${import_util2.default.format(message, ...args)}${import_os2.EOL}`);
}
var import_os2, import_util3;
var import_os2, import_util2;
var init_log = __esm({
"node_modules/.pnpm/@azure+logger@1.0.4/node_modules/@azure/logger/dist-esm/src/log.js"() {
"use strict";
import_os2 = require("os");
import_util3 = __toESM(require("util"));
import_util2 = __toESM(require("util"));
}
});
@@ -22602,9 +22602,9 @@ var init_requestPolicy = __esm({
/**
* The main method to implement that manipulates a request/response.
*/
constructor(_nextPolicy, _options) {
constructor(_nextPolicy, _options2) {
this._nextPolicy = _nextPolicy;
this._options = _options;
this._options = _options2;
}
/**
* Get whether or not a log with the provided log level should be logged.
@@ -29300,15 +29300,15 @@ function getPlatformSpecificData() {
};
const osInfo = {
key: "OS",
value: `(${os3.arch()}-${os3.type()}-${os3.release()})`
value: `(${os4.arch()}-${os4.type()}-${os4.release()})`
};
return [runtimeInfo, osInfo];
}
var os3;
var os4;
var init_msRestUserAgentPolicy = __esm({
"node_modules/.pnpm/@azure+core-http@3.0.3/node_modules/@azure/core-http/dist-esm/src/policies/msRestUserAgentPolicy.js"() {
"use strict";
os3 = __toESM(require("os"));
os4 = __toESM(require("os"));
init_constants();
}
});
@@ -29352,10 +29352,10 @@ var init_userAgentPolicy = __esm({
init_httpHeaders();
getDefaultUserAgentHeaderName = getDefaultUserAgentKey;
UserAgentPolicy = class extends BaseRequestPolicy {
constructor(_nextPolicy, _options, headerKey, headerValue) {
super(_nextPolicy, _options);
constructor(_nextPolicy, _options2, headerKey, headerValue) {
super(_nextPolicy, _options2);
this._nextPolicy = _nextPolicy;
this._options = _options;
this._options = _options2;
this.headerKey = headerKey;
this.headerValue = headerValue;
}
@@ -30781,7 +30781,7 @@ var init_ProxyTracer = __esm({
ProxyTracer2.prototype.startSpan = function(name, options2, context3) {
return this._getTracer().startSpan(name, options2, context3);
};
ProxyTracer2.prototype.startActiveSpan = function(_name, _options, _context, _fn) {
ProxyTracer2.prototype.startActiveSpan = function(_name, _options2, _context, _fn) {
var tracer = this._getTracer();
return Reflect.apply(tracer.startActiveSpan, tracer, arguments);
};
@@ -30811,7 +30811,7 @@ var init_NoopTracerProvider = __esm({
function() {
function NoopTracerProvider2() {
}
NoopTracerProvider2.prototype.getTracer = function(_name, _version, _options) {
NoopTracerProvider2.prototype.getTracer = function(_name, _version, _options2) {
return new NoopTracer();
};
return NoopTracerProvider2;
@@ -46011,7 +46011,7 @@ var init_Credential = __esm({
* @param _nextPolicy -
* @param _options -
*/
create(_nextPolicy, _options) {
create(_nextPolicy, _options2) {
throw new Error("Method should be implemented in children classes.");
}
};
@@ -46078,12 +46078,12 @@ var init_TelemetryPolicy = __esm({
});
// node_modules/.pnpm/@azure+storage-blob@12.15.0/node_modules/@azure/storage-blob/dist-esm/storage-blob/src/TelemetryPolicyFactory.js
var os4, TelemetryPolicyFactory;
var os5, TelemetryPolicyFactory;
var init_TelemetryPolicyFactory = __esm({
"node_modules/.pnpm/@azure+storage-blob@12.15.0/node_modules/@azure/storage-blob/dist-esm/storage-blob/src/TelemetryPolicyFactory.js"() {
"use strict";
init_src6();
os4 = __toESM(require("os"));
os5 = __toESM(require("os"));
init_TelemetryPolicy();
init_constants2();
TelemetryPolicyFactory = class {
@@ -46105,8 +46105,8 @@ var init_TelemetryPolicyFactory = __esm({
userAgentInfo.push(libInfo);
}
let runtimeInfo = `(NODE-VERSION ${process.version})`;
if (os4) {
runtimeInfo = `(NODE-VERSION ${process.version}; ${os4.type()} ${os4.release()})`;
if (os5) {
runtimeInfo = `(NODE-VERSION ${process.version}; ${os5.type()} ${os5.release()})`;
}
if (userAgentInfo.indexOf(runtimeInfo) === -1) {
userAgentInfo.push(runtimeInfo);
@@ -57377,13 +57377,16 @@ var require_cache = __commonJS({
var import_promises2 = __toESM(require("fs/promises"));
var import_os3 = __toESM(require("os"));
var import_path3 = __toESM(require("path"));
var import_process2 = require("process");
var core4 = __toESM(require_core());
var import_tool_cache = __toESM(require_tool_cache());
// src/options.ts
var import_path = __toESM(require("path"));
var import_os = __toESM(require("os"));
var core2 = __toESM(require_core());
var import_process = require("process");
var import_fs = require("fs");
var core = __toESM(require_core());
// node_modules/.pnpm/zod@3.22.2/node_modules/zod/lib/index.mjs
var util;
@@ -60950,10 +60953,180 @@ var nullableType = ZodNullable.create;
var preprocessType = ZodEffects.createWithPreprocess;
var pipelineType = ZodPipeline.create;
// node_modules/.pnpm/untildify@5.0.0/node_modules/untildify/index.js
var import_node_os = __toESM(require("os"), 1);
var homeDirectory = import_node_os.default.homedir();
function untildify(pathWithTilde) {
if (typeof pathWithTilde !== "string") {
throw new TypeError(`Expected a string, got ${typeof pathWithTilde}`);
}
return homeDirectory ? pathWithTilde.replace(/^~(?=$|\/|\\)/, homeDirectory) : pathWithTilde;
}
// src/options.ts
var logLevelSchema = enumType(["q", "default", "v", "vv", "vvv"]);
var PATHS = {
pixiBin: import_path.default.join(import_os.default.homedir(), ".pixi", "bin", `pixi${import_os.default.platform() === "win32" ? ".exe" : ""}`)
};
var parseOrUndefined = (key, schema, errorMessage) => {
const input = core.getInput(key);
if (input === "") {
return void 0;
}
const maybeResult = schema.safeParse(input);
if (!maybeResult.success) {
if (!errorMessage) {
throw new Error(`${key} is not valid: ${maybeResult.error.message}`);
}
throw new Error(errorMessage);
}
return maybeResult.data;
};
var parseOrUndefinedJSON = (key, schema) => {
const input = core.getInput(key);
if (input === "") {
return void 0;
}
return schema.parse(JSON.parse(input));
};
var validateInputs = (inputs) => {
if (inputs.pixiVersion && inputs.pixiUrl) {
throw new Error("You need to specify either pixi-version or pixi-url");
}
if (inputs.cacheKey !== void 0 && inputs.cache === false) {
throw new Error("Cannot specify cache key without caching");
}
if (inputs.runInstall === false && inputs.cache === true) {
throw new Error("Cannot cache without running install");
}
if (inputs.runInstall === false && inputs.frozen === true) {
throw new Error("Cannot use `frozen: true` when not running install");
}
if (inputs.runInstall === false && inputs.locked === true) {
throw new Error("Cannot use `locked: true` when not running install");
}
if (inputs.locked === true && inputs.frozen === true) {
throw new Error("Cannot use `locked: true` and `frozen: true` at the same time");
}
if (inputs.authUsername && !inputs.authPassword || !inputs.authUsername && inputs.authPassword) {
throw new Error("You need to specify both auth-username and auth-password");
}
if (inputs.authHost) {
if (!inputs.authToken && !inputs.authUsername && !inputs.authCondaToken) {
throw new Error("You need to specify either auth-token or auth-username and auth-password or auth-conda-token");
}
if (inputs.authToken && (inputs.authUsername || inputs.authCondaToken) || inputs.authUsername && inputs.authCondaToken) {
throw new Error("You cannot specify two auth methods");
}
}
if (!inputs.authHost) {
if (inputs.authToken || inputs.authUsername || inputs.authCondaToken) {
throw new Error("You need to specify auth-host");
}
}
if (inputs.cacheWrite && !inputs.cacheKey && !inputs.cache) {
throw new Error("cache-write is only valid with cache-key or cache specified.");
}
};
var inferOptions = (inputs) => {
const runInstall = inputs.runInstall ?? true;
const pixiSource = inputs.pixiVersion ? { version: inputs.pixiVersion } : inputs.pixiUrl ? { url: inputs.pixiUrl } : { version: "latest" };
const logLevel = inputs.logLevel ?? (core.isDebug() ? "vv" : "default");
const manifestPath = inputs.manifestPath ? import_path.default.resolve(untildify(inputs.manifestPath)) : "pixi.toml";
const pixiLockFile = import_path.default.join(import_path.default.dirname(manifestPath), import_path.default.basename(manifestPath).replace(/\.toml$/, ".lock"));
const cache2 = inputs.cacheKey ? { cacheKeyPrefix: inputs.cacheKey, cacheWrite: inputs.cacheWrite ?? true } : inputs.cache ? { cacheKeyPrefix: "pixi-", cacheWrite: true } : void 0;
const pixiBinPath = inputs.pixiBinPath ? import_path.default.resolve(untildify(inputs.pixiBinPath)) : PATHS.pixiBin;
const pixiRunShell = import_path.default.join(import_path.default.dirname(pixiBinPath), "pixi-shell");
const frozen = inputs.frozen ?? false;
const lockFileAvailable = (0, import_fs.existsSync)(pixiLockFile);
core.debug(`lockFileAvailable: ${lockFileAvailable}`);
const locked = inputs.locked ?? (lockFileAvailable && !frozen);
const auth = !inputs.authHost ? void 0 : inputs.authToken ? {
host: inputs.authHost,
token: inputs.authToken
} : inputs.authCondaToken ? {
host: inputs.authHost,
condaToken: inputs.authCondaToken
} : {
host: inputs.authHost,
username: inputs.authUsername,
password: inputs.authPassword
};
const postCleanup = inputs.postCleanup ?? true;
return {
pixiSource,
logLevel,
manifestPath,
pixiLockFile,
runInstall,
frozen,
locked,
cache: cache2,
pixiBinPath,
pixiRunShell,
auth,
postCleanup
};
};
var assertOptions = (_options2) => {
};
var getOptions = () => {
const inputs = {
pixiVersion: parseOrUndefined(
"pixi-version",
unionType([literalType("latest"), stringType().regex(/^v\d+\.\d+\.\d+$/)]),
"pixi-version must either be `latest` or a version string matching `vX.Y.Z`."
),
pixiUrl: parseOrUndefined("pixi-url", stringType().url()),
logLevel: parseOrUndefined(
"log-level",
logLevelSchema,
"log-level must be one of `q`, `default`, `v`, `vv`, `vvv`."
),
manifestPath: parseOrUndefined("manifest-path", stringType()),
runInstall: parseOrUndefinedJSON("run-install", booleanType()),
locked: parseOrUndefinedJSON("locked", booleanType()),
frozen: parseOrUndefinedJSON("frozen", booleanType()),
cache: parseOrUndefinedJSON("cache", booleanType()),
cacheKey: parseOrUndefined("cache-key", stringType()),
cacheWrite: parseOrUndefinedJSON("cache-write", booleanType()),
pixiBinPath: parseOrUndefined("pixi-bin-path", stringType()),
authHost: parseOrUndefined("auth-host", stringType()),
authToken: parseOrUndefined("auth-token", stringType()),
authUsername: parseOrUndefined("auth-username", stringType()),
authPassword: parseOrUndefined("auth-password", stringType()),
authCondaToken: parseOrUndefined("auth-conda-token", stringType()),
postCleanup: parseOrUndefinedJSON("post-cleanup", booleanType())
};
core.debug(`Inputs: ${JSON.stringify(inputs)}`);
validateInputs(inputs);
const options2 = inferOptions(inputs);
core.debug(`Inferred options: ${JSON.stringify(options2)}`);
assertOptions(options2);
return options2;
};
var _options;
try {
_options = getOptions();
} catch (error2) {
if (core.isDebug()) {
throw error2;
}
if (error2 instanceof Error) {
core.setFailed(error2.message);
(0, import_process.exit)(1);
} else if (typeof error2 === "string") {
core.setFailed(error2);
(0, import_process.exit)(1);
}
throw error2;
}
var options = _options;
// src/util.ts
var import_crypto4 = require("crypto");
var os = __toESM(require("os"));
var core = __toESM(require_core());
var os3 = __toESM(require("os"));
var core2 = __toESM(require_core());
var import_exec = __toESM(require_exec());
var getCondaArch = () => {
const archDict = {
@@ -60964,14 +61137,14 @@ var getCondaArch = () => {
"linux-ppc64": "linux-ppc64le",
"win32-x64": "win-64"
};
const arch3 = archDict[`${os.platform()}-${os.arch()}`];
const arch3 = archDict[`${os3.platform()}-${os3.arch()}`];
if (!arch3) {
throw new Error(`Unsupported platform: ${os.platform()}-${os.arch()}`);
throw new Error(`Unsupported platform: ${os3.platform()}-${os3.arch()}`);
}
return arch3;
};
var getPlatform = () => {
const platform2 = os.platform();
const platform2 = os3.platform();
switch (platform2) {
case "darwin":
return "apple-darwin";
@@ -60984,7 +61157,7 @@ var getPlatform = () => {
}
};
var getArch = () => {
const arch3 = os.arch();
const arch3 = os3.arch();
switch (arch3) {
case "x64":
return "x86_64";
@@ -61010,7 +61183,7 @@ var sha256 = (s) => {
return (0, import_crypto4.createHash)("sha256").update(s).digest("hex");
};
var execute = (cmd) => {
core.debug(`Executing: ${cmd.join(" ")}`);
core2.debug(`Executing: ${cmd.join(" ")}`);
return (0, import_exec.exec)(cmd[0], cmd.slice(1));
};
var pixiCmd = (command, withManifestPath = true) => {
@@ -61019,156 +61192,49 @@ var pixiCmd = (command, withManifestPath = true) => {
commandArray = commandArray.concat(["--manifest-path", options.manifestPath]);
}
switch (options.logLevel) {
case "trace":
case "vvv":
commandArray = commandArray.concat(["-vvv"]);
break;
case "debug":
case "vv":
commandArray = commandArray.concat(["-vv"]);
break;
case "info":
case "v":
commandArray = commandArray.concat(["-v"]);
break;
case "warn":
case "default":
break;
case "quiet":
case "q":
commandArray = commandArray.concat(["-q"]);
break;
}
return commandArray;
};
// src/options.ts
var logLevelSchema = enumType(["quiet", "warn", "info", "debug", "trace"]);
var postCleanupSchema = enumType(["none", "environment", "all"]);
var PATHS = {
pixiBin: import_path.default.join(import_os.default.homedir(), ".pixi", "bin", `pixi${import_os.default.platform() === "win32" ? ".exe" : ""}`),
pixiRunShellScript: import_path.default.join(import_os.default.homedir(), ".pixi", "bin", "pixi-shell"),
bashProfile: import_path.default.join(import_os.default.homedir(), ".bash_profile"),
bashrc: import_path.default.join(import_os.default.homedir(), ".bashrc")
};
var parseOrUndefined = (key, schema) => {
const input = core2.getInput(key);
if (input === "") {
return void 0;
}
return schema.parse(input);
};
var parseOrUndefinedJSON = (key, schema) => {
const input = core2.getInput(key);
if (input === "") {
return void 0;
}
return schema.parse(JSON.parse(input));
};
var validateInputs = (inputs) => {
if (inputs.pixiVersion && inputs.pixiUrl) {
throw new Error("You need to specify either pixi-version or pixi-url");
}
if (inputs.cacheKey !== void 0 && inputs.cache === false) {
throw new Error("Cannot specify cache key without caching");
}
if (inputs.runInstall === false && inputs.cache === true) {
throw new Error("Cannot cache without running install");
}
if (inputs.authUsername && !inputs.authPassword || !inputs.authUsername && inputs.authPassword) {
throw new Error("You need to specify both auth-username and auth-password");
}
if (inputs.authHost) {
if (!inputs.authToken && !inputs.authUsername && !inputs.authCondaToken) {
throw new Error("You need to specify either auth-token or auth-username and auth-password or auth-conda-token");
}
if (inputs.authToken && (inputs.authUsername || inputs.authCondaToken) || inputs.authUsername && inputs.authCondaToken) {
throw new Error("You cannot specify two auth methods");
}
}
if (!inputs.authHost) {
if (inputs.authToken || inputs.authUsername || inputs.authCondaToken) {
throw new Error("You need to specify auth-host");
}
}
};
var inferOptions = (inputs) => {
const runInstall = inputs.runInstall ?? true;
const pixiSource = inputs.pixiVersion ? { version: inputs.pixiVersion } : inputs.pixiUrl ? { url: inputs.pixiUrl } : { version: "latest" };
const logLevel = inputs.logLevel ?? (core2.isDebug() ? "debug" : "warn");
const manifestPath = inputs.manifestPath ?? "pixi.toml";
const pixiLockFile = import_path.default.basename(manifestPath).replace(/\.toml$/, ".lock");
const generateRunShell = inputs.generateRunShell ?? runInstall;
const cacheKey = inputs.cacheKey ?? (inputs.cache ? `pixi-${getCondaArch()}` : void 0);
const pixiBinPath = inputs.pixiBinPath ?? PATHS.pixiBin;
const auth = inputs.authHost ? {
host: inputs.authHost,
token: inputs.authToken,
username: inputs.authUsername,
password: inputs.authPassword,
condaToken: inputs.authCondaToken
} : void 0;
const postCleanup = inputs.postCleanup ?? "all";
return {
pixiSource,
logLevel,
manifestPath,
pixiLockFile,
runInstall,
generateRunShell,
cacheKey,
pixiBinPath,
auth,
postCleanup
};
};
var assertOptions = (_options) => {
};
var getOptions = () => {
const inputs = {
pixiVersion: parseOrUndefined("pixi-version", unionType([literalType("latest"), stringType().regex(/^v\d+\.\d+\.\d+$/)])),
pixiUrl: parseOrUndefined("pixi-url", stringType().url()),
logLevel: parseOrUndefined("log-level", logLevelSchema),
manifestPath: parseOrUndefined("manifest-path", stringType()),
runInstall: parseOrUndefinedJSON("run-install", booleanType()),
generateRunShell: parseOrUndefinedJSON("generate-run-shell", booleanType()),
cache: parseOrUndefinedJSON("cache", booleanType()),
cacheKey: parseOrUndefined("cache-key", stringType()),
pixiBinPath: parseOrUndefined("micromamba-binary-path", stringType()),
authHost: parseOrUndefined("auth-host", stringType()),
authToken: parseOrUndefined("auth-token", stringType()),
authUsername: parseOrUndefined("auth-username", stringType()),
authPassword: parseOrUndefined("auth-password", stringType()),
authCondaToken: parseOrUndefined("auth-conda-token", stringType()),
postCleanup: parseOrUndefined("post-cleanup", postCleanupSchema)
};
core2.debug(`Inputs: ${JSON.stringify(inputs)}`);
validateInputs(inputs);
const options2 = inferOptions(inputs);
core2.debug(`Inferred options: ${JSON.stringify(options2)}`);
assertOptions(options2);
return options2;
};
var options = getOptions();
// src/cache.ts
var import_promises = __toESM(require("fs/promises"));
var import_path2 = __toESM(require("path"));
var core3 = __toESM(require_core());
var cache = __toESM(require_cache());
var generateCacheKey = async (cacheKeyPrefix) => import_promises.default.readFile(options.pixiLockFile, "utf-8").then((content) => `${cacheKeyPrefix}${sha256(content)}`).catch((err) => {
var generateCacheKey = async (cacheKeyPrefix) => import_promises.default.readFile(options.pixiLockFile, "utf-8").then((content) => `${cacheKeyPrefix}${getCondaArch()}-${sha256(content)}`).catch((err) => {
throw new Error(`Failed to generate cache key: ${err}`);
});
var cachePath = import_path2.default.join(import_path2.default.basename(options.manifestPath), ".pixi");
var cachePath = import_path2.default.join(import_path2.default.dirname(options.pixiLockFile), ".pixi");
var cacheHit = false;
var tryRestoreCache = () => {
const cacheKeyPrefix = options.cacheKey;
if (!cacheKeyPrefix) {
const cache_ = options.cache;
if (!cache_) {
core3.debug("Skipping pixi cache restore.");
return Promise.resolve(void 0);
}
return core3.group(
"Restoring pixi cache",
() => generateCacheKey(cacheKeyPrefix).then((cacheKey) => {
() => generateCacheKey(cache_.cacheKeyPrefix).then((cacheKey) => {
core3.debug(`Cache key: ${cacheKey}`);
core3.debug(`Cache path: ${cachePath}`);
return cache.restoreCache([cachePath], cacheKey, void 0, void 0, false).then((key) => {
if (key) {
core3.info(`Restored cache with key \`${key}\``);
cacheHit = true;
} else {
core3.info(`Cache miss`);
}
@@ -61178,14 +61244,18 @@ var tryRestoreCache = () => {
);
};
var saveCache2 = () => {
const cacheKeyPrefix = options.cacheKey;
if (!cacheKeyPrefix) {
const cache_ = options.cache;
if (!cache_ || !cache_.cacheWrite) {
core3.debug("Skipping pixi cache save.");
return Promise.resolve(void 0);
}
if (cacheHit) {
core3.debug("Skipping pixi cache save because cache was restored.");
return Promise.resolve(void 0);
}
return core3.group(
"Saving pixi cache",
() => generateCacheKey(cacheKeyPrefix).then(
() => generateCacheKey(cache_.cacheKeyPrefix).then(
(cacheKey) => cache.saveCache([cachePath], cacheKey, void 0, false).then((cacheId) => {
core3.info(`Saved cache with ID \`${cacheId}\``);
}).catch((err) => {
@@ -61210,6 +61280,7 @@ var pixiLogin = () => {
core4.debug("Skipping pixi login.");
return Promise.resolve(0);
}
core4.debug(`auth keys: ${Object.keys(auth)}`);
return core4.group("Logging in to private channel", () => {
if ("token" in auth) {
core4.debug(`Logging in to ${auth.host} with token`);
@@ -61231,42 +61302,33 @@ var pixiInstall = async () => {
core4.debug("Skipping pixi install.");
return Promise.resolve();
}
return tryRestoreCache().then((_cacheKey) => execute(pixiCmd("install"))).then(saveCache2);
};
var generatePixiRunShell = () => {
if (!options.generateRunShell) {
core4.debug("Skipping pixi run shell generation.");
return Promise.resolve();
}
if (import_os3.default.platform() === "win32") {
core4.info("Skipping pixi run shell on Windows.");
return Promise.resolve();
}
core4.info("Generating pixi run shell.");
const pixiRunShellContents = `#!/usr/bin/env sh
chmod +x $1
pixi run $1
`;
return core4.group("Generating pixi run shell", () => {
core4.debug(`Writing pixi run shell to ${PATHS.pixiRunShellScript}`);
core4.debug(`File contents:
"${pixiRunShellContents}"`);
return import_promises2.default.writeFile(PATHS.pixiRunShellScript, pixiRunShellContents, { encoding: "utf8", mode: 493 });
});
return tryRestoreCache().then(
(_cacheKey) => execute(pixiCmd(`install${options.frozen ? " --frozen" : ""}${options.locked ? " --locked" : ""}`))
).then(saveCache2);
};
var generateInfo = () => core4.group("pixi info", () => execute(pixiCmd("info")));
var run = async () => {
core4.debug(`process.env.HOME: ${process.env.HOME}`);
core4.debug(`os.homedir(): ${import_os3.default.homedir()}`);
core4.debug(`bashProfile ${PATHS.bashProfile}`);
await downloadPixi(options.pixiSource);
addPixiToPath();
await pixiLogin();
await pixiInstall();
await generatePixiRunShell();
await generateInfo();
};
run().catch((error2) => core4.setFailed(error2.message));
run().catch((error2) => {
if (core4.isDebug()) {
throw error2;
}
if (error2 instanceof Error) {
core4.setFailed(error2.message);
(0, import_process2.exit)(1);
} else if (typeof error2 === "string") {
core4.setFailed(error2);
(0, import_process2.exit)(1);
}
throw error2;
});
/*! Bundled license information:
mime-db/index.js:
Generated Vendored
+6059 -1
View File
File diff suppressed because it is too large Load Diff
+9 -8
View File
@@ -1,12 +1,13 @@
{
"name": "setup-pixi",
"version": "0.1.1",
"version": "0.3.0",
"private": true,
"description": "Action to set up the pixi package manager.",
"scripts": {
"build": "tsup",
"dev": "tsup --watch",
"lint": "eslint ./src --ext ts"
"lint": "eslint ./src --ext ts",
"lint:fix": "eslint ./src --ext ts --fix"
},
"repository": {
"type": "git",
@@ -21,7 +22,7 @@
"license": "BSD-3-Clause",
"dependencies": {
"@actions/cache": "^3.2.2",
"@actions/core": "^1.10.0",
"@actions/core": "^1.10.1",
"@actions/exec": "^1.1.1",
"@actions/io": "^1.1.3",
"@actions/tool-cache": "^2.0.1",
@@ -29,14 +30,14 @@
"zod": "^3.22.2"
},
"devDependencies": {
"@types/node": "^20.5.9",
"@typescript-eslint/eslint-plugin": "^6.5.0",
"@typescript-eslint/parser": "^6.5.0",
"eslint": "^8.48.0",
"@types/node": "^20.8.2",
"@typescript-eslint/eslint-plugin": "^6.7.3",
"@typescript-eslint/parser": "^6.7.3",
"eslint": "^8.50.0",
"eslint-config-prettier": "^9.0.0",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-n": "^16.0.2",
"eslint-plugin-n": "^16.1.0",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-promise": "^6.1.1",
"prettier": "^3.0.3",
+140 -124
View File
@@ -9,8 +9,8 @@ dependencies:
specifier: ^3.2.2
version: 3.2.2
'@actions/core':
specifier: ^1.10.0
version: 1.10.0
specifier: ^1.10.1
version: 1.10.1
'@actions/exec':
specifier: ^1.1.1
version: 1.1.1
@@ -29,35 +29,35 @@ dependencies:
devDependencies:
'@types/node':
specifier: ^20.5.9
version: 20.5.9
specifier: ^20.8.2
version: 20.8.2
'@typescript-eslint/eslint-plugin':
specifier: ^6.5.0
version: 6.5.0(@typescript-eslint/parser@6.5.0)(eslint@8.48.0)(typescript@5.2.2)
specifier: ^6.7.3
version: 6.7.3(@typescript-eslint/parser@6.7.3)(eslint@8.50.0)(typescript@5.2.2)
'@typescript-eslint/parser':
specifier: ^6.5.0
version: 6.5.0(eslint@8.48.0)(typescript@5.2.2)
specifier: ^6.7.3
version: 6.7.3(eslint@8.50.0)(typescript@5.2.2)
eslint:
specifier: ^8.48.0
version: 8.48.0
specifier: ^8.50.0
version: 8.50.0
eslint-config-prettier:
specifier: ^9.0.0
version: 9.0.0(eslint@8.48.0)
version: 9.0.0(eslint@8.50.0)
eslint-config-standard:
specifier: ^17.1.0
version: 17.1.0(eslint-plugin-import@2.28.1)(eslint-plugin-n@16.0.2)(eslint-plugin-promise@6.1.1)(eslint@8.48.0)
version: 17.1.0(eslint-plugin-import@2.28.1)(eslint-plugin-n@16.1.0)(eslint-plugin-promise@6.1.1)(eslint@8.50.0)
eslint-plugin-import:
specifier: ^2.28.1
version: 2.28.1(@typescript-eslint/parser@6.5.0)(eslint@8.48.0)
version: 2.28.1(@typescript-eslint/parser@6.7.3)(eslint@8.50.0)
eslint-plugin-n:
specifier: ^16.0.2
version: 16.0.2(eslint@8.48.0)
specifier: ^16.1.0
version: 16.1.0(eslint@8.50.0)
eslint-plugin-prettier:
specifier: ^5.0.0
version: 5.0.0(eslint-config-prettier@9.0.0)(eslint@8.48.0)(prettier@3.0.3)
version: 5.0.0(eslint-config-prettier@9.0.0)(eslint@8.50.0)(prettier@3.0.3)
eslint-plugin-promise:
specifier: ^6.1.1
version: 6.1.1(eslint@8.48.0)
version: 6.1.1(eslint@8.50.0)
prettier:
specifier: ^3.0.3
version: 3.0.3
@@ -78,7 +78,7 @@ packages:
/@actions/cache@3.2.2:
resolution: {integrity: sha512-6D0Jq5JrLZRQ3VApeQwQkkV20ZZXjXsHNYXd9VjNUdi9E0h93wESpxfMJ2JWLCUCgHNLcfY0v3GjNM+2FdRMlg==}
dependencies:
'@actions/core': 1.10.0
'@actions/core': 1.10.1
'@actions/exec': 1.1.1
'@actions/glob': 0.1.2
'@actions/http-client': 2.1.1
@@ -92,8 +92,8 @@ packages:
- encoding
dev: false
/@actions/core@1.10.0:
resolution: {integrity: sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug==}
/@actions/core@1.10.1:
resolution: {integrity: sha512-3lBR9EDAY+iYIpTnTIXmWcNbX3T2kCkAEQGIQx4NVQ0575nk2k3GRZDTPQG+vVtS2izSLmINlxXf0uLtnrTP+g==}
dependencies:
'@actions/http-client': 2.1.1
uuid: 8.3.2
@@ -108,7 +108,7 @@ packages:
/@actions/glob@0.1.2:
resolution: {integrity: sha512-SclLR7Ia5sEqjkJTPs7Sd86maMDw43p769YxBOxvPvEWuPEhpAnBsQfENOpXjFYMmhCqd127bmf+YdvJqVqR4A==}
dependencies:
'@actions/core': 1.10.0
'@actions/core': 1.10.1
minimatch: 3.1.2
dev: false
@@ -125,7 +125,7 @@ packages:
/@actions/tool-cache@2.0.1:
resolution: {integrity: sha512-iPU+mNwrbA8jodY8eyo/0S/QqCKDajiR8OxWTnSk/SnYg0sj8Hp4QcUEVC1YFpHWXtrfbQrE13Jz4k4HXJQKcA==}
dependencies:
'@actions/core': 1.10.0
'@actions/core': 1.10.1
'@actions/exec': 1.1.1
'@actions/http-client': 2.1.1
'@actions/io': 1.1.3
@@ -440,18 +440,23 @@ packages:
dev: true
optional: true
/@eslint-community/eslint-utils@4.4.0(eslint@8.48.0):
/@eslint-community/eslint-utils@4.4.0(eslint@8.50.0):
resolution: {integrity: sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies:
eslint: ^6.0.0 || ^7.0.0 || >=8.0.0
dependencies:
eslint: 8.48.0
eslint: 8.50.0
eslint-visitor-keys: 3.4.3
dev: true
/@eslint-community/regexpp@4.8.0:
resolution: {integrity: sha512-JylOEEzDiOryeUnFbQz+oViCXS0KsvR1mvHkoMiu5+UiBvy+RYX7tzlIIIEstF/gVa2tj9AQXk3dgnxv6KxhFg==}
/@eslint-community/regexpp@4.8.1:
resolution: {integrity: sha512-PWiOzLIUAjN/w5K17PoF4n6sKBw0gqLHPhywmYHP4t1VFQQVYeb1yWsJwnMVEMl3tUHME7X/SJPZLmtG7XBDxQ==}
engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0}
dev: true
/@eslint-community/regexpp@4.9.0:
resolution: {integrity: sha512-zJmuCWj2VLBt4c25CfBIbMZLGLyhkvs7LznyVX5HfpzeocThgIj5XQK4L+g3U36mMcx8bPMhGyPpwCATamC4jQ==}
engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0}
dev: true
@@ -462,7 +467,7 @@ packages:
ajv: 6.12.6
debug: 4.3.4
espree: 9.6.1
globals: 13.21.0
globals: 13.22.0
ignore: 5.2.4
import-fresh: 3.3.0
js-yaml: 4.1.0
@@ -472,8 +477,8 @@ packages:
- supports-color
dev: true
/@eslint/js@8.48.0:
resolution: {integrity: sha512-ZSjtmelB7IJfWD2Fvb7+Z+ChTIKWq6kjda95fLcQKNS5aheVHn4IkfgRQE3sIIzTcSLwLcLZUD9UBt+V7+h+Pw==}
/@eslint/js@8.50.0:
resolution: {integrity: sha512-NCC3zz2+nvYd+Ckfh87rA47zfu2QsQpvc6k1yzTk+b9KzRj0wkGa8LSoGOXN6Zv4lRf/EIoZ80biDh9HOI+RNQ==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
dev: true
@@ -565,8 +570,8 @@ packages:
tslib: 2.6.2
dev: true
/@types/json-schema@7.0.12:
resolution: {integrity: sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA==}
/@types/json-schema@7.0.13:
resolution: {integrity: sha512-RbSSoHliUbnXj3ny0CNFOoxrIDV6SUGyStHsvDqosw6CkdPV8TtWGlfecuK4ToyMEAql6pzNxgCFKanovUzlgQ==}
dev: true
/@types/json5@0.0.29:
@@ -576,25 +581,25 @@ packages:
/@types/node-fetch@2.6.4:
resolution: {integrity: sha512-1ZX9fcN4Rvkvgv4E6PAY5WXUFWFcRWxZa3EW83UjycOB9ljJCedb2CupIP4RZMEwF/M3eTcCihbBRgwtGbg5Rg==}
dependencies:
'@types/node': 20.5.9
'@types/node': 20.8.2
form-data: 3.0.1
dev: false
/@types/node@20.5.9:
resolution: {integrity: sha512-PcGNd//40kHAS3sTlzKB9C9XL4K0sTup8nbG5lC14kzEteTNuAFh9u5nA0o5TWnSG2r/JNPRXFVcHJIIeRlmqQ==}
/@types/node@20.8.2:
resolution: {integrity: sha512-Vvycsc9FQdwhxE3y3DzeIxuEJbWGDsnrxvMADzTDF/lcdR9/K+AQIeAghTQsHtotg/q0j3WEOYS/jQgSdWue3w==}
/@types/semver@7.5.1:
resolution: {integrity: sha512-cJRQXpObxfNKkFAZbJl2yjWtJCqELQIdShsogr1d2MilP8dKD9TE/nEKHkJgUNHdGKCQaf9HbIynuV2csLGVLg==}
/@types/semver@7.5.3:
resolution: {integrity: sha512-OxepLK9EuNEIPxWNME+C6WwbRAOOI2o2BaQEGzz5Lu2e4Z5eDnEo+/aVEDMIXywoJitJ7xWd641wrGLZdtwRyw==}
dev: true
/@types/tunnel@0.0.3:
resolution: {integrity: sha512-sOUTGn6h1SfQ+gbgqC364jLFBw2lnFqkgF3q0WovEHRLMrVD1sd5aufqi/aJObLekJO+Aq5z646U4Oxy6shXMA==}
dependencies:
'@types/node': 20.5.9
'@types/node': 20.8.2
dev: false
/@typescript-eslint/eslint-plugin@6.5.0(@typescript-eslint/parser@6.5.0)(eslint@8.48.0)(typescript@5.2.2):
resolution: {integrity: sha512-2pktILyjvMaScU6iK3925uvGU87E+N9rh372uGZgiMYwafaw9SXq86U04XPq3UH6tzRvNgBsub6x2DacHc33lw==}
/@typescript-eslint/eslint-plugin@6.7.3(@typescript-eslint/parser@6.7.3)(eslint@8.50.0)(typescript@5.2.2):
resolution: {integrity: sha512-vntq452UHNltxsaaN+L9WyuMch8bMd9CqJ3zhzTPXXidwbf5mqqKCVXEuvRZUqLJSTLeWE65lQwyXsRGnXkCTA==}
engines: {node: ^16.0.0 || >=18.0.0}
peerDependencies:
'@typescript-eslint/parser': ^6.0.0 || ^6.0.0-alpha
@@ -604,26 +609,26 @@ packages:
typescript:
optional: true
dependencies:
'@eslint-community/regexpp': 4.8.0
'@typescript-eslint/parser': 6.5.0(eslint@8.48.0)(typescript@5.2.2)
'@typescript-eslint/scope-manager': 6.5.0
'@typescript-eslint/type-utils': 6.5.0(eslint@8.48.0)(typescript@5.2.2)
'@typescript-eslint/utils': 6.5.0(eslint@8.48.0)(typescript@5.2.2)
'@typescript-eslint/visitor-keys': 6.5.0
'@eslint-community/regexpp': 4.9.0
'@typescript-eslint/parser': 6.7.3(eslint@8.50.0)(typescript@5.2.2)
'@typescript-eslint/scope-manager': 6.7.3
'@typescript-eslint/type-utils': 6.7.3(eslint@8.50.0)(typescript@5.2.2)
'@typescript-eslint/utils': 6.7.3(eslint@8.50.0)(typescript@5.2.2)
'@typescript-eslint/visitor-keys': 6.7.3
debug: 4.3.4
eslint: 8.48.0
eslint: 8.50.0
graphemer: 1.4.0
ignore: 5.2.4
natural-compare: 1.4.0
semver: 7.5.4
ts-api-utils: 1.0.2(typescript@5.2.2)
ts-api-utils: 1.0.3(typescript@5.2.2)
typescript: 5.2.2
transitivePeerDependencies:
- supports-color
dev: true
/@typescript-eslint/parser@6.5.0(eslint@8.48.0)(typescript@5.2.2):
resolution: {integrity: sha512-LMAVtR5GN8nY0G0BadkG0XIe4AcNMeyEy3DyhKGAh9k4pLSMBO7rF29JvDBpZGCmp5Pgz5RLHP6eCpSYZJQDuQ==}
/@typescript-eslint/parser@6.7.3(eslint@8.50.0)(typescript@5.2.2):
resolution: {integrity: sha512-TlutE+iep2o7R8Lf+yoer3zU6/0EAUc8QIBB3GYBc1KGz4c4TRm83xwXUZVPlZ6YCLss4r77jbu6j3sendJoiQ==}
engines: {node: ^16.0.0 || >=18.0.0}
peerDependencies:
eslint: ^7.0.0 || ^8.0.0
@@ -632,27 +637,27 @@ packages:
typescript:
optional: true
dependencies:
'@typescript-eslint/scope-manager': 6.5.0
'@typescript-eslint/types': 6.5.0
'@typescript-eslint/typescript-estree': 6.5.0(typescript@5.2.2)
'@typescript-eslint/visitor-keys': 6.5.0
'@typescript-eslint/scope-manager': 6.7.3
'@typescript-eslint/types': 6.7.3
'@typescript-eslint/typescript-estree': 6.7.3(typescript@5.2.2)
'@typescript-eslint/visitor-keys': 6.7.3
debug: 4.3.4
eslint: 8.48.0
eslint: 8.50.0
typescript: 5.2.2
transitivePeerDependencies:
- supports-color
dev: true
/@typescript-eslint/scope-manager@6.5.0:
resolution: {integrity: sha512-A8hZ7OlxURricpycp5kdPTH3XnjG85UpJS6Fn4VzeoH4T388gQJ/PGP4ole5NfKt4WDVhmLaQ/dBLNDC4Xl/Kw==}
/@typescript-eslint/scope-manager@6.7.3:
resolution: {integrity: sha512-wOlo0QnEou9cHO2TdkJmzF7DFGvAKEnB82PuPNHpT8ZKKaZu6Bm63ugOTn9fXNJtvuDPanBc78lGUGGytJoVzQ==}
engines: {node: ^16.0.0 || >=18.0.0}
dependencies:
'@typescript-eslint/types': 6.5.0
'@typescript-eslint/visitor-keys': 6.5.0
'@typescript-eslint/types': 6.7.3
'@typescript-eslint/visitor-keys': 6.7.3
dev: true
/@typescript-eslint/type-utils@6.5.0(eslint@8.48.0)(typescript@5.2.2):
resolution: {integrity: sha512-f7OcZOkRivtujIBQ4yrJNIuwyCQO1OjocVqntl9dgSIZAdKqicj3xFDqDOzHDlGCZX990LqhLQXWRnQvsapq8A==}
/@typescript-eslint/type-utils@6.7.3(eslint@8.50.0)(typescript@5.2.2):
resolution: {integrity: sha512-Fc68K0aTDrKIBvLnKTZ5Pf3MXK495YErrbHb1R6aTpfK5OdSFj0rVN7ib6Tx6ePrZ2gsjLqr0s98NG7l96KSQw==}
engines: {node: ^16.0.0 || >=18.0.0}
peerDependencies:
eslint: ^7.0.0 || ^8.0.0
@@ -661,23 +666,23 @@ packages:
typescript:
optional: true
dependencies:
'@typescript-eslint/typescript-estree': 6.5.0(typescript@5.2.2)
'@typescript-eslint/utils': 6.5.0(eslint@8.48.0)(typescript@5.2.2)
'@typescript-eslint/typescript-estree': 6.7.3(typescript@5.2.2)
'@typescript-eslint/utils': 6.7.3(eslint@8.50.0)(typescript@5.2.2)
debug: 4.3.4
eslint: 8.48.0
ts-api-utils: 1.0.2(typescript@5.2.2)
eslint: 8.50.0
ts-api-utils: 1.0.3(typescript@5.2.2)
typescript: 5.2.2
transitivePeerDependencies:
- supports-color
dev: true
/@typescript-eslint/types@6.5.0:
resolution: {integrity: sha512-eqLLOEF5/lU8jW3Bw+8auf4lZSbbljHR2saKnYqON12G/WsJrGeeDHWuQePoEf9ro22+JkbPfWQwKEC5WwLQ3w==}
/@typescript-eslint/types@6.7.3:
resolution: {integrity: sha512-4g+de6roB2NFcfkZb439tigpAMnvEIg3rIjWQ+EM7IBaYt/CdJt6em9BJ4h4UpdgaBWdmx2iWsafHTrqmgIPNw==}
engines: {node: ^16.0.0 || >=18.0.0}
dev: true
/@typescript-eslint/typescript-estree@6.5.0(typescript@5.2.2):
resolution: {integrity: sha512-q0rGwSe9e5Kk/XzliB9h2LBc9tmXX25G0833r7kffbl5437FPWb2tbpIV9wAATebC/018pGa9fwPDuvGN+LxWQ==}
/@typescript-eslint/typescript-estree@6.7.3(typescript@5.2.2):
resolution: {integrity: sha512-YLQ3tJoS4VxLFYHTw21oe1/vIZPRqAO91z6Uv0Ss2BKm/Ag7/RVQBcXTGcXhgJMdA4U+HrKuY5gWlJlvoaKZ5g==}
engines: {node: ^16.0.0 || >=18.0.0}
peerDependencies:
typescript: '*'
@@ -685,42 +690,42 @@ packages:
typescript:
optional: true
dependencies:
'@typescript-eslint/types': 6.5.0
'@typescript-eslint/visitor-keys': 6.5.0
'@typescript-eslint/types': 6.7.3
'@typescript-eslint/visitor-keys': 6.7.3
debug: 4.3.4
globby: 11.1.0
is-glob: 4.0.3
semver: 7.5.4
ts-api-utils: 1.0.2(typescript@5.2.2)
ts-api-utils: 1.0.3(typescript@5.2.2)
typescript: 5.2.2
transitivePeerDependencies:
- supports-color
dev: true
/@typescript-eslint/utils@6.5.0(eslint@8.48.0)(typescript@5.2.2):
resolution: {integrity: sha512-9nqtjkNykFzeVtt9Pj6lyR9WEdd8npPhhIPM992FWVkZuS6tmxHfGVnlUcjpUP2hv8r4w35nT33mlxd+Be1ACQ==}
/@typescript-eslint/utils@6.7.3(eslint@8.50.0)(typescript@5.2.2):
resolution: {integrity: sha512-vzLkVder21GpWRrmSR9JxGZ5+ibIUSudXlW52qeKpzUEQhRSmyZiVDDj3crAth7+5tmN1ulvgKaCU2f/bPRCzg==}
engines: {node: ^16.0.0 || >=18.0.0}
peerDependencies:
eslint: ^7.0.0 || ^8.0.0
dependencies:
'@eslint-community/eslint-utils': 4.4.0(eslint@8.48.0)
'@types/json-schema': 7.0.12
'@types/semver': 7.5.1
'@typescript-eslint/scope-manager': 6.5.0
'@typescript-eslint/types': 6.5.0
'@typescript-eslint/typescript-estree': 6.5.0(typescript@5.2.2)
eslint: 8.48.0
'@eslint-community/eslint-utils': 4.4.0(eslint@8.50.0)
'@types/json-schema': 7.0.13
'@types/semver': 7.5.3
'@typescript-eslint/scope-manager': 6.7.3
'@typescript-eslint/types': 6.7.3
'@typescript-eslint/typescript-estree': 6.7.3(typescript@5.2.2)
eslint: 8.50.0
semver: 7.5.4
transitivePeerDependencies:
- supports-color
- typescript
dev: true
/@typescript-eslint/visitor-keys@6.5.0:
resolution: {integrity: sha512-yCB/2wkbv3hPsh02ZS8dFQnij9VVQXJMN/gbQsaaY+zxALkZnxa/wagvLEFsAWMPv7d7lxQmNsIzGU1w/T/WyA==}
/@typescript-eslint/visitor-keys@6.7.3:
resolution: {integrity: sha512-HEVXkU9IB+nk9o63CeICMHxFWbHWr3E1mpilIQBe9+7L/lH97rleFLVtYsfnWB+JVMaiFnEaxvknvmIzX+CqVg==}
engines: {node: ^16.0.0 || >=18.0.0}
dependencies:
'@typescript-eslint/types': 6.5.0
'@typescript-eslint/types': 6.7.3
eslint-visitor-keys: 3.4.3
dev: true
@@ -1176,16 +1181,16 @@ packages:
engines: {node: '>=10'}
dev: true
/eslint-config-prettier@9.0.0(eslint@8.48.0):
/eslint-config-prettier@9.0.0(eslint@8.50.0):
resolution: {integrity: sha512-IcJsTkJae2S35pRsRAwoCE+925rJJStOdkKnLVgtE+tEpqU0EVVM7OqrwxqgptKdX29NUwC82I5pXsGFIgSevw==}
hasBin: true
peerDependencies:
eslint: '>=7.0.0'
dependencies:
eslint: 8.48.0
eslint: 8.50.0
dev: true
/eslint-config-standard@17.1.0(eslint-plugin-import@2.28.1)(eslint-plugin-n@16.0.2)(eslint-plugin-promise@6.1.1)(eslint@8.48.0):
/eslint-config-standard@17.1.0(eslint-plugin-import@2.28.1)(eslint-plugin-n@16.1.0)(eslint-plugin-promise@6.1.1)(eslint@8.50.0):
resolution: {integrity: sha512-IwHwmaBNtDK4zDHQukFDW5u/aTb8+meQWZvNFWkiGmbWjD6bqyuSSBxxXKkCftCUzc1zwCH2m/baCNDLGmuO5Q==}
engines: {node: '>=12.0.0'}
peerDependencies:
@@ -1194,10 +1199,10 @@ packages:
eslint-plugin-n: '^15.0.0 || ^16.0.0 '
eslint-plugin-promise: ^6.0.0
dependencies:
eslint: 8.48.0
eslint-plugin-import: 2.28.1(@typescript-eslint/parser@6.5.0)(eslint@8.48.0)
eslint-plugin-n: 16.0.2(eslint@8.48.0)
eslint-plugin-promise: 6.1.1(eslint@8.48.0)
eslint: 8.50.0
eslint-plugin-import: 2.28.1(@typescript-eslint/parser@6.7.3)(eslint@8.50.0)
eslint-plugin-n: 16.1.0(eslint@8.50.0)
eslint-plugin-promise: 6.1.1(eslint@8.50.0)
dev: true
/eslint-import-resolver-node@0.3.9:
@@ -1210,7 +1215,7 @@ packages:
- supports-color
dev: true
/eslint-module-utils@2.8.0(@typescript-eslint/parser@6.5.0)(eslint-import-resolver-node@0.3.9)(eslint@8.48.0):
/eslint-module-utils@2.8.0(@typescript-eslint/parser@6.7.3)(eslint-import-resolver-node@0.3.9)(eslint@8.50.0):
resolution: {integrity: sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==}
engines: {node: '>=4'}
peerDependencies:
@@ -1231,26 +1236,26 @@ packages:
eslint-import-resolver-webpack:
optional: true
dependencies:
'@typescript-eslint/parser': 6.5.0(eslint@8.48.0)(typescript@5.2.2)
'@typescript-eslint/parser': 6.7.3(eslint@8.50.0)(typescript@5.2.2)
debug: 3.2.7
eslint: 8.48.0
eslint: 8.50.0
eslint-import-resolver-node: 0.3.9
transitivePeerDependencies:
- supports-color
dev: true
/eslint-plugin-es-x@7.2.0(eslint@8.48.0):
/eslint-plugin-es-x@7.2.0(eslint@8.50.0):
resolution: {integrity: sha512-9dvv5CcvNjSJPqnS5uZkqb3xmbeqRLnvXKK7iI5+oK/yTusyc46zbBZKENGsOfojm/mKfszyZb+wNqNPAPeGXA==}
engines: {node: ^14.18.0 || >=16.0.0}
peerDependencies:
eslint: '>=8'
dependencies:
'@eslint-community/eslint-utils': 4.4.0(eslint@8.48.0)
'@eslint-community/regexpp': 4.8.0
eslint: 8.48.0
'@eslint-community/eslint-utils': 4.4.0(eslint@8.50.0)
'@eslint-community/regexpp': 4.9.0
eslint: 8.50.0
dev: true
/eslint-plugin-import@2.28.1(@typescript-eslint/parser@6.5.0)(eslint@8.48.0):
/eslint-plugin-import@2.28.1(@typescript-eslint/parser@6.7.3)(eslint@8.50.0):
resolution: {integrity: sha512-9I9hFlITvOV55alzoKBI+K9q74kv0iKMeY6av5+umsNwayt59fz692daGyjR+oStBQgx6nwR9rXldDev3Clw+A==}
engines: {node: '>=4'}
peerDependencies:
@@ -1260,16 +1265,16 @@ packages:
'@typescript-eslint/parser':
optional: true
dependencies:
'@typescript-eslint/parser': 6.5.0(eslint@8.48.0)(typescript@5.2.2)
'@typescript-eslint/parser': 6.7.3(eslint@8.50.0)(typescript@5.2.2)
array-includes: 3.1.6
array.prototype.findlastindex: 1.2.3
array.prototype.flat: 1.3.1
array.prototype.flatmap: 1.3.1
debug: 3.2.7
doctrine: 2.1.0
eslint: 8.48.0
eslint: 8.50.0
eslint-import-resolver-node: 0.3.9
eslint-module-utils: 2.8.0(@typescript-eslint/parser@6.5.0)(eslint-import-resolver-node@0.3.9)(eslint@8.48.0)
eslint-module-utils: 2.8.0(@typescript-eslint/parser@6.7.3)(eslint-import-resolver-node@0.3.9)(eslint@8.50.0)
has: 1.0.3
is-core-module: 2.13.0
is-glob: 4.0.3
@@ -1285,16 +1290,17 @@ packages:
- supports-color
dev: true
/eslint-plugin-n@16.0.2(eslint@8.48.0):
resolution: {integrity: sha512-Y66uDfUNbBzypsr0kELWrIz+5skicECrLUqlWuXawNSLUq3ltGlCwu6phboYYOTSnoTdHgTLrc+5Ydo6KjzZog==}
/eslint-plugin-n@16.1.0(eslint@8.50.0):
resolution: {integrity: sha512-3wv/TooBst0N4ND+pnvffHuz9gNPmk/NkLwAxOt2JykTl/hcuECe6yhTtLJcZjIxtZwN+GX92ACp/QTLpHA3Hg==}
engines: {node: '>=16.0.0'}
peerDependencies:
eslint: '>=7.0.0'
dependencies:
'@eslint-community/eslint-utils': 4.4.0(eslint@8.48.0)
'@eslint-community/eslint-utils': 4.4.0(eslint@8.50.0)
builtins: 5.0.1
eslint: 8.48.0
eslint-plugin-es-x: 7.2.0(eslint@8.48.0)
eslint: 8.50.0
eslint-plugin-es-x: 7.2.0(eslint@8.50.0)
get-tsconfig: 4.7.0
ignore: 5.2.4
is-core-module: 2.13.0
minimatch: 3.1.2
@@ -1302,7 +1308,7 @@ packages:
semver: 7.5.4
dev: true
/eslint-plugin-prettier@5.0.0(eslint-config-prettier@9.0.0)(eslint@8.48.0)(prettier@3.0.3):
/eslint-plugin-prettier@5.0.0(eslint-config-prettier@9.0.0)(eslint@8.50.0)(prettier@3.0.3):
resolution: {integrity: sha512-AgaZCVuYDXHUGxj/ZGu1u8H8CYgDY3iG6w5kUFw4AzMVXzB7VvbKgYR4nATIN+OvUrghMbiDLeimVjVY5ilq3w==}
engines: {node: ^14.18.0 || >=16.0.0}
peerDependencies:
@@ -1316,20 +1322,20 @@ packages:
eslint-config-prettier:
optional: true
dependencies:
eslint: 8.48.0
eslint-config-prettier: 9.0.0(eslint@8.48.0)
eslint: 8.50.0
eslint-config-prettier: 9.0.0(eslint@8.50.0)
prettier: 3.0.3
prettier-linter-helpers: 1.0.0
synckit: 0.8.5
dev: true
/eslint-plugin-promise@6.1.1(eslint@8.48.0):
/eslint-plugin-promise@6.1.1(eslint@8.50.0):
resolution: {integrity: sha512-tjqWDwVZQo7UIPMeDReOpUgHCmCiH+ePnVT+5zVapL0uuHnegBUs2smM13CzOs2Xb5+MHMRFTs9v24yjba4Oig==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies:
eslint: ^7.0.0 || ^8.0.0
dependencies:
eslint: 8.48.0
eslint: 8.50.0
dev: true
/eslint-scope@7.2.2:
@@ -1345,15 +1351,15 @@ packages:
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
dev: true
/eslint@8.48.0:
resolution: {integrity: sha512-sb6DLeIuRXxeM1YljSe1KEx9/YYeZFQWcV8Rq9HfigmdDEugjLEVEa1ozDjL6YDjBpQHPJxJzze+alxi4T3OLg==}
/eslint@8.50.0:
resolution: {integrity: sha512-FOnOGSuFuFLv/Sa+FDVRZl4GGVAAFFi8LecRsI5a1tMO5HIE8nCm4ivAlzt4dT3ol/PaaGC0rJEEXQmHJBGoOg==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
hasBin: true
dependencies:
'@eslint-community/eslint-utils': 4.4.0(eslint@8.48.0)
'@eslint-community/regexpp': 4.8.0
'@eslint-community/eslint-utils': 4.4.0(eslint@8.50.0)
'@eslint-community/regexpp': 4.8.1
'@eslint/eslintrc': 2.1.2
'@eslint/js': 8.48.0
'@eslint/js': 8.50.0
'@humanwhocodes/config-array': 0.11.11
'@humanwhocodes/module-importer': 1.0.1
'@nodelib/fs.walk': 1.2.8
@@ -1372,7 +1378,7 @@ packages:
file-entry-cache: 6.0.1
find-up: 5.0.0
glob-parent: 6.0.2
globals: 13.21.0
globals: 13.22.0
graphemer: 1.4.0
ignore: 5.2.4
imurmurhash: 0.1.4
@@ -1523,13 +1529,13 @@ packages:
resolution: {integrity: sha512-OHx4Qwrrt0E4jEIcI5/Xb+f+QmJYNj2rrK8wiIdQOIrB9WrrJL8cjZvXdXuBTkkEwEqLycb5BeZDV1o2i9bTew==}
engines: {node: '>=12.0.0'}
dependencies:
flatted: 3.2.7
flatted: 3.2.9
keyv: 4.5.3
rimraf: 3.0.2
dev: true
/flatted@3.2.7:
resolution: {integrity: sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==}
/flatted@3.2.9:
resolution: {integrity: sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==}
dev: true
/for-each@0.3.3:
@@ -1617,6 +1623,12 @@ packages:
get-intrinsic: 1.2.1
dev: true
/get-tsconfig@4.7.0:
resolution: {integrity: sha512-pmjiZ7xtB8URYm74PlGJozDNyhvsVLUcpBa8DZBG3bWHwaHa9bPiRpiSfovw+fjhwONSCWKRyk+JQHEGZmMrzw==}
dependencies:
resolve-pkg-maps: 1.0.0
dev: true
/glob-parent@5.1.2:
resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==}
engines: {node: '>= 6'}
@@ -1653,8 +1665,8 @@ packages:
path-is-absolute: 1.0.1
dev: true
/globals@13.21.0:
resolution: {integrity: sha512-ybyme3s4yy/t/3s35bewwXKOf7cvzfreG2lH0lZl0JB7I4GxRP2ghxOK/Nb9EkRXdbBXZLfq/p/0W2JUONB/Gg==}
/globals@13.22.0:
resolution: {integrity: sha512-H1Ddc/PbZHTDVJSnj8kWptIRSD6AM3pK+mKytuIVF4uoBV7rshFlhhvA58ceJ5wp3Er58w6zj7bykMpYXt3ETw==}
engines: {node: '>=8'}
dependencies:
type-fest: 0.20.2
@@ -2354,6 +2366,10 @@ packages:
engines: {node: '>=8'}
dev: true
/resolve-pkg-maps@1.0.0:
resolution: {integrity: sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==}
dev: true
/resolve@1.22.4:
resolution: {integrity: sha512-PXNdCiPqDqeUou+w1C2eTQbNfxKSuMxqTCuvlmmMsk1NWHL5fRrhY6Pl0qEYYc6+QqGClco1Qj8XnjPego4wfg==}
hasBin: true
@@ -2596,8 +2612,8 @@ packages:
hasBin: true
dev: true
/ts-api-utils@1.0.2(typescript@5.2.2):
resolution: {integrity: sha512-Cbu4nIqnEdd+THNEsBdkolnOXhg0I8XteoHaEKgvsxpsbWda4IsUut2c187HxywQCvveojow0Dgw/amxtSKVkQ==}
/ts-api-utils@1.0.3(typescript@5.2.2):
resolution: {integrity: sha512-wNMeqtMz5NtwpT/UZGY5alT+VoKdSsOOP/kqHFcUW1P/VRhH2wJ48+DN2WwUliNbQ976ETwDL0Ifd2VVvgonvg==}
engines: {node: '>=16.13.0'}
peerDependencies:
typescript: '>=4.2.0'
+16 -9
View File
@@ -3,31 +3,34 @@ import path from 'path'
import * as core from '@actions/core'
import * as cache from '@actions/cache'
import { options } from './options'
import { sha256 } from './util'
import { getCondaArch, sha256 } from './util'
export const generateCacheKey = async (cacheKeyPrefix: string) =>
fs
.readFile(options.pixiLockFile, 'utf-8')
.then((content) => `${cacheKeyPrefix}${sha256(content)}`)
.then((content) => `${cacheKeyPrefix}${getCondaArch()}-${sha256(content)}`)
.catch((err) => {
throw new Error(`Failed to generate cache key: ${err}`)
})
const cachePath = path.join(path.basename(options.manifestPath), '.pixi')
const cachePath = path.join(path.dirname(options.pixiLockFile), '.pixi')
let cacheHit = false
export const tryRestoreCache = (): Promise<string | undefined> => {
const cacheKeyPrefix = options.cacheKey
if (!cacheKeyPrefix) {
const cache_ = options.cache
if (!cache_) {
core.debug('Skipping pixi cache restore.')
return Promise.resolve(undefined)
}
return core.group('Restoring pixi cache', () =>
generateCacheKey(cacheKeyPrefix).then((cacheKey) => {
generateCacheKey(cache_.cacheKeyPrefix).then((cacheKey) => {
core.debug(`Cache key: ${cacheKey}`)
core.debug(`Cache path: ${cachePath}`)
return cache.restoreCache([cachePath], cacheKey, undefined, undefined, false).then((key) => {
if (key) {
core.info(`Restored cache with key \`${key}\``)
cacheHit = true
} else {
core.info(`Cache miss`)
}
@@ -38,13 +41,17 @@ export const tryRestoreCache = (): Promise<string | undefined> => {
}
export const saveCache = () => {
const cacheKeyPrefix = options.cacheKey
if (!cacheKeyPrefix) {
const cache_ = options.cache
if (!cache_ || !cache_.cacheWrite) {
core.debug('Skipping pixi cache save.')
return Promise.resolve(undefined)
}
if (cacheHit) {
core.debug('Skipping pixi cache save because cache was restored.')
return Promise.resolve(undefined)
}
return core.group('Saving pixi cache', () =>
generateCacheKey(cacheKeyPrefix).then((cacheKey) =>
generateCacheKey(cache_.cacheKeyPrefix).then((cacheKey) =>
cache
.saveCache([cachePath], cacheKey, undefined, false)
.then((cacheId) => {
+19 -26
View File
@@ -1,10 +1,11 @@
import fs from 'fs/promises'
import os from 'os'
import path from 'path'
import { exit } from 'process'
import * as core from '@actions/core'
import { downloadTool } from '@actions/tool-cache'
import type { PixiSource } from './options'
import { PATHS, options } from './options'
import { options } from './options'
import { execute, getPixiUrlFromVersion, pixiCmd } from './util'
import { saveCache, tryRestoreCache } from './cache'
@@ -27,6 +28,7 @@ const pixiLogin = () => {
core.debug('Skipping pixi login.')
return Promise.resolve(0)
}
core.debug(`auth keys: ${Object.keys(auth)}`)
return core.group('Logging in to private channel', () => {
// tokens get censored in the logs as long as they are a github secret
if ('token' in auth) {
@@ -52,43 +54,34 @@ const pixiInstall = async () => {
return Promise.resolve()
}
return tryRestoreCache()
.then((_cacheKey) => execute(pixiCmd('install')))
.then((_cacheKey) =>
execute(pixiCmd(`install${options.frozen ? ' --frozen' : ''}${options.locked ? ' --locked' : ''}`))
)
.then(saveCache)
}
const generatePixiRunShell = () => {
if (!options.generateRunShell) {
core.debug('Skipping pixi run shell generation.')
return Promise.resolve()
}
if (os.platform() === 'win32') {
core.info('Skipping pixi run shell on Windows.')
return Promise.resolve()
}
core.info('Generating pixi run shell.')
const pixiRunShellContents = `#!/usr/bin/env sh
chmod +x $1
pixi run $1
`
return core.group('Generating pixi run shell', () => {
core.debug(`Writing pixi run shell to ${PATHS.pixiRunShellScript}`)
core.debug(`File contents:\n"${pixiRunShellContents}"`)
return fs.writeFile(PATHS.pixiRunShellScript, pixiRunShellContents, { encoding: 'utf8', mode: 0o755 })
})
}
const generateInfo = () => core.group('pixi info', () => execute(pixiCmd('info')))
const run = async () => {
core.debug(`process.env.HOME: ${process.env.HOME}`)
core.debug(`os.homedir(): ${os.homedir()}`)
core.debug(`bashProfile ${PATHS.bashProfile}`)
await downloadPixi(options.pixiSource)
addPixiToPath()
await pixiLogin()
await pixiInstall()
await generatePixiRunShell()
await generateInfo()
}
run().catch((error) => core.setFailed(error.message))
run().catch((error) => {
if (core.isDebug()) {
throw error
}
if (error instanceof Error) {
core.setFailed(error.message)
exit(1)
} else if (typeof error === 'string') {
core.setFailed(error)
exit(1)
}
throw error
})
+108 -39
View File
@@ -1,8 +1,10 @@
import path from 'path'
import os from 'os'
import { exit } from 'process'
import { existsSync } from 'fs'
import * as core from '@actions/core'
import * as z from 'zod'
import { getCondaArch } from './util'
import untildify from 'untildify'
type Inputs = {
pixiVersion?: string
@@ -10,16 +12,18 @@ type Inputs = {
logLevel?: LogLevel
manifestPath?: string
runInstall?: boolean
generateRunShell?: boolean
frozen?: boolean
locked?: boolean
cache?: boolean
cacheKey?: string
cacheWrite?: boolean
pixiBinPath?: string
authHost?: string
authToken?: string
authUsername?: string
authPassword?: string
authCondaToken?: string
postCleanup?: PostCleanup
postCleanup?: boolean
}
export type PixiSource =
@@ -45,39 +49,47 @@ type Auth = {
}
)
type Cache = {
cacheKeyPrefix: string
cacheWrite: boolean
}
export type Options = Readonly<{
pixiSource: PixiSource
logLevel: LogLevel
manifestPath: string
pixiLockFile: string
runInstall: boolean
generateRunShell: boolean
cacheKey?: string // undefined if cache is false
frozen: boolean
locked: boolean
cache?: Cache
pixiBinPath: string
pixiRunShell: string
auth?: Auth
postCleanup: PostCleanup
postCleanup: boolean
}>
const logLevelSchema = z.enum(['quiet', 'warn', 'info', 'debug', 'trace'])
const logLevelSchema = z.enum(['q', 'default', 'v', 'vv', 'vvv'])
export type LogLevel = z.infer<typeof logLevelSchema>
const postCleanupSchema = z.enum(['none', 'environment', 'all'])
export type PostCleanup = z.infer<typeof postCleanupSchema>
export const PATHS = {
pixiBin: path.join(os.homedir(), '.pixi', 'bin', `pixi${os.platform() === 'win32' ? '.exe' : ''}`),
pixiRunShellScript: path.join(os.homedir(), '.pixi', 'bin', 'pixi-shell'),
bashProfile: path.join(os.homedir(), '.bash_profile'),
bashrc: path.join(os.homedir(), '.bashrc')
pixiBin: path.join(os.homedir(), '.pixi', 'bin', `pixi${os.platform() === 'win32' ? '.exe' : ''}`)
}
const parseOrUndefined = <T>(key: string, schema: z.ZodSchema<T>): T | undefined => {
const parseOrUndefined = <T>(key: string, schema: z.ZodSchema<T>, errorMessage?: string): T | undefined => {
const input = core.getInput(key)
// GitHub actions sets empty inputs to the empty string, but we want undefined
if (input === '') {
return undefined
}
return schema.parse(input)
const maybeResult = schema.safeParse(input)
if (!maybeResult.success) {
if (!errorMessage) {
throw new Error(`${key} is not valid: ${maybeResult.error.message}`)
}
throw new Error(errorMessage)
}
return maybeResult.data
}
const parseOrUndefinedJSON = <T>(key: string, schema: z.ZodSchema<T>): T | undefined => {
@@ -99,6 +111,15 @@ const validateInputs = (inputs: Inputs): void => {
if (inputs.runInstall === false && inputs.cache === true) {
throw new Error('Cannot cache without running install')
}
if (inputs.runInstall === false && inputs.frozen === true) {
throw new Error('Cannot use `frozen: true` when not running install')
}
if (inputs.runInstall === false && inputs.locked === true) {
throw new Error('Cannot use `locked: true` when not running install')
}
if (inputs.locked === true && inputs.frozen === true) {
throw new Error('Cannot use `locked: true` and `frozen: true` at the same time')
}
if ((inputs.authUsername && !inputs.authPassword) || (!inputs.authUsername && inputs.authPassword)) {
throw new Error('You need to specify both auth-username and auth-password')
}
@@ -119,6 +140,9 @@ const validateInputs = (inputs: Inputs): void => {
throw new Error('You need to specify auth-host')
}
}
if (inputs.cacheWrite && !inputs.cacheKey && !inputs.cache) {
throw new Error('cache-write is only valid with cache-key or cache specified.')
}
}
const inferOptions = (inputs: Inputs): Options => {
@@ -128,31 +152,49 @@ const inferOptions = (inputs: Inputs): Options => {
: inputs.pixiUrl
? { url: inputs.pixiUrl }
: { version: 'latest' }
const logLevel = inputs.logLevel ?? (core.isDebug() ? 'debug' : 'warn')
const manifestPath = inputs.manifestPath ?? 'pixi.toml'
const pixiLockFile = path.basename(manifestPath).replace(/\.toml$/, '.lock')
const generateRunShell = inputs.generateRunShell ?? runInstall
const cacheKey = inputs.cacheKey ?? (inputs.cache ? `pixi-${getCondaArch()}` : undefined)
const pixiBinPath = inputs.pixiBinPath ?? PATHS.pixiBin
const auth = inputs.authHost
? ({
host: inputs.authHost,
token: inputs.authToken,
username: inputs.authUsername,
password: inputs.authPassword,
condaToken: inputs.authCondaToken
} as Auth)
const logLevel = inputs.logLevel ?? (core.isDebug() ? 'vv' : 'default')
const manifestPath = inputs.manifestPath ? path.resolve(untildify(inputs.manifestPath)) : 'pixi.toml'
const pixiLockFile = path.join(path.dirname(manifestPath), path.basename(manifestPath).replace(/\.toml$/, '.lock'))
const cache = inputs.cacheKey
? { cacheKeyPrefix: inputs.cacheKey, cacheWrite: inputs.cacheWrite ?? true }
: inputs.cache
? { cacheKeyPrefix: 'pixi-', cacheWrite: true }
: undefined
const postCleanup = inputs.postCleanup ?? 'all'
const pixiBinPath = inputs.pixiBinPath ? path.resolve(untildify(inputs.pixiBinPath)) : PATHS.pixiBin
const pixiRunShell = path.join(path.dirname(pixiBinPath), 'pixi-shell')
const frozen = inputs.frozen ?? false
const lockFileAvailable = existsSync(pixiLockFile)
core.debug(`lockFileAvailable: ${lockFileAvailable}`)
const locked = inputs.locked ?? (lockFileAvailable && !frozen)
const auth = !inputs.authHost
? undefined
: ((inputs.authToken
? {
host: inputs.authHost,
token: inputs.authToken
}
: inputs.authCondaToken
? {
host: inputs.authHost,
condaToken: inputs.authCondaToken
}
: {
host: inputs.authHost,
username: inputs.authUsername!,
password: inputs.authPassword!
}) as Auth)
const postCleanup = inputs.postCleanup ?? true
return {
pixiSource,
logLevel,
manifestPath,
pixiLockFile,
runInstall,
generateRunShell,
cacheKey,
frozen,
locked,
cache,
pixiBinPath,
pixiRunShell,
auth,
postCleanup
}
@@ -169,21 +211,31 @@ const assertOptions = (_options: Options) => {
const getOptions = () => {
const inputs: Inputs = {
pixiVersion: parseOrUndefined('pixi-version', z.union([z.literal('latest'), z.string().regex(/^v\d+\.\d+\.\d+$/)])),
pixiVersion: parseOrUndefined(
'pixi-version',
z.union([z.literal('latest'), z.string().regex(/^v\d+\.\d+\.\d+$/)]),
'pixi-version must either be `latest` or a version string matching `vX.Y.Z`.'
),
pixiUrl: parseOrUndefined('pixi-url', z.string().url()),
logLevel: parseOrUndefined('log-level', logLevelSchema),
logLevel: parseOrUndefined(
'log-level',
logLevelSchema,
'log-level must be one of `q`, `default`, `v`, `vv`, `vvv`.'
),
manifestPath: parseOrUndefined('manifest-path', z.string()),
runInstall: parseOrUndefinedJSON('run-install', z.boolean()),
generateRunShell: parseOrUndefinedJSON('generate-run-shell', z.boolean()),
locked: parseOrUndefinedJSON('locked', z.boolean()),
frozen: parseOrUndefinedJSON('frozen', z.boolean()),
cache: parseOrUndefinedJSON('cache', z.boolean()),
cacheKey: parseOrUndefined('cache-key', z.string()),
pixiBinPath: parseOrUndefined('micromamba-binary-path', z.string()),
cacheWrite: parseOrUndefinedJSON('cache-write', z.boolean()),
pixiBinPath: parseOrUndefined('pixi-bin-path', z.string()),
authHost: parseOrUndefined('auth-host', z.string()),
authToken: parseOrUndefined('auth-token', z.string()),
authUsername: parseOrUndefined('auth-username', z.string()),
authPassword: parseOrUndefined('auth-password', z.string()),
authCondaToken: parseOrUndefined('auth-conda-token', z.string()),
postCleanup: parseOrUndefined('post-cleanup', postCleanupSchema)
postCleanup: parseOrUndefinedJSON('post-cleanup', z.boolean())
}
core.debug(`Inputs: ${JSON.stringify(inputs)}`)
validateInputs(inputs)
@@ -193,4 +245,21 @@ const getOptions = () => {
return options
}
export const options = getOptions()
let _options: Options
try {
_options = getOptions()
} catch (error) {
if (core.isDebug()) {
throw error
}
if (error instanceof Error) {
core.setFailed(error.message)
exit(1)
} else if (typeof error === 'string') {
core.setFailed(error)
exit(1)
}
throw error
}
export const options = _options
+83 -1
View File
@@ -1 +1,83 @@
console.log('post')
import fs from 'fs/promises'
import path from 'path'
import * as os from 'os'
import { exit } from 'process'
import * as core from '@actions/core'
import { options } from './options'
const removeEmptyParentDirs = (dirPath: string): Promise<void> => {
return fs.readdir(dirPath).then((files) => {
if (files.length === 0) {
core.debug(`Removing empty directory ${dirPath}.`)
return fs.rm(dirPath, { recursive: true }).then(() => {
const parentDir = path.dirname(dirPath)
if (parentDir !== dirPath) {
return removeEmptyParentDirs(parentDir)
}
})
}
return Promise.resolve()
})
}
const cleanupPixiBin = () => {
const pixiBinPath = options.pixiBinPath
const pixiBinDir = path.dirname(pixiBinPath)
core.debug(`Cleaning up pixi binary ${pixiBinPath}.`)
return fs.rm(pixiBinPath).then(() => removeEmptyParentDirs(pixiBinDir))
}
const cleanupEnv = () => {
if (!options.runInstall) {
core.debug('Skipping cleanup of .pixi directory.')
return Promise.resolve()
}
const envDir = path.join(path.dirname(options.manifestPath), '.pixi')
core.debug(`Cleaning up .pixi directory ${envDir}.`)
return fs.rm(envDir, { recursive: true })
}
const determineCacheDir = () => {
// rattler uses dirs::cache_dir https://docs.rs/dirs/latest/dirs/fn.cache_dir.html
if (os.platform() === 'win32') {
return process.env.LOCALAPPDATA!
}
if (os.platform() === 'linux') {
return process.env.XDG_CACHE_HOME ?? path.join(os.homedir(), '.cache')
}
return path.join(os.homedir(), 'Library', 'Caches')
}
const cleanupRattler = () => {
const rattlerPath = path.join(os.homedir(), '.rattler')
const cacheDir = determineCacheDir()
const rattlerCachePath = path.join(cacheDir, 'rattler')
core.debug(`Cleaning up rattler directories ${rattlerPath} and ${rattlerCachePath}.`)
return Promise.all([
fs.rm(rattlerPath, { recursive: true, force: true }),
fs.rm(rattlerCachePath, { recursive: true, force: true })
])
}
const run = () => {
const postCleanup = options.postCleanup
if (postCleanup) {
return Promise.all([cleanupPixiBin(), cleanupEnv(), cleanupRattler()])
}
core.debug('Skipping post-cleanup.')
return Promise.resolve()
}
run().catch((error) => {
if (core.isDebug()) {
throw error
}
if (error instanceof Error) {
core.setFailed(error.message)
exit(1)
} else if (typeof error === 'string') {
core.setFailed(error)
exit(1)
}
throw error
})
+5 -5
View File
@@ -79,18 +79,18 @@ export const pixiCmd = (command: string, withManifestPath = true) => {
commandArray = commandArray.concat(['--manifest-path', options.manifestPath])
}
switch (options.logLevel) {
case 'trace':
case 'vvv':
commandArray = commandArray.concat(['-vvv'])
break
case 'debug':
case 'vv':
commandArray = commandArray.concat(['-vv'])
break
case 'info':
case 'v':
commandArray = commandArray.concat(['-v'])
break
case 'warn':
case 'default':
break
case 'quiet':
case 'q':
commandArray = commandArray.concat(['-q'])
break
}
+1693
View File
File diff suppressed because it is too large Load Diff
+14
View File
@@ -0,0 +1,14 @@
[project]
name = "test-auth"
version = "0.1.0"
description = "Add a short description here"
authors = ["Pavel"]
channels = ["conda-forge", "https://repo.prefix.dev/setup-pixi-test"]
platforms = ["osx-arm64", "osx-64", "linux-64", "linux-aarch64", "win-64"]
[tasks]
test = "python -c 'print(\"Hello world!\")'"
[dependencies]
python = "3.9.*"
private-package = "*"
+1
View File
@@ -7,6 +7,7 @@ channels = ["conda-forge"]
platforms = ["linux-64", "osx-64", "win-64"]
[tasks]
test = "python -c 'print(\"Hello world!\")'"
[dependencies]
python = "3.11.*"
File diff suppressed because it is too large Load Diff
+14
View File
@@ -0,0 +1,14 @@
[project]
name = "test-default"
version = "0.1.0"
description = "Add a short description here"
authors = ["Pavel Zwerschke <pavelzw@gmail.com>"]
channels = ["conda-forge"]
platforms = ["linux-64", "osx-64", "osx-arm64", "win-64"]
[tasks]
test = "python -c 'print(\"Hello world!\")'"
[dependencies]
# the lockfile still has python 3.10.*
python = "3.11.*"
+1
View File
@@ -7,6 +7,7 @@ channels = ["conda-forge"]
platforms = ["linux-64", "osx-64", "win-64"]
[tasks]
test = "python -c 'print(\"Hello world!\")'"
[dependencies]
python = "3.11.*"
+28
View File
@@ -0,0 +1,28 @@
BSD 3-Clause License
Copyright (c) 2023, Pavel Zwerschke
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+28
View File
@@ -0,0 +1,28 @@
package:
name: private-package
version: 0.0.1
build:
noarch: python
script: echo this is a noop
number: 0
requirements:
run:
- python >=3.9
test:
commands:
- echo this is a noop
about:
home: http://github.com/prefix-dev/setup-pixi
license: BSD-3-Clause
license_file: LICENSE
description: |
This is a test package for setup-pixi.
dev_url: http://github.com/prefix-dev/setup-pixi
extra:
recipe-maintainers:
- pavelzw