Compare commits

..
3 Commits
Author SHA1 Message Date
Pavel Zwerschke c3e865a194 ? 2023-11-16 01:21:32 +01:00
Pavel Zwerschke 5b18bdc1e0 ACTIONS_RUNNER_DEBUG 2023-11-16 01:16:31 +01:00
Pavel Zwerschke 907eb83951 Add debug test 2023-11-16 01:14:04 +01:00
9 changed files with 524 additions and 536 deletions
+6 -8
View File
@@ -3,16 +3,14 @@ updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly
groups:
dependencies:
patterns:
- "*"
interval: weekly
- package-ecosystem: npm
directory: /
schedule:
interval: monthly
interval: weekly
groups:
dependencies:
dev-dependencies:
patterns:
- "*"
- "*eslint*"
- "@types/*"
- "prettier"
+2 -75
View File
@@ -6,8 +6,6 @@ on:
pull_request:
branches: [main]
merge_group:
schedule:
- cron: 0 6 * * MON
jobs:
build:
@@ -31,7 +29,7 @@ jobs:
- name: Rebuild the dist/ directory
run: pnpm build
- name: Lint
run: pnpm lint
@@ -43,81 +41,10 @@ jobs:
- name: Assert latest setup-pixi version is mentioned in README
run: |
set -euo pipefail
latest_version="$(jq -r '.version' package.json)"
count_expected=10
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."
echo "::error file=README.md::Expected $count_expected mentions of setup-pixi@v$latest_version in README.md, but found $count_actual."
exit 1
fi
reference-latest-pixi-version-in-readme:
name: Reference latest Pixi version in README
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Assert latest pixi version is mentioned in README
run: |
set -euo pipefail
latest_version="$(gh repo view --json latestRelease prefix-dev/pixi | jq -r '.latestRelease.tagName')"
count_expected=1
count_actual="$(grep -c "pixi-version: $latest_version" README.md || true)"
if [ "$count_actual" -ne "$count_expected" ]; then
echo "::error file=README.md::Expected $count_expected mentions of \`pixi-version: $latest_version\` in README.md, but found $count_actual."
sed -i "s/pixi-version: .*/pixi-version: $latest_version/" README.md
exit 1
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create pull request
uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38
if: failure() && github.ref_name == 'main'
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Reference latest Pixi version in README
title: Reference latest Pixi version in README
labels: documentation
check-dist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Rebuild the dist/ directory
run: pnpm build
- name: Compare the expected and actual dist/ directories
run: |
if [ "$(git diff --ignore-space-at-eol dist/* | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after build. See status below:"
git diff
exit 1
fi
id: diff
# If index.js or post.js are different than expected, upload the expected version as an artifact
- uses: actions/upload-artifact@v4
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
with:
name: dist
path: dist/
+48
View File
@@ -0,0 +1,48 @@
name: Check dist
on:
push:
branches: [main]
pull_request:
branches: [main]
merge_group:
jobs:
check-dist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Rebuild the dist/ directory
run: pnpm build
- name: Compare the expected and actual dist/ directories
run: |
if [ "$(git diff --ignore-space-at-eol dist/* | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after build. See status below:"
git diff
exit 1
fi
id: diff
# If index.js or post.js are different than expected, upload the expected version as an artifact
- uses: actions/upload-artifact@v3
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
with:
name: dist
path: dist/
+28 -9
View File
@@ -118,7 +118,7 @@ jobs:
# pixi 0.0.8 doesn't support --locked
locked: false
- run: pixi --version | grep -q "pixi 0.0.8"
custom-manifest-path:
strategy:
matrix:
@@ -180,8 +180,9 @@ jobs:
auth-host: https://custom-conda-registry.com
auth-token: custom-token
- run: |
cat ~/.rattler/credentials.json
[ $(jq '."*.custom-conda-registry.com".BearerToken' -r ~/.rattler/credentials.json) = "custom-token" ]
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'
@@ -202,9 +203,10 @@ jobs:
auth-username: custom-username
auth-password: custom-password
- run: |
cat ~/.rattler/credentials.json
[ $(jq '."*.custom-conda-registry.com".BasicHTTP.username' -r ~/.rattler/credentials.json) = "custom-username" ]
[ $(jq '."*.custom-conda-registry.com".BasicHTTP.password' -r ~/.rattler/credentials.json) = "custom-password" ]
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'
@@ -224,8 +226,10 @@ jobs:
auth-host: https://custom-conda-registry.com
auth-conda-token: custom-conda-token
- run: |
cat ~/.rattler/credentials.json
[ $(jq '."*.custom-conda-registry.com".CondaToken' -r ~/.rattler/credentials.json) = "custom-conda-token" ]
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'
@@ -357,7 +361,7 @@ jobs:
with:
cache: false
post-cleanup: ${{ matrix.post-cleanup }}
no-lockfile:
strategy:
matrix:
@@ -386,6 +390,21 @@ jobs:
pixi run python --version | grep -q 3.11
pixi run test | grep -q "Hello world"
debug:
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/* .
# test that setup-pixi does debug logging
- uses: ./
env:
ACTIONS_STEP_DEBUG: true
- run: pixi run python --version | grep -q 3.11
test-cache1:
name: Test cache 1/2
timeout-minutes: 10
+13 -28
View File
@@ -23,9 +23,9 @@ GitHub Action to set up the [pixi](https://github.com/prefix-dev/pixi) package m
## Usage
```yml
- uses: prefix-dev/setup-pixi@v0.4.3
- uses: prefix-dev/setup-pixi@v0.4.1
with:
pixi-version: v0.12.0
pixi-version: v0.7.0
cache: true
auth-host: prefix.dev
auth-token: ${{ secrets.PREFIX_DEV_TOKEN }}
@@ -34,23 +34,8 @@ GitHub Action to set up the [pixi](https://github.com/prefix-dev/pixi) package m
> [!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.4.3`) to avoid breaking changes.
> Please pin the versions of this action to a specific version (i.e., `prefix-dev/setup-pixi@v0.4.1`) 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).
>
> Put the following in your `.github/dependabot.yml` file to enable Dependabot for your GitHub Actions:
>
> ```yml
> version: 2
> updates:
> - package-ecosystem: github-actions
> directory: /
> schedule:
> interval: monthly # or daily, weekly
> groups:
> dependencies:
> patterns:
> - "*"
> ```
## Features
@@ -73,7 +58,7 @@ In order to not exceed the [10 GB cache size limit](https://docs.github.com/en/a
This can be done by setting the `cache-write` argument.
```yml
- uses: prefix-dev/setup-pixi@v0.4.3
- uses: prefix-dev/setup-pixi@v0.4.1
with:
cache: true
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
@@ -100,7 +85,7 @@ 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.4.3
- uses: prefix-dev/setup-pixi@v0.4.1
with:
auth-host: prefix.dev
auth-token: ${{ secrets.PREFIX_DEV_TOKEN }}
@@ -112,7 +97,7 @@ Specify the username and password using the `auth-username` and `auth-password`
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.4.3
- uses: prefix-dev/setup-pixi@v0.4.1
with:
auth-host: custom-artifactory.com
auth-username: ${{ secrets.PIXI_USERNAME }}
@@ -125,7 +110,7 @@ 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.4.3
- uses: prefix-dev/setup-pixi@v0.4.1
with:
auth-host: anaconda.org # or my-quetz-instance.com
conda-token: ${{ secrets.CONDA_TOKEN }}
@@ -163,7 +148,7 @@ You can specify whether `setup-pixi` should run `pixi install --frozen` or `pixi
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.4.3
- uses: prefix-dev/setup-pixi@v0.4.1
with:
locked: true
# or
@@ -179,12 +164,12 @@ 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`.
This can be enabled by running the action with the `ACTIONS_RUNNER_DEBUG` environment variable set to `true`.
```yml
- uses: prefix-dev/setup-pixi@v0.4.3
- uses: prefix-dev/setup-pixi@v0.4.1
env:
RUNNER_DEBUG: true
ACTIONS_RUNNER_DEBUG: true
```
Alternatively, you can enable debug logging for the action by re-running the action in debug mode:
@@ -200,7 +185,7 @@ 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.4.3
- uses: prefix-dev/setup-pixi@v0.4.1
with:
# one of `q`, `default`, `v`, `vv`, or `vvv`.
log-level: vvv
@@ -226,7 +211,7 @@ If nothing is specified, `setup-pixi` will default to `true`.
On self-hosted runners, you also might want to alter the default pixi install location to a temporary location. You can use `pixi-bin-path: ${{ runner.temp }}/bin/pixi` to do this.
```yml
- uses: prefix-dev/setup-pixi@v0.4.3
- uses: prefix-dev/setup-pixi@v0.4.1
with:
post-cleanup: true
# ${{ runner.temp }}\Scripts\pixi.exe on Windows
Generated Vendored
+13 -20
View File
@@ -26607,7 +26607,7 @@ var require_builder = __commonJS({
} else {
rootName = this.options.rootName;
}
render = /* @__PURE__ */ function(_this) {
render = function(_this) {
return function(element, obj) {
var attr, child, entry, index, key, value;
if (typeof obj !== "object") {
@@ -28302,7 +28302,7 @@ var require_parser = __commonJS({
xmlns: this.options.xmlns
});
this.saxParser.errThrown = false;
this.saxParser.onerror = /* @__PURE__ */ function(_this) {
this.saxParser.onerror = function(_this) {
return function(error2) {
_this.saxParser.resume();
if (!_this.saxParser.errThrown) {
@@ -28311,7 +28311,7 @@ var require_parser = __commonJS({
}
};
}(this);
this.saxParser.onend = /* @__PURE__ */ function(_this) {
this.saxParser.onend = function(_this) {
return function() {
if (!_this.saxParser.ended) {
_this.saxParser.ended = true;
@@ -28325,7 +28325,7 @@ var require_parser = __commonJS({
stack = [];
attrkey = this.options.attrkey;
charkey = this.options.charkey;
this.saxParser.onopentag = /* @__PURE__ */ function(_this) {
this.saxParser.onopentag = function(_this) {
return function(node) {
var key, newValue, obj, processedKey, ref;
obj = /* @__PURE__ */ Object.create(null);
@@ -28357,7 +28357,7 @@ var require_parser = __commonJS({
return stack.push(obj);
};
}(this);
this.saxParser.onclosetag = /* @__PURE__ */ function(_this) {
this.saxParser.onclosetag = function(_this) {
return function() {
var cdata, emptyStr, key, node, nodeName, obj, objClone, old, s, xpath;
obj = stack.pop();
@@ -28456,7 +28456,7 @@ var require_parser = __commonJS({
}
};
}(this);
ontext = /* @__PURE__ */ function(_this) {
ontext = function(_this) {
return function(text) {
var charChild, s;
s = stack[stack.length - 1];
@@ -28478,7 +28478,7 @@ var require_parser = __commonJS({
};
}(this);
this.saxParser.ontext = ontext;
return this.saxParser.oncdata = /* @__PURE__ */ function(_this) {
return this.saxParser.oncdata = function(_this) {
return function(text) {
var s;
s = ontext(text);
@@ -28524,7 +28524,7 @@ var require_parser = __commonJS({
}
};
Parser2.prototype.parseStringPromise = function(str) {
return new Promise(/* @__PURE__ */ function(_this) {
return new Promise(function(_this) {
return function(resolve, reject) {
return _this.parseString(str, function(err, value) {
if (err) {
@@ -30407,7 +30407,7 @@ var init_context = __esm({
"node_modules/.pnpm/@opentelemetry+api@1.4.1/node_modules/@opentelemetry/api/build/esm/context/context.js"() {
"use strict";
BaseContext = /** @class */
/* @__PURE__ */ function() {
function() {
function BaseContext2(parentContext) {
var self2 = this;
self2._currentContext = parentContext ? new Map(parentContext) : /* @__PURE__ */ new Map();
@@ -61228,17 +61228,10 @@ 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) => Promise.all([import_promises.default.readFile(options.pixiLockFile), import_promises.default.readFile(options.pixiBinPath)]).then(([lockfileContent, pixiBinary]) => {
const lockfileSha = sha256(lockfileContent);
core3.debug(`lockfileSha: ${lockfileSha}`);
const pixiSha = sha256(pixiBinary);
core3.debug(`pixiSha: ${pixiSha}`);
const lockfilePathSha = sha256(options.pixiLockFile);
core3.debug(`lockfilePathSha: ${lockfilePathSha}`);
const cwdSha = sha256(process.cwd());
core3.debug(`cwdSha: ${cwdSha}`);
const sha = sha256(lockfileSha + pixiSha + lockfilePathSha + cwdSha);
core3.debug(`sha: ${sha}`);
var generateCacheKey = async (cacheKeyPrefix) => import_promises.default.readFile(options.pixiLockFile, "utf-8").then((content) => {
const contentsSha = sha256(content);
const lockFileSha = sha256(options.pixiLockFile);
const sha = sha256(contentsSha + lockFileSha);
return `${cacheKeyPrefix}${getCondaArch()}-${sha}`;
}).catch((err) => {
throw new Error(`Failed to generate cache key: ${err}`);
+12 -12
View File
@@ -1,6 +1,6 @@
{
"name": "setup-pixi",
"version": "0.4.3",
"version": "0.4.1",
"private": true,
"description": "Action to set up the pixi package manager.",
"scripts": {
@@ -30,18 +30,18 @@
"zod": "^3.22.4"
},
"devDependencies": {
"@types/node": "^20.10.6",
"@typescript-eslint/eslint-plugin": "^6.16.0",
"@typescript-eslint/parser": "^6.16.0",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"@types/node": "^20.9.0",
"@typescript-eslint/eslint-plugin": "^6.10.0",
"@typescript-eslint/parser": "^6.10.0",
"eslint": "^8.53.0",
"eslint-config-prettier": "^9.0.0",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-n": "^16.6.0",
"eslint-plugin-prettier": "^5.1.2",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-n": "^16.3.1",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-promise": "^6.1.1",
"prettier": "^3.1.1",
"tsup": "^8.0.1",
"typescript": "^5.3.3"
"prettier": "^3.1.0",
"tsup": "^7.2.0",
"typescript": "^5.2.2"
}
}
+396 -371
View File
File diff suppressed because it is too large Load Diff
+6 -13
View File
@@ -6,21 +6,14 @@ import { options } from './options'
import { getCondaArch, sha256 } from './util'
export const generateCacheKey = async (cacheKeyPrefix: string) =>
Promise.all([fs.readFile(options.pixiLockFile), fs.readFile(options.pixiBinPath)])
.then(([lockfileContent, pixiBinary]) => {
const lockfileSha = sha256(lockfileContent)
core.debug(`lockfileSha: ${lockfileSha}`)
const pixiSha = sha256(pixiBinary)
core.debug(`pixiSha: ${pixiSha}`)
fs
.readFile(options.pixiLockFile, 'utf-8')
.then((content) => {
const contentsSha = sha256(content)
// the path to the lock file decides where the pixi env is created (../.pixi/env)
// since conda envs are not relocatable, we need to include the path in the cache key
const lockfilePathSha = sha256(options.pixiLockFile)
core.debug(`lockfilePathSha: ${lockfilePathSha}`)
// since the lockfile path is not necessarily absolute, we need to include the cwd in the cache key
const cwdSha = sha256(process.cwd())
core.debug(`cwdSha: ${cwdSha}`)
const sha = sha256(lockfileSha + pixiSha + lockfilePathSha + cwdSha)
core.debug(`sha: ${sha}`)
const lockFileSha = sha256(options.pixiLockFile)
const sha = sha256(contentsSha + lockFileSha)
return `${cacheKeyPrefix}${getCondaArch()}-${sha}`
})
.catch((err) => {