Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
run: |
set -euo pipefail
latest_version="$(jq -r '.version' package.json)"
count_expected=19
count_expected=20
count_actual="$(grep -c "setup-pixi@v$latest_version" README.md || true)"
if [ "$count_actual" -ne "$count_expected" ]; then
echo "::error file=README.md::Expected $count_expected mentions of \`setup-pixi@v$latest_version\` in README.md, but found $count_actual."
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,16 @@ You can also specify the session token using the `auth-session-token` input argu

See the [pixi documentation](https://pixi.sh/latest/advanced/s3) for more information about S3 authentication.

#### PyPI Keyring

You can specify whether to use keyring to look up credentials for PyPI.

```yml
- uses: prefix-dev/setup-pixi@v0.9.0
with:
pypi-keyring-provider: subprocess
Comment thread
olivier-lacroix marked this conversation as resolved.
Outdated
```

### 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 -e {0}`.
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ inputs:
description: Secret access key to use for S3 authentication.
auth-s3-session-token:
description: Session token to use for S3 authentication.
pypi-keyring-provider:
description: |
Specifies whether to use keyring to look up credentials for PyPI.
options: disabled, subprocess
post-cleanup:
description: |
If the action should clean up after itself. Defaults to `true`.
Expand Down
28 changes: 20 additions & 8 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions dist/post.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 16 additions & 10 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,23 @@ const pixiInstall = async () => {
}
return tryRestoreCache()
.then(async (_cacheKey) => {
if (options.environments) {
for (const environment of options.environments) {
core.debug(`Installing environment ${environment}`)
const command = `install -e ${environment}${options.frozen ? ' --frozen' : ''}${
options.locked ? ' --locked' : ''
}`
await core.group(`pixi ${command}`, () => execute(pixiCmd(command)))
const environments = options.environments ?? [undefined]
for (const environment of environments) {
core.debug(`Installing environment ${environment ?? 'default'}`)
let command = `install`
if (environment) {
command += ` -e ${environment}`
}
} else {
const command = `install${options.frozen ? ' --frozen' : ''}${options.locked ? ' --locked' : ''}`
return core.group(`pixi ${command}`, () => execute(pixiCmd(command)))
if (options.frozen) {
command += ' --frozen'
}
if (options.locked) {
command += ' --locked'
}
if (options.pypiKeyringProvider) {
command += ` --pypi-keyring-provider ${options.pypiKeyringProvider}`
}
await core.group(`pixi ${command}`, () => execute(pixiCmd(command)))
}
})
.then(saveCache)
Expand Down
8 changes: 8 additions & 0 deletions src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ type Inputs = Readonly<{
authS3AccessKeyId?: string
authS3SecretAccessKey?: string
authS3SessionToken?: string
pypiKeyringProvider?: 'disabled' | 'subprocess'
postCleanup?: boolean
}>

Expand Down Expand Up @@ -79,6 +80,7 @@ export type Options = Readonly<{
cache?: Cache
pixiBinPath: string
auth?: Auth
pypiKeyringProvider?: 'disabled' | 'subprocess'
postCleanup: boolean
activatedEnvironment?: string
}>
Expand All @@ -88,6 +90,9 @@ const pyprojectPath = 'pyproject.toml'
const logLevelSchema = z.enum(['q', 'default', 'v', 'vv', 'vvv'])
export type LogLevel = z.infer<typeof logLevelSchema>

const pypiKeyringProviderSchema = z.enum(['disabled', 'subprocess'])
export type PypiKeyringProvider = z.infer<typeof pypiKeyringProviderSchema>

export const PATHS = {
pixiBin: path.join(os.homedir(), '.pixi', 'bin', `pixi${os.platform() === 'win32' ? '.exe' : ''}`)
}
Expand Down Expand Up @@ -323,8 +328,10 @@ const inferOptions = (inputs: Inputs): Options => {
s3SessionToken: inputs.authS3SessionToken
}) as Auth)
const postCleanup = inputs.postCleanup ?? true
const pypiKeyringProvider = inputs.pypiKeyringProvider
return {
pixiSource,
pypiKeyringProvider,
downloadPixi,
logLevel,
manifestPath,
Expand Down Expand Up @@ -382,6 +389,7 @@ const getOptions = () => {
authS3AccessKeyId: parseOrUndefined('auth-s3-access-key-id', z.string()),
authS3SecretAccessKey: parseOrUndefined('auth-s3-secret-access-key', z.string()),
authS3SessionToken: parseOrUndefined('auth-s3-session-token', z.string()),
pypiKeyringProvider: parseOrUndefined('pypi-keyring-provider', pypiKeyringProviderSchema),
postCleanup: parseOrUndefinedJSON('post-cleanup', z.boolean())
}
core.debug(`Inputs: ${JSON.stringify(inputs)}`)
Expand Down
Loading