5
0
mirror of https://github.com/astral-sh/setup-uv.git synced 2025-12-17 11:05:59 +00:00

Compare commits

...

12 Commits

Author SHA1 Message Date
Kevin Stillhammer
d8db0a86d3 Change some formulations in README.md (#164) 2024-11-23 15:47:24 +00:00
Kevin Stillhammer
ed171c292b Fail when cache local path does not exist when trying to cache (#163)
Can be disabled by setting `ignore-nothing-to-cache: true`
2024-11-23 16:30:54 +01:00
Kevin Stillhammer
691a091485 Remove working dir from cacheDependencyGlob error message (#162)
Since https://github.com/astral-sh/setup-uv/pull/160 we allow searching
everywhere
2024-11-23 11:03:08 +00:00
Kevin Stillhammer
9b71657bb2 Add comment to clarify process.exit(0) (#161)
Copied from https://github.com/actions/cache/pull/1217
2024-11-23 10:58:21 +00:00
Kevin Stillhammer
caf0cab7a6 Expand TILDE (~) in path inputs (#160)
Closes: #159
2024-11-23 09:21:51 +01:00
github-actions[bot]
7c238111e6 chore: update known checksums for 0.5.4 (#158)
chore: update known checksums for 0.5.4

Co-authored-by: eifinger <1481961+eifinger@users.noreply.github.com>
2024-11-20 22:32:28 +00:00
dependabot[bot]
3eca4c2715 Bump @types/node from 22.9.0 to 22.9.1 (#157)
Bumps
[@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node)
from 22.9.0 to 22.9.1.
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=@types/node&package-manager=npm_and_yarn&previous-version=22.9.0&new-version=22.9.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-20 16:02:30 +01:00
github-actions[bot]
aee2e918ee chore: update known checksums for 0.5.3 (#156)
chore: update known checksums for 0.5.3

Co-authored-by: eifinger <1481961+eifinger@users.noreply.github.com>
2024-11-19 22:03:11 +00:00
dependabot[bot]
4ffb6d766c Bump @vercel/ncc from 0.38.2 to 0.38.3 (#155)
Bumps [@vercel/ncc](https://github.com/vercel/ncc) from 0.38.2 to
0.38.3.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/vercel/ncc/releases"><code>@​vercel/ncc</code>'s
releases</a>.</em></p>
<blockquote>
<h2>0.38.3</h2>
<h2><a
href="https://github.com/vercel/ncc/compare/0.38.2...0.38.3">0.38.3</a>
(2024-11-15)</h2>
<h3>Bug Fixes</h3>
<ul>
<li>add missing <code>--asset-builds</code> to cli help message (<a
href="https://redirect.github.com/vercel/ncc/issues/1228">#1228</a>) (<a
href="84f8c52872">84f8c52</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="84f8c52872"><code>84f8c52</code></a>
fix: add missing <code>--asset-builds</code> to cli help message (<a
href="https://redirect.github.com/vercel/ncc/issues/1228">#1228</a>)</li>
<li><a
href="0ff93c67f8"><code>0ff93c6</code></a>
chore(deps): Bump elliptic from 6.5.7 to 6.6.0 (<a
href="https://redirect.github.com/vercel/ncc/issues/1223">#1223</a>)</li>
<li><a
href="ae5bf16cb3"><code>ae5bf16</code></a>
chore(deps): Bump amannn/action-semantic-pull-request from 5.3.0 to
5.5.3 (<a
href="https://redirect.github.com/vercel/ncc/issues/1">#1</a>...</li>
<li><a
href="738a2bfe3d"><code>738a2bf</code></a>
chore(deps-dev): Bump axios from 0.21.4 to 1.7.7 (<a
href="https://redirect.github.com/vercel/ncc/issues/1209">#1209</a>)</li>
<li>See full diff in <a
href="https://github.com/vercel/ncc/compare/0.38.2...0.38.3">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=@vercel/ncc&package-manager=npm_and_yarn&previous-version=0.38.2&new-version=0.38.3)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-15 11:15:58 +01:00
github-actions[bot]
e779db7426 chore: update known checksums for 0.5.2 (#154)
chore: update known checksums for 0.5.2

Co-authored-by: eifinger <1481961+eifinger@users.noreply.github.com>
2024-11-15 06:53:19 +00:00
github-actions[bot]
cb1ce8a914 chore: update known checksums for 0.5.1 (#152)
chore: update known checksums for 0.5.1

Co-authored-by: eifinger <1481961+eifinger@users.noreply.github.com>
2024-11-09 11:01:15 +01:00
github-actions[bot]
cf7bbf8f13 chore: update known checksums for 0.5.0 (#151)
chore: update known checksums for 0.5.0

Co-authored-by: eifinger <1481961+eifinger@users.noreply.github.com>
2024-11-08 09:39:20 +01:00
13 changed files with 793 additions and 65 deletions

View File

@@ -21,7 +21,7 @@ jobs:
uses: ./
with:
enable-cache: true
cache-suffix: ${{ github.run_id }}-${{ github.run_attempt }}
cache-suffix: ${{ github.run_id }}-${{ github.run_attempt }}-test-setup-cache
- run: uv sync
working-directory: __tests__/fixtures/uv-project
test-restore-cache:
@@ -37,7 +37,7 @@ jobs:
uses: ./
with:
enable-cache: true
cache-suffix: ${{ github.run_id }}-${{ github.run_attempt }}
cache-suffix: ${{ github.run_id }}-${{ github.run_attempt }}-test-setup-cache
- name: Cache was hit
run: |
if [ "$CACHE_HIT" != "true" ]; then
@@ -59,7 +59,7 @@ jobs:
cache-dependency-glob: |
__tests__/fixtures/uv-project/uv.lock
**/pyproject.toml
cache-suffix: ${{ github.run_id }}-${{ github.run_attempt }}
cache-suffix: ${{ github.run_id }}-${{ github.run_attempt }}-test-setup-cache-dependency-glob
- run: uv sync
working-directory: __tests__/fixtures/uv-project
test-restore-cache-dependency-glob:
@@ -79,7 +79,8 @@ jobs:
cache-dependency-glob: |
__tests__/fixtures/uv-project/uv.lock
**/pyproject.toml
cache-suffix: ${{ github.run_id }}-${{ github.run_attempt }}
cache-suffix: ${{ github.run_id }}-${{ github.run_attempt }}-test-setup-cache-dependency-glob
ignore-nothing-to-cache: true
- name: Cache was not hit
run: |
if [ "$CACHE_HIT" == "true" ]; then
@@ -96,7 +97,7 @@ jobs:
uses: ./
with:
enable-cache: true
cache-suffix: ${{ github.run_id }}-${{ github.run_attempt }}
cache-suffix: ${{ github.run_id }}-${{ github.run_attempt }}-test-setup-cache-local
cache-local-path: /tmp/uv-cache
- run: uv sync
working-directory: __tests__/fixtures/uv-project
@@ -110,7 +111,7 @@ jobs:
uses: ./
with:
enable-cache: true
cache-suffix: ${{ github.run_id }}-${{ github.run_attempt }}
cache-suffix: ${{ github.run_id }}-${{ github.run_attempt }}-test-setup-cache-local
cache-local-path: /tmp/uv-cache
- name: Cache was hit
run: |
@@ -121,3 +122,49 @@ jobs:
CACHE_HIT: ${{ steps.restore.outputs.cache-hit }}
- run: uv sync
working-directory: __tests__/fixtures/uv-project
test-tilde-expansion-cache-local-path:
runs-on: selfhosted-ubuntu-arm64
steps:
- uses: actions/checkout@v4
- name: Create cache directory
run: mkdir -p ~/uv-cache
shell: bash
- name: Setup with cache
uses: ./
with:
cache-local-path: ~/uv-cache/cache-local-path
- run: uv sync
working-directory: __tests__/fixtures/uv-project
test-tilde-expansion-cache-dependency-glob:
runs-on: selfhosted-ubuntu-arm64
steps:
- uses: actions/checkout@v4
- name: Create cache directory
run: mkdir -p ~/uv-cache
shell: bash
- name: Create cache dependency glob file
run: touch ~/uv-cache.glob
shell: bash
- name: Setup with cache
uses: ./
with:
enable-cache: true
cache-local-path: ~/uv-cache/cache-dependency-glob
cache-dependency-glob: "~/uv-cache.glob"
- run: uv sync
working-directory: __tests__/fixtures/uv-project
cleanup-tilde-expansion-tests:
needs:
- test-tilde-expansion-cache-local-path
- test-tilde-expansion-cache-dependency-glob
runs-on: selfhosted-ubuntu-arm64
steps:
- name: Remove cache directory
run: rm -rf ~/uv-cache
shell: bash
- name: Remove cache dependency glob file
run: rm -f ~/uv-cache.glob
shell: bash

View File

@@ -123,3 +123,24 @@ jobs:
uses: ./
- run: uv tool install ruff
- run: ruff --version
test-tilde-expansion-tool-dirs:
runs-on: selfhosted-ubuntu-arm64
steps:
- uses: actions/checkout@v4
- name: Setup with cache
uses: ./
with:
tool-bin-dir: "~/tool-bin-dir"
tool-dir: "~/tool-dir"
- name: "Check if tool dirs are expanded"
run: |
if ! echo "$PATH" | grep -q "/home/ubuntu/tool-bin-dir"; then
echo "PATH does not contain /home/ubuntu/tool-bin-dir: $PATH"
exit 1
fi
if [ "$UV_TOOL_DIR" != "/home/ubuntu/tool-dir" ]; then
echo "UV_TOOL_DIR does not contain /home/ubuntu/tool-dir: $UV_TOOL_DIR"
exit 1
fi

View File

@@ -18,9 +18,12 @@ Set up your GitHub Actions workflow with a specific version of [uv](https://docs
- [Enable Caching](#enable-caching)
- [Cache dependency glob](#cache-dependency-glob)
- [Local cache path](#local-cache-path)
- [Disable cache pruning](#disable-cache-pruning)
- [Ignore nothing to cache](#ignore-nothing-to-cache)
- [GitHub authentication token](#github-authentication-token)
- [UV_TOOL_DIR](#uv_tool_dir)
- [UV_TOOL_BIN_DIR](#uv_tool_bin_dir)
- [Tilde Expansion](#tilde-expansion)
- [How it works](#how-it-works)
- [FAQ](#faq)
@@ -40,7 +43,7 @@ For an example workflow, see
> [!TIP]
>
> Using `latest` requires that uv download the executable on every run, which incurs a cost
> Using `latest` requires to download the uv executable on every run, which incurs a cost
> (especially on self-hosted runners). As a best practice, consider pinning the version to a
> specific release.
@@ -55,7 +58,7 @@ For an example workflow, see
### Install a version by supplying a semver range
You can also specify a [semver range](https://github.com/npm/node-semver?tab=readme-ov-file#ranges)
You can specify a [semver range](https://github.com/npm/node-semver?tab=readme-ov-file#ranges)
to install the latest version that satisfies the range.
```yaml
@@ -74,7 +77,7 @@ to install the latest version that satisfies the range.
### Validate checksum
You can also specify a checksum to validate the downloaded file. Checksums up to the default version
You can specify a checksum to validate the downloaded executable. Checksums up to the default version
are automatically verified by this action. The sha256 hashes can be found on the
[releases page](https://github.com/astral-sh/uv/releases) of the uv repo.
@@ -88,8 +91,8 @@ are automatically verified by this action. The sha256 hashes can be found on the
### Enable caching
If you enable caching, the [uv cache](https://docs.astral.sh/uv/concepts/cache/) will be cached to
the GitHub Actions Cache. This can speed up runs that reuse the cache by several minutes.
If you enable caching, the [uv cache](https://docs.astral.sh/uv/concepts/cache/) will be uploaded to
the GitHub Actions cache. This can speed up runs that reuse the cache by several minutes.
> [!TIP]
>
@@ -118,9 +121,9 @@ use it in subsequent steps. For example, to use the cache in the above case:
#### Cache dependency glob
If you want to control when the cache is invalidated, specify a glob pattern with the
`cache-dependency-glob` input. The cache will be invalidated if any file matching the glob pattern
changes. The glob matches files relative to the repository root.
If you want to control when the GitHub Actions cache is invalidated, specify a glob pattern with the
`cache-dependency-glob` input. The GitHub Actions cache will be invalidated if any file matching the glob pattern
changes. If you use relative paths, they are relative to the repository root.
> [!NOTE]
>
@@ -144,6 +147,14 @@ changes. The glob matches files relative to the repository root.
**/pyproject.toml
```
```yaml
- name: Define an absolute cache dependency glob
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
cache-dependency-glob: "/tmp/my-folder/requirements*.txt"
```
```yaml
- name: Never invalidate the cache
uses: astral-sh/setup-uv@v3
@@ -172,8 +183,8 @@ By default, the uv cache is pruned after every run, removing pre-built wheels, b
wheels that were built from source. On GitHub-hosted runners, it's typically faster to omit those
pre-built wheels from the cache (and instead re-download them from the registry on each run).
However, on self-hosted or local runners, preserving the cache may be more efficient. See
the[documentation](https://docs.astral.sh/uv/concepts/cache/#caching-in-continuous-integration) for
more.
the [documentation](https://docs.astral.sh/uv/concepts/cache/#caching-in-continuous-integration) for
more information.
If you want to persist the entire cache across runs, disable cache pruning with the `prune-cache`
input.
@@ -186,6 +197,19 @@ input.
prune-cache: false
```
### Ignore nothing to cache
By default, the action will fail if there is nothing to cache (the uv cache directory does not exist).
If you want to ignore this, set the `ignore-nothing-to-cache` input to `true`.
```yaml
- name: Ignore nothing to cache
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
ignore-nothing-to-cache: true
```
### GitHub authentication token
This action uses the GitHub API to fetch the uv release artifacts. To avoid hitting the GitHub API
@@ -240,6 +264,25 @@ If you want to change this behaviour (especially on self-hosted runners) you can
tool-bin-dir: "/path/to/tool-bin/dir"
```
### Tilde Expansion
This action supports expanding the `~` character to the user's home directory for the following inputs:
- `cache-local-path`
- `tool-dir`
- `tool-bin-dir`
- `cache-dependency-glob`
```yaml
- name: Expand the tilde character
uses: astral-sh/setup-uv@v3
with:
cache-local-path: "~/path/to/cache"
tool-dir: "~/path/to/tool/dir"
tool-bin-dir: "~/path/to/tool-bin/dir"
cache-dependency-glob: "~/my-cache-buster"
```
## How it works
This action downloads uv from the uv repo's official

View File

@@ -31,7 +31,10 @@ inputs:
default: ""
prune-cache:
description: "Prune cache before saving."
default: true
default: "true"
ignore-nothing-to-cache:
description: "Ignore when nothing is found to cache."
default: "false"
tool-dir:
description: "Custom path to set UV_TOOL_DIR to."
required: false

172
dist/save-cache/index.js generated vendored
View File

@@ -82304,10 +82304,10 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.STATE_CACHE_MATCHED_KEY = exports.STATE_CACHE_KEY = void 0;
exports.restoreCache = restoreCache;
const cache = __importStar(__nccwpck_require__(5116));
const glob = __importStar(__nccwpck_require__(7206));
const core = __importStar(__nccwpck_require__(7484));
const inputs_1 = __nccwpck_require__(9612);
const platforms_1 = __nccwpck_require__(8361);
const hash_files_1 = __nccwpck_require__(9660);
exports.STATE_CACHE_KEY = "cache-key";
exports.STATE_CACHE_MATCHED_KEY = "cache-matched-key";
const CACHE_VERSION = "1";
@@ -82334,9 +82334,9 @@ function computeKeys(version) {
let cacheDependencyPathHash = "-";
if (inputs_1.cacheDependencyGlob !== "") {
core.info(`Searching files using cache dependency glob: ${inputs_1.cacheDependencyGlob.split("\n").join(",")}`);
cacheDependencyPathHash += yield glob.hashFiles(inputs_1.cacheDependencyGlob, undefined, undefined, true);
cacheDependencyPathHash += yield (0, hash_files_1.hashFiles)(inputs_1.cacheDependencyGlob, true);
if (cacheDependencyPathHash === "-") {
throw new Error(`No file in ${process.cwd()} matched to [${inputs_1.cacheDependencyGlob.split("\n").join(",")}], make sure you have checked out the target repository`);
throw new Error(`No file matched to [${inputs_1.cacheDependencyGlob.split("\n").join(",")}], make sure you have checked out the target repository`);
}
}
else {
@@ -82358,6 +82358,114 @@ function handleMatchResult(matchedKey, primaryKey) {
}
/***/ }),
/***/ 9660:
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __asyncValues = (this && this.__asyncValues) || function (o) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var m = o[Symbol.asyncIterator], i;
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.hashFiles = hashFiles;
const crypto = __importStar(__nccwpck_require__(7598));
const core = __importStar(__nccwpck_require__(7484));
const fs = __importStar(__nccwpck_require__(3024));
const stream = __importStar(__nccwpck_require__(7075));
const util = __importStar(__nccwpck_require__(7975));
const glob_1 = __nccwpck_require__(7206);
/**
* Hashes files matching the given glob pattern.
*
* Copied from https://github.com/actions/toolkit/blob/20ed2908f19538e9dfb66d8083f1171c0a50a87c/packages/glob/src/internal-hash-files.ts#L9-L49
* But supports hashing files outside the GITHUB_WORKSPACE.
* @param pattern The glob pattern to match files.
* @param verbose Whether to log the files being hashed.
*/
function hashFiles(pattern_1) {
return __awaiter(this, arguments, void 0, function* (pattern, verbose = false) {
var _a, e_1, _b, _c;
const globber = yield (0, glob_1.create)(pattern);
let hasMatch = false;
const writeDelegate = verbose ? core.info : core.debug;
const result = crypto.createHash("sha256");
let count = 0;
try {
for (var _d = true, _e = __asyncValues(globber.globGenerator()), _f; _f = yield _e.next(), _a = _f.done, !_a; _d = true) {
_c = _f.value;
_d = false;
const file = _c;
writeDelegate(file);
if (fs.statSync(file).isDirectory()) {
writeDelegate(`Skip directory '${file}'.`);
continue;
}
const hash = crypto.createHash("sha256");
const pipeline = util.promisify(stream.pipeline);
yield pipeline(fs.createReadStream(file), hash);
result.write(hash.digest());
count++;
if (!hasMatch) {
hasMatch = true;
}
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (!_d && !_a && (_b = _e.return)) yield _b.call(_e);
}
finally { if (e_1) throw e_1.error; }
}
result.end();
if (hasMatch) {
writeDelegate(`Found ${count} files to hash.`);
return result.digest("hex");
}
writeDelegate("No matches found for glob");
return "";
});
}
/***/ }),
/***/ 1653:
@@ -82402,6 +82510,7 @@ exports.run = run;
const cache = __importStar(__nccwpck_require__(5116));
const core = __importStar(__nccwpck_require__(7484));
const exec = __importStar(__nccwpck_require__(5236));
const fs = __importStar(__nccwpck_require__(3024));
const restore_cache_1 = __nccwpck_require__(5391);
const inputs_1 = __nccwpck_require__(9612);
function run() {
@@ -82409,13 +82518,18 @@ function run() {
try {
if (inputs_1.enableCache) {
yield saveCache();
// node will stay alive if any promises are not resolved,
// which is a possibility if HTTP requests are dangling
// due to retries or timeouts. We know that if we got here
// that all promises that we care about have successfully
// resolved, so simply exit with success.
process.exit(0);
}
}
catch (error) {
const err = error;
core.setFailed(err.message);
}
process.exit(0);
});
}
function saveCache() {
@@ -82434,8 +82548,23 @@ function saveCache() {
yield pruneCache();
}
core.info(`Saving cache path: ${inputs_1.cacheLocalPath}`);
yield cache.saveCache([inputs_1.cacheLocalPath], cacheKey);
core.info(`cache saved with the key: ${cacheKey}`);
if (!fs.existsSync(inputs_1.cacheLocalPath) && !inputs_1.ignoreNothingToCache) {
throw new Error(`Cache path ${inputs_1.cacheLocalPath} does not exist on disk. This likely indicates that there are no dependencies to cache. Consider disabling the cache input if it is not needed.`);
}
try {
yield cache.saveCache([inputs_1.cacheLocalPath], cacheKey);
core.info(`cache saved with the key: ${cacheKey}`);
}
catch (e) {
if (e instanceof Error &&
e.message ===
"Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.") {
core.info("No cacheable paths were found. Ignoring because ignore-nothing-to-save is enabled.");
}
else {
throw e;
}
}
});
}
function pruneCache() {
@@ -82485,7 +82614,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.githubToken = exports.toolDir = exports.toolBinDir = exports.pruneCache = exports.cacheDependencyGlob = exports.cacheLocalPath = exports.cacheSuffix = exports.enableCache = exports.checkSum = exports.version = void 0;
exports.githubToken = exports.toolDir = exports.toolBinDir = exports.ignoreNothingToCache = exports.pruneCache = exports.cacheDependencyGlob = exports.cacheLocalPath = exports.cacheSuffix = exports.enableCache = exports.checkSum = exports.version = void 0;
const core = __importStar(__nccwpck_require__(7484));
const node_path_1 = __importDefault(__nccwpck_require__(6760));
exports.version = core.getInput("version");
@@ -82495,13 +82624,14 @@ exports.cacheSuffix = core.getInput("cache-suffix") || "";
exports.cacheLocalPath = getCacheLocalPath();
exports.cacheDependencyGlob = core.getInput("cache-dependency-glob");
exports.pruneCache = core.getInput("prune-cache") === "true";
exports.ignoreNothingToCache = core.getInput("ignore-nothing-to-cache") === "true";
exports.toolBinDir = getToolBinDir();
exports.toolDir = getToolDir();
exports.githubToken = core.getInput("github-token");
function getToolBinDir() {
const toolBinDirInput = core.getInput("tool-bin-dir");
if (toolBinDirInput !== "") {
return toolBinDirInput;
return expandTilde(toolBinDirInput);
}
if (process.platform === "win32") {
if (process.env.RUNNER_TEMP !== undefined) {
@@ -82514,7 +82644,7 @@ function getToolBinDir() {
function getToolDir() {
const toolDirInput = core.getInput("tool-dir");
if (toolDirInput !== "") {
return toolDirInput;
return expandTilde(toolDirInput);
}
if (process.platform === "win32") {
if (process.env.RUNNER_TEMP !== undefined) {
@@ -82527,13 +82657,19 @@ function getToolDir() {
function getCacheLocalPath() {
const cacheLocalPathInput = core.getInput("cache-local-path");
if (cacheLocalPathInput !== "") {
return cacheLocalPathInput;
return expandTilde(cacheLocalPathInput);
}
if (process.env.RUNNER_TEMP !== undefined) {
return `${process.env.RUNNER_TEMP}${node_path_1.default.sep}setup-uv-cache`;
}
throw Error("Could not determine UV_CACHE_DIR. Please make sure RUNNER_TEMP is set or provide the cache-local-path input");
}
function expandTilde(input) {
if (input.startsWith("~")) {
return `${process.env.HOME}${input.substring(1)}`;
}
return input;
}
/***/ }),
@@ -82684,6 +82820,14 @@ module.exports = require("net");
/***/ }),
/***/ 7598:
/***/ ((module) => {
"use strict";
module.exports = require("node:crypto");
/***/ }),
/***/ 8474:
/***/ ((module) => {
@@ -82692,6 +82836,14 @@ module.exports = require("node:events");
/***/ }),
/***/ 3024:
/***/ ((module) => {
"use strict";
module.exports = require("node:fs");
/***/ }),
/***/ 6760:
/***/ ((module) => {

219
dist/setup/index.js generated vendored
View File

@@ -87387,10 +87387,10 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.STATE_CACHE_MATCHED_KEY = exports.STATE_CACHE_KEY = void 0;
exports.restoreCache = restoreCache;
const cache = __importStar(__nccwpck_require__(5116));
const glob = __importStar(__nccwpck_require__(7206));
const core = __importStar(__nccwpck_require__(7484));
const inputs_1 = __nccwpck_require__(9612);
const platforms_1 = __nccwpck_require__(8361);
const hash_files_1 = __nccwpck_require__(9660);
exports.STATE_CACHE_KEY = "cache-key";
exports.STATE_CACHE_MATCHED_KEY = "cache-matched-key";
const CACHE_VERSION = "1";
@@ -87417,9 +87417,9 @@ function computeKeys(version) {
let cacheDependencyPathHash = "-";
if (inputs_1.cacheDependencyGlob !== "") {
core.info(`Searching files using cache dependency glob: ${inputs_1.cacheDependencyGlob.split("\n").join(",")}`);
cacheDependencyPathHash += yield glob.hashFiles(inputs_1.cacheDependencyGlob, undefined, undefined, true);
cacheDependencyPathHash += yield (0, hash_files_1.hashFiles)(inputs_1.cacheDependencyGlob, true);
if (cacheDependencyPathHash === "-") {
throw new Error(`No file in ${process.cwd()} matched to [${inputs_1.cacheDependencyGlob.split("\n").join(",")}], make sure you have checked out the target repository`);
throw new Error(`No file matched to [${inputs_1.cacheDependencyGlob.split("\n").join(",")}], make sure you have checked out the target repository`);
}
}
else {
@@ -87544,6 +87544,96 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.KNOWN_CHECKSUMS = void 0;
// AUTOGENERATED_DO_NOT_EDIT
exports.KNOWN_CHECKSUMS = {
"undefined-0.5.4": "10c2c0f34d520fa39cde9e9941c23facc01682c44621b407c3bca0d685d1e0bf",
"aarch64-apple-darwin-0.5.4": "f924d82255a0b25fd04a78c7012f90300cdadfb72ca0af4508f3eeaf9509010f",
"aarch64-unknown-linux-gnu-0.5.4": "7a1d505fa5c8425b0391398a49efc747836fcfbb7df82d1cc5b2a048c5d79ccb",
"aarch64-unknown-linux-musl-0.5.4": "3efc0e33d6f6f2c9e6b6567c713f4a02bf21339ca850465983997fd18fbc1bf8",
"arm-unknown-linux-musleabihf-0.5.4": "6033792a905d9fd4159a7e932a65a730920c2b7d706bd7ee24cf67db5ee0b0b2",
"armv7-unknown-linux-gnueabihf-0.5.4": "f650b2c618c77a535e32d9594ac07f60019f338bb9c244d13f75579851d9b8e7",
"armv7-unknown-linux-musleabihf-0.5.4": "55267162c22bd10ac1f6a45e6417be776eb7b3246403eb302c508f2311b37f24",
"i686-pc-windows-msvc-0.5.4": "357ecb0b64de0e0c4ddb9d30818d8569a1b524df115aed181ade34f96cde9dfd",
"i686-unknown-linux-gnu-0.5.4": "07cd53252ac1a95e5639cd5bc40b09236ac6d314f26d3de83df44a581c357ed9",
"i686-unknown-linux-musl-0.5.4": "5489b2207e2a6d44a9553bccb3eb93e87c92092abeee489799b5d412aa5d36ec",
"powerpc64-unknown-linux-gnu-0.5.4": "1c5b0edc2e1c5195e110fc5c11c6e0b7d7e043264e9c6e18bbff114b4dae34da",
"powerpc64le-unknown-linux-gnu-0.5.4": "99f357c6461ff687e13bd28f20d2115166a0d9de0f54c80eea2605cb30b03e19",
"powerpc64le-unknown-linux-musl-0.5.4": "e9f5c4c25a3aea450c93b23fb0d09d69cd9355150cae965ae01be4fc799f4a90",
"s390x-unknown-linux-gnu-0.5.4": "4a93135b8b1336fb6877da2b5426b4b42b4e0e2b8a23275d853fea0876e66c0d",
"x86_64-apple-darwin-0.5.4": "f879864954b2229611155bb201088d0f09becf1436b0ec8707c8f560e98e9209",
"x86_64-pc-windows-msvc-0.5.4": "db68a1850f156c89b82ecec359d09ba298fb1ce2a35dabc5072de458b175d8fb",
"x86_64-unknown-linux-gnu-0.5.4": "c5b63d1cd0a894246195250c034f9d82d646dc8f718f1f424cec2bb1a42e7b17",
"x86_64-unknown-linux-musl-0.5.4": "054016bcb6c7171feccd4234738d65727e67d39eddb500146edc779845b8846f",
"undefined-0.5.3": "ee4a3027f0ddff52c89df8d37cba54b6c40cd320d6fdb6ef033c7f11a6918f56",
"aarch64-apple-darwin-0.5.3": "634a7bd1250ab42a1b185789ceb733b7a186791eb78f995ecee283758abe44f6",
"aarch64-unknown-linux-gnu-0.5.3": "bebf7c00cad982137346ed30b31d0d2de2868d5925f98fcdb950380b27cdee8f",
"aarch64-unknown-linux-musl-0.5.3": "8a348779ea5b5698827ab0787dce9a9e6a16b7ac69beb9a7cb244e6aad8a8f1b",
"arm-unknown-linux-musleabihf-0.5.3": "79ad77f1260fb6147c4f7ba6292c62b667e64e6e139343a1aaf0e75868ebf208",
"armv7-unknown-linux-gnueabihf-0.5.3": "750037a75d9333365051afb0801a236bc07f7bbf28976abb1b0d77fb0dd7ccd7",
"armv7-unknown-linux-musleabihf-0.5.3": "e143cbc82ed16fa19d92a9ef3117aee27f043f784d55f909f9796edb2887ab35",
"i686-pc-windows-msvc-0.5.3": "fc10c2d9660893f0e8409742ac4af3767f04564b0be016dfd2088fe86c1427c7",
"i686-unknown-linux-gnu-0.5.3": "5a9f5d61ce8906589b8bd399710f659dcabf2f52504533dc9c9a14d125492a5a",
"i686-unknown-linux-musl-0.5.3": "517182e5cfc84fe9d7bfe5bd2d49ea9aff9ffa5ab279ae744dc796771118e594",
"powerpc64-unknown-linux-gnu-0.5.3": "c21e205404b9613b9cfcd82cb84222dc71d4f4534bef822c7306b44847ff7842",
"powerpc64le-unknown-linux-gnu-0.5.3": "b68f0f2a1a3a90808fbf0f82d09ad50857b430eaa7b086982824af040f13bda8",
"powerpc64le-unknown-linux-musl-0.5.3": "c2621d3b9db558147c3290a15c1968d016a236147c122a2540eff7c5970883f7",
"s390x-unknown-linux-gnu-0.5.3": "f18ce59914e4d4a8e51e4fd13b6f0f2c57eb6d529abbb7d90c355bb0fb867dc8",
"x86_64-apple-darwin-0.5.3": "f4b4f2b24b8f91704a4d821ac0ca4262de3d64bb15c3090cab549834bdf77753",
"x86_64-pc-windows-msvc-0.5.3": "146e5d6305b6f3c1a4d87d344bee80c2aea5439f9a540365e940b1b54caa20c2",
"x86_64-unknown-linux-gnu-0.5.3": "ba8828266c79c299ca24a1d9f2f78172667254d0f8ff07e24e1735d50c03d9b7",
"x86_64-unknown-linux-musl-0.5.3": "73b06fce21772d1c279d33bf53fa2f69c1ed9f929b5b06b14405bbf7244394fc",
"undefined-0.5.2": "60465d87552cd6febfdee8c58176d699e00d5549f2d35db3261ec5a113996099",
"aarch64-apple-darwin-0.5.2": "b4dc200d88ee9a8c9c3d5c755d9641fdf0e22b7d77239b4eeda08f204571f871",
"aarch64-unknown-linux-gnu-0.5.2": "e118c53908dc5baf779319129ed93ac783796fbe0b8416db03066877f0425ee6",
"aarch64-unknown-linux-musl-0.5.2": "4de0933b3a2dbdbf0bc17579ddda21e13d1a2cd6dfbc644e45ddab558f45e827",
"arm-unknown-linux-musleabihf-0.5.2": "926a0f6effd0439360fef7a6726320f0a5212da2259e68046882d4f32e69e933",
"armv7-unknown-linux-gnueabihf-0.5.2": "01e9c31b32f894b8e7b500991dfb35ed7f110d4c91ee9b2ead5f0408d8d91df5",
"armv7-unknown-linux-musleabihf-0.5.2": "b099de4fa747ea34f3f96122906143bf48de4c1c2529348e0651c95b53a0eea4",
"i686-pc-windows-msvc-0.5.2": "66e5934ee5f384270c39e54e5833411dca0c07f8e972d29e6c3c3e87fa53b9a8",
"i686-unknown-linux-gnu-0.5.2": "c91111b470608555c3ed4dc140071d7b041be7fd4a3328cf5ed2ffc5b011b024",
"i686-unknown-linux-musl-0.5.2": "ce67a80b31785268e7252521565b8aca7db8cf7d2f5b4a712a3173d919ad6e33",
"powerpc64-unknown-linux-gnu-0.5.2": "ca6c5dd9f02dbf97b0dce1005ff299632a36a9bc28dd343f26a5ae7aaae4d778",
"powerpc64le-unknown-linux-gnu-0.5.2": "2c60b1537b82c0c873ca0666b69452775566c4519a85efab51f47e2e3e59841a",
"powerpc64le-unknown-linux-musl-0.5.2": "14126a436daf913c86fad68e13db002e7c92ced381a72e8f2df186c1a729a9cf",
"s390x-unknown-linux-gnu-0.5.2": "cad1e4ad85f29fc73ec8fe79b1c0498fdea8e0071e38ecacb953633f1b553c71",
"x86_64-apple-darwin-0.5.2": "00bf6b346cc8fcf57df7653f48fc4bad1b47c6024f75e96e32e3193e9bc8ff73",
"x86_64-pc-windows-msvc-0.5.2": "0e97899b5c800da39730d3a612d8359ad2f346bdea540f973fa6c6ad17129a17",
"x86_64-unknown-linux-gnu-0.5.2": "d2d9d4b9ce536ab7ebb09d33629694385a3ebb72d156ae0b4dd28c9b6f6cbd13",
"x86_64-unknown-linux-musl-0.5.2": "61c386972ce13850cf20308de0be98a056d932e58d4154d1aec663714ac57067",
"undefined-0.5.1": "bdb7aa8f79ea3af27b1c618901fda6a622ae67700195f4c351085fa868c0c3d5",
"aarch64-apple-darwin-0.5.1": "240bc4dc0d424ce652746ea030e61798c07e3d22426c0e0fb46d1b408078df91",
"aarch64-unknown-linux-gnu-0.5.1": "aab7f31071c548e3ce64de5f622494f8d8679ef838d5b07e53e74399d14ee79f",
"aarch64-unknown-linux-musl-0.5.1": "f7b2b4dfb45d6a6c1b98ce1b40b0a3b67b72263f5f722fc8b452d340325fd169",
"arm-unknown-linux-musleabihf-0.5.1": "0205c18b606dd9e496bd664190ab380da27cedb09a84857367431c48bec71c82",
"armv7-unknown-linux-gnueabihf-0.5.1": "f91a59e1fbd3f913464841afd6d7a65b570b2e9255e8df0b36866a8ccbe82833",
"armv7-unknown-linux-musleabihf-0.5.1": "6285fc7f9c3c6872c55846fe57c643e47ba8fabf3c8be825ccbbd373369dba5c",
"i686-pc-windows-msvc-0.5.1": "7b0d716352f36730b3bdd40e1785e5e0299a2fa84929537c69f0b7ad9a1040e7",
"i686-unknown-linux-gnu-0.5.1": "db2950f841070db17192fbba149aebfe64f4087eb6ba842974a03ee12c66fddb",
"i686-unknown-linux-musl-0.5.1": "bac54f3c4afc0508fc91d03091dbce87efc8ab30e8d6ed2fcb7b9fc23533d040",
"powerpc64-unknown-linux-gnu-0.5.1": "40c415fa19fbaa4fe7452bea6248a381cc509c43eb25aa77b1d207b4d201987a",
"powerpc64le-unknown-linux-gnu-0.5.1": "1ce2764b411864597309fc331a31009dfb44abdd5ce767b83e4fa8208b9a7a9a",
"powerpc64le-unknown-linux-musl-0.5.1": "44239fdc81cd3eaf510683009aea1728cd7f647aea8b5901fa6e17071e77cbfa",
"s390x-unknown-linux-gnu-0.5.1": "362fbe64935721239c7e75e96ad1b313b30a2fc13b4a87470a5ff040c883bf2c",
"x86_64-apple-darwin-0.5.1": "817c11ee1808a775290d694c28090e032076be2c97e04c3fb7d5563a2aa52041",
"x86_64-pc-windows-msvc-0.5.1": "3dcb47a9334d7527e402eba8ba5aae3a62c77cddc3ce400f57fe2a40a621000d",
"x86_64-unknown-linux-gnu-0.5.1": "942e29ff6769b096c7c99e9c3b1c08276869667d0d5d6121852dd9b9d875b3f3",
"x86_64-unknown-linux-musl-0.5.1": "c446a98876ed86c810a80621a43e2378c35f39794020f8de99da72b003b17dd5",
"undefined-0.5.0": "2a5a63a6d7ddc2413c2f31e17d841b6d9b0815825f6e72789b7b9b405f5dacf5",
"aarch64-apple-darwin-0.5.0": "400f1e87d211af5ba4c412984b6d0e1e885cae480ee37cab58b5fabe9f9539c5",
"aarch64-unknown-linux-gnu-0.5.0": "ae2832e4e4cc923cdc62072eb23eab784be10450d6c1f10da58a24a3d552aa46",
"aarch64-unknown-linux-musl-0.5.0": "f49e979a2d64de50006951f15eb303524548a40c240b111acf3bf422abba7aa8",
"arm-unknown-linux-musleabihf-0.5.0": "9d77d34abbae1e77fdeb022dffc3dc736ddb193e2fd5e99068d16ebd0583b7ef",
"armv7-unknown-linux-gnueabihf-0.5.0": "e18fd84a30b89da3d850c003381b7946ac9a2c10e097206883c6f3d041a8b4ab",
"armv7-unknown-linux-musleabihf-0.5.0": "e1ccf1342253f5124442981b1fd01e8715a6ae20932370b8ebb4ddae06dd0003",
"i686-pc-windows-msvc-0.5.0": "288a13a986ac78c6f6a8b303b537e5eafc0501aab77249b2724484fa6ffae21f",
"i686-unknown-linux-gnu-0.5.0": "2edca509d6a57d07ad4b755cd992e4733531954374b7220c5795fcdef267af71",
"i686-unknown-linux-musl-0.5.0": "509a326cff65ca2fcf467b117ecb30c689b98ed35f79542fd358b44958fd7aa3",
"powerpc64-unknown-linux-gnu-0.5.0": "be94c615d8767f174beaf354fdb3fa3374bddb4ff88b8c157ce3c9e648ce4f95",
"powerpc64le-unknown-linux-gnu-0.5.0": "04c5883f4f4f1bcdfee452db51e97e00a2fbdc5abfd20a080aede481e7478743",
"powerpc64le-unknown-linux-musl-0.5.0": "4d8b6b581344d4ebd3fa3cb7c144e62be6671c62eca6f1dee8e799f0daf23707",
"s390x-unknown-linux-gnu-0.5.0": "68bb232360d081407674f740460071c6c34567dda0ff1782eb352ff7ca437b8f",
"x86_64-apple-darwin-0.5.0": "e0b64fb827ad2d93e0bf5fc508c38a9c6cdd295949f66efee92448c89a786913",
"x86_64-pc-windows-msvc-0.5.0": "47ce6713934f9c692a2051551e04cc9d63ee2e418f4179dd3ec8545b5cc22cb3",
"x86_64-unknown-linux-gnu-0.5.0": "e8f8c7e55ef2dfb0b57faba265faeb5049e30b9065a38e2a4fef89d6f6a492d0",
"x86_64-unknown-linux-musl-0.5.0": "a82a2e9c0cf4af58aa1f8d4a6f910c2d36abd38dd6d3315a6e11e7176c872a8d",
"undefined-0.4.30": "f077365676f0ed0e2275bd55015ad32f381a9d8684559ce9ee4d0e3c84906a0a",
"aarch64-apple-darwin-0.4.30": "5fb068be1d0c77d0829a0a611a470f74318f114c4dc8671cfaf1e606ab81e40a",
"aarch64-unknown-linux-gnu-0.4.30": "1beafc7773f20dc89154a338d5d4cfda98a8004d40249fe040806c5780ecb33f",
@@ -89878,6 +89968,114 @@ function getAvailableVersions(githubToken) {
}
/***/ }),
/***/ 9660:
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __asyncValues = (this && this.__asyncValues) || function (o) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var m = o[Symbol.asyncIterator], i;
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.hashFiles = hashFiles;
const crypto = __importStar(__nccwpck_require__(7598));
const core = __importStar(__nccwpck_require__(7484));
const fs = __importStar(__nccwpck_require__(3024));
const stream = __importStar(__nccwpck_require__(7075));
const util = __importStar(__nccwpck_require__(7975));
const glob_1 = __nccwpck_require__(7206);
/**
* Hashes files matching the given glob pattern.
*
* Copied from https://github.com/actions/toolkit/blob/20ed2908f19538e9dfb66d8083f1171c0a50a87c/packages/glob/src/internal-hash-files.ts#L9-L49
* But supports hashing files outside the GITHUB_WORKSPACE.
* @param pattern The glob pattern to match files.
* @param verbose Whether to log the files being hashed.
*/
function hashFiles(pattern_1) {
return __awaiter(this, arguments, void 0, function* (pattern, verbose = false) {
var _a, e_1, _b, _c;
const globber = yield (0, glob_1.create)(pattern);
let hasMatch = false;
const writeDelegate = verbose ? core.info : core.debug;
const result = crypto.createHash("sha256");
let count = 0;
try {
for (var _d = true, _e = __asyncValues(globber.globGenerator()), _f; _f = yield _e.next(), _a = _f.done, !_a; _d = true) {
_c = _f.value;
_d = false;
const file = _c;
writeDelegate(file);
if (fs.statSync(file).isDirectory()) {
writeDelegate(`Skip directory '${file}'.`);
continue;
}
const hash = crypto.createHash("sha256");
const pipeline = util.promisify(stream.pipeline);
yield pipeline(fs.createReadStream(file), hash);
result.write(hash.digest());
count++;
if (!hasMatch) {
hasMatch = true;
}
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (!_d && !_a && (_b = _e.return)) yield _b.call(_e);
}
finally { if (e_1) throw e_1.error; }
}
result.end();
if (hasMatch) {
writeDelegate(`Found ${count} files to hash.`);
return result.digest("hex");
}
writeDelegate("No matches found for glob");
return "";
});
}
/***/ }),
/***/ 2180:
@@ -90070,7 +90268,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.githubToken = exports.toolDir = exports.toolBinDir = exports.pruneCache = exports.cacheDependencyGlob = exports.cacheLocalPath = exports.cacheSuffix = exports.enableCache = exports.checkSum = exports.version = void 0;
exports.githubToken = exports.toolDir = exports.toolBinDir = exports.ignoreNothingToCache = exports.pruneCache = exports.cacheDependencyGlob = exports.cacheLocalPath = exports.cacheSuffix = exports.enableCache = exports.checkSum = exports.version = void 0;
const core = __importStar(__nccwpck_require__(7484));
const node_path_1 = __importDefault(__nccwpck_require__(6760));
exports.version = core.getInput("version");
@@ -90080,13 +90278,14 @@ exports.cacheSuffix = core.getInput("cache-suffix") || "";
exports.cacheLocalPath = getCacheLocalPath();
exports.cacheDependencyGlob = core.getInput("cache-dependency-glob");
exports.pruneCache = core.getInput("prune-cache") === "true";
exports.ignoreNothingToCache = core.getInput("ignore-nothing-to-cache") === "true";
exports.toolBinDir = getToolBinDir();
exports.toolDir = getToolDir();
exports.githubToken = core.getInput("github-token");
function getToolBinDir() {
const toolBinDirInput = core.getInput("tool-bin-dir");
if (toolBinDirInput !== "") {
return toolBinDirInput;
return expandTilde(toolBinDirInput);
}
if (process.platform === "win32") {
if (process.env.RUNNER_TEMP !== undefined) {
@@ -90099,7 +90298,7 @@ function getToolBinDir() {
function getToolDir() {
const toolDirInput = core.getInput("tool-dir");
if (toolDirInput !== "") {
return toolDirInput;
return expandTilde(toolDirInput);
}
if (process.platform === "win32") {
if (process.env.RUNNER_TEMP !== undefined) {
@@ -90112,13 +90311,19 @@ function getToolDir() {
function getCacheLocalPath() {
const cacheLocalPathInput = core.getInput("cache-local-path");
if (cacheLocalPathInput !== "") {
return cacheLocalPathInput;
return expandTilde(cacheLocalPathInput);
}
if (process.env.RUNNER_TEMP !== undefined) {
return `${process.env.RUNNER_TEMP}${node_path_1.default.sep}setup-uv-cache`;
}
throw Error("Could not determine UV_CACHE_DIR. Please make sure RUNNER_TEMP is set or provide the cache-local-path input");
}
function expandTilde(input) {
if (input.startsWith("~")) {
return `${process.env.HOME}${input.substring(1)}`;
}
return input;
}
/***/ }),

28
package-lock.json generated
View File

@@ -20,9 +20,9 @@
},
"devDependencies": {
"@biomejs/biome": "1.9.4",
"@types/node": "^22.9.0",
"@types/node": "^22.9.1",
"@types/semver": "^7.5.8",
"@vercel/ncc": "^0.38.2",
"@vercel/ncc": "^0.38.3",
"jest": "^29.7.0",
"js-yaml": "^4.1.0",
"ts-jest": "^29.2.5",
@@ -2025,9 +2025,9 @@
}
},
"node_modules/@types/node": {
"version": "22.9.0",
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.9.0.tgz",
"integrity": "sha512-vuyHg81vvWA1Z1ELfvLko2c8f34gyA0zaic0+Rllc5lbCnbSyuvb2Oxpm6TAUAC/2xZN3QGqxBNggD1nNR2AfQ==",
"version": "22.9.1",
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.9.1.tgz",
"integrity": "sha512-p8Yy/8sw1caA8CdRIQBG5tiLHmxtQKObCijiAa9Ez+d4+PRffM4054xbju0msf+cvhJpnFEeNjxmVT/0ipktrg==",
"dependencies": {
"undici-types": "~6.19.8"
}
@@ -2090,9 +2090,9 @@
"dev": true
},
"node_modules/@vercel/ncc": {
"version": "0.38.2",
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.38.2.tgz",
"integrity": "sha512-3yel3jaxUg9pHBv4+KeC9qlbdZPug+UMtUOlhvpDYCMSgcNSrS2Hv1LoqMsOV7hf2lYscx+BESfJOIla1WsmMQ==",
"version": "0.38.3",
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.38.3.tgz",
"integrity": "sha512-rnK6hJBS6mwc+Bkab+PGPs9OiS0i/3kdTO+CkI8V0/VrW3vmz7O2Pxjw/owOlmo6PKEIxRSeZKv/kuL9itnpYA==",
"dev": true,
"bin": {
"ncc": "dist/ncc/cli.js"
@@ -6464,9 +6464,9 @@
}
},
"@types/node": {
"version": "22.9.0",
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.9.0.tgz",
"integrity": "sha512-vuyHg81vvWA1Z1ELfvLko2c8f34gyA0zaic0+Rllc5lbCnbSyuvb2Oxpm6TAUAC/2xZN3QGqxBNggD1nNR2AfQ==",
"version": "22.9.1",
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.9.1.tgz",
"integrity": "sha512-p8Yy/8sw1caA8CdRIQBG5tiLHmxtQKObCijiAa9Ez+d4+PRffM4054xbju0msf+cvhJpnFEeNjxmVT/0ipktrg==",
"requires": {
"undici-types": "~6.19.8"
}
@@ -6528,9 +6528,9 @@
"dev": true
},
"@vercel/ncc": {
"version": "0.38.2",
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.38.2.tgz",
"integrity": "sha512-3yel3jaxUg9pHBv4+KeC9qlbdZPug+UMtUOlhvpDYCMSgcNSrS2Hv1LoqMsOV7hf2lYscx+BESfJOIla1WsmMQ==",
"version": "0.38.3",
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.38.3.tgz",
"integrity": "sha512-rnK6hJBS6mwc+Bkab+PGPs9OiS0i/3kdTO+CkI8V0/VrW3vmz7O2Pxjw/owOlmo6PKEIxRSeZKv/kuL9itnpYA==",
"dev": true
},
"abort-controller": {

View File

@@ -34,9 +34,9 @@
},
"devDependencies": {
"@biomejs/biome": "1.9.4",
"@types/node": "^22.9.0",
"@types/node": "^22.9.1",
"@types/semver": "^7.5.8",
"@vercel/ncc": "^0.38.2",
"@vercel/ncc": "^0.38.3",
"jest": "^29.7.0",
"js-yaml": "^4.1.0",
"ts-jest": "^29.2.5",

View File

@@ -1,5 +1,4 @@
import * as cache from "@actions/cache";
import * as glob from "@actions/glob";
import * as core from "@actions/core";
import {
cacheDependencyGlob,
@@ -7,6 +6,7 @@ import {
cacheSuffix,
} from "../utils/inputs";
import { getArch, getPlatform } from "../utils/platforms";
import { hashFiles } from "../hash/hash-files";
export const STATE_CACHE_KEY = "cache-key";
export const STATE_CACHE_MATCHED_KEY = "cache-matched-key";
@@ -39,15 +39,10 @@ async function computeKeys(version: string): Promise<string> {
core.info(
`Searching files using cache dependency glob: ${cacheDependencyGlob.split("\n").join(",")}`,
);
cacheDependencyPathHash += await glob.hashFiles(
cacheDependencyGlob,
undefined,
undefined,
true,
);
cacheDependencyPathHash += await hashFiles(cacheDependencyGlob, true);
if (cacheDependencyPathHash === "-") {
throw new Error(
`No file in ${process.cwd()} matched to [${cacheDependencyGlob.split("\n").join(",")}], make sure you have checked out the target repository`,
`No file matched to [${cacheDependencyGlob.split("\n").join(",")}], make sure you have checked out the target repository`,
);
}
} else {

View File

@@ -1,5 +1,185 @@
// AUTOGENERATED_DO_NOT_EDIT
export const KNOWN_CHECKSUMS: { [key: string]: string } = {
"undefined-0.5.4":
"10c2c0f34d520fa39cde9e9941c23facc01682c44621b407c3bca0d685d1e0bf",
"aarch64-apple-darwin-0.5.4":
"f924d82255a0b25fd04a78c7012f90300cdadfb72ca0af4508f3eeaf9509010f",
"aarch64-unknown-linux-gnu-0.5.4":
"7a1d505fa5c8425b0391398a49efc747836fcfbb7df82d1cc5b2a048c5d79ccb",
"aarch64-unknown-linux-musl-0.5.4":
"3efc0e33d6f6f2c9e6b6567c713f4a02bf21339ca850465983997fd18fbc1bf8",
"arm-unknown-linux-musleabihf-0.5.4":
"6033792a905d9fd4159a7e932a65a730920c2b7d706bd7ee24cf67db5ee0b0b2",
"armv7-unknown-linux-gnueabihf-0.5.4":
"f650b2c618c77a535e32d9594ac07f60019f338bb9c244d13f75579851d9b8e7",
"armv7-unknown-linux-musleabihf-0.5.4":
"55267162c22bd10ac1f6a45e6417be776eb7b3246403eb302c508f2311b37f24",
"i686-pc-windows-msvc-0.5.4":
"357ecb0b64de0e0c4ddb9d30818d8569a1b524df115aed181ade34f96cde9dfd",
"i686-unknown-linux-gnu-0.5.4":
"07cd53252ac1a95e5639cd5bc40b09236ac6d314f26d3de83df44a581c357ed9",
"i686-unknown-linux-musl-0.5.4":
"5489b2207e2a6d44a9553bccb3eb93e87c92092abeee489799b5d412aa5d36ec",
"powerpc64-unknown-linux-gnu-0.5.4":
"1c5b0edc2e1c5195e110fc5c11c6e0b7d7e043264e9c6e18bbff114b4dae34da",
"powerpc64le-unknown-linux-gnu-0.5.4":
"99f357c6461ff687e13bd28f20d2115166a0d9de0f54c80eea2605cb30b03e19",
"powerpc64le-unknown-linux-musl-0.5.4":
"e9f5c4c25a3aea450c93b23fb0d09d69cd9355150cae965ae01be4fc799f4a90",
"s390x-unknown-linux-gnu-0.5.4":
"4a93135b8b1336fb6877da2b5426b4b42b4e0e2b8a23275d853fea0876e66c0d",
"x86_64-apple-darwin-0.5.4":
"f879864954b2229611155bb201088d0f09becf1436b0ec8707c8f560e98e9209",
"x86_64-pc-windows-msvc-0.5.4":
"db68a1850f156c89b82ecec359d09ba298fb1ce2a35dabc5072de458b175d8fb",
"x86_64-unknown-linux-gnu-0.5.4":
"c5b63d1cd0a894246195250c034f9d82d646dc8f718f1f424cec2bb1a42e7b17",
"x86_64-unknown-linux-musl-0.5.4":
"054016bcb6c7171feccd4234738d65727e67d39eddb500146edc779845b8846f",
"undefined-0.5.3":
"ee4a3027f0ddff52c89df8d37cba54b6c40cd320d6fdb6ef033c7f11a6918f56",
"aarch64-apple-darwin-0.5.3":
"634a7bd1250ab42a1b185789ceb733b7a186791eb78f995ecee283758abe44f6",
"aarch64-unknown-linux-gnu-0.5.3":
"bebf7c00cad982137346ed30b31d0d2de2868d5925f98fcdb950380b27cdee8f",
"aarch64-unknown-linux-musl-0.5.3":
"8a348779ea5b5698827ab0787dce9a9e6a16b7ac69beb9a7cb244e6aad8a8f1b",
"arm-unknown-linux-musleabihf-0.5.3":
"79ad77f1260fb6147c4f7ba6292c62b667e64e6e139343a1aaf0e75868ebf208",
"armv7-unknown-linux-gnueabihf-0.5.3":
"750037a75d9333365051afb0801a236bc07f7bbf28976abb1b0d77fb0dd7ccd7",
"armv7-unknown-linux-musleabihf-0.5.3":
"e143cbc82ed16fa19d92a9ef3117aee27f043f784d55f909f9796edb2887ab35",
"i686-pc-windows-msvc-0.5.3":
"fc10c2d9660893f0e8409742ac4af3767f04564b0be016dfd2088fe86c1427c7",
"i686-unknown-linux-gnu-0.5.3":
"5a9f5d61ce8906589b8bd399710f659dcabf2f52504533dc9c9a14d125492a5a",
"i686-unknown-linux-musl-0.5.3":
"517182e5cfc84fe9d7bfe5bd2d49ea9aff9ffa5ab279ae744dc796771118e594",
"powerpc64-unknown-linux-gnu-0.5.3":
"c21e205404b9613b9cfcd82cb84222dc71d4f4534bef822c7306b44847ff7842",
"powerpc64le-unknown-linux-gnu-0.5.3":
"b68f0f2a1a3a90808fbf0f82d09ad50857b430eaa7b086982824af040f13bda8",
"powerpc64le-unknown-linux-musl-0.5.3":
"c2621d3b9db558147c3290a15c1968d016a236147c122a2540eff7c5970883f7",
"s390x-unknown-linux-gnu-0.5.3":
"f18ce59914e4d4a8e51e4fd13b6f0f2c57eb6d529abbb7d90c355bb0fb867dc8",
"x86_64-apple-darwin-0.5.3":
"f4b4f2b24b8f91704a4d821ac0ca4262de3d64bb15c3090cab549834bdf77753",
"x86_64-pc-windows-msvc-0.5.3":
"146e5d6305b6f3c1a4d87d344bee80c2aea5439f9a540365e940b1b54caa20c2",
"x86_64-unknown-linux-gnu-0.5.3":
"ba8828266c79c299ca24a1d9f2f78172667254d0f8ff07e24e1735d50c03d9b7",
"x86_64-unknown-linux-musl-0.5.3":
"73b06fce21772d1c279d33bf53fa2f69c1ed9f929b5b06b14405bbf7244394fc",
"undefined-0.5.2":
"60465d87552cd6febfdee8c58176d699e00d5549f2d35db3261ec5a113996099",
"aarch64-apple-darwin-0.5.2":
"b4dc200d88ee9a8c9c3d5c755d9641fdf0e22b7d77239b4eeda08f204571f871",
"aarch64-unknown-linux-gnu-0.5.2":
"e118c53908dc5baf779319129ed93ac783796fbe0b8416db03066877f0425ee6",
"aarch64-unknown-linux-musl-0.5.2":
"4de0933b3a2dbdbf0bc17579ddda21e13d1a2cd6dfbc644e45ddab558f45e827",
"arm-unknown-linux-musleabihf-0.5.2":
"926a0f6effd0439360fef7a6726320f0a5212da2259e68046882d4f32e69e933",
"armv7-unknown-linux-gnueabihf-0.5.2":
"01e9c31b32f894b8e7b500991dfb35ed7f110d4c91ee9b2ead5f0408d8d91df5",
"armv7-unknown-linux-musleabihf-0.5.2":
"b099de4fa747ea34f3f96122906143bf48de4c1c2529348e0651c95b53a0eea4",
"i686-pc-windows-msvc-0.5.2":
"66e5934ee5f384270c39e54e5833411dca0c07f8e972d29e6c3c3e87fa53b9a8",
"i686-unknown-linux-gnu-0.5.2":
"c91111b470608555c3ed4dc140071d7b041be7fd4a3328cf5ed2ffc5b011b024",
"i686-unknown-linux-musl-0.5.2":
"ce67a80b31785268e7252521565b8aca7db8cf7d2f5b4a712a3173d919ad6e33",
"powerpc64-unknown-linux-gnu-0.5.2":
"ca6c5dd9f02dbf97b0dce1005ff299632a36a9bc28dd343f26a5ae7aaae4d778",
"powerpc64le-unknown-linux-gnu-0.5.2":
"2c60b1537b82c0c873ca0666b69452775566c4519a85efab51f47e2e3e59841a",
"powerpc64le-unknown-linux-musl-0.5.2":
"14126a436daf913c86fad68e13db002e7c92ced381a72e8f2df186c1a729a9cf",
"s390x-unknown-linux-gnu-0.5.2":
"cad1e4ad85f29fc73ec8fe79b1c0498fdea8e0071e38ecacb953633f1b553c71",
"x86_64-apple-darwin-0.5.2":
"00bf6b346cc8fcf57df7653f48fc4bad1b47c6024f75e96e32e3193e9bc8ff73",
"x86_64-pc-windows-msvc-0.5.2":
"0e97899b5c800da39730d3a612d8359ad2f346bdea540f973fa6c6ad17129a17",
"x86_64-unknown-linux-gnu-0.5.2":
"d2d9d4b9ce536ab7ebb09d33629694385a3ebb72d156ae0b4dd28c9b6f6cbd13",
"x86_64-unknown-linux-musl-0.5.2":
"61c386972ce13850cf20308de0be98a056d932e58d4154d1aec663714ac57067",
"undefined-0.5.1":
"bdb7aa8f79ea3af27b1c618901fda6a622ae67700195f4c351085fa868c0c3d5",
"aarch64-apple-darwin-0.5.1":
"240bc4dc0d424ce652746ea030e61798c07e3d22426c0e0fb46d1b408078df91",
"aarch64-unknown-linux-gnu-0.5.1":
"aab7f31071c548e3ce64de5f622494f8d8679ef838d5b07e53e74399d14ee79f",
"aarch64-unknown-linux-musl-0.5.1":
"f7b2b4dfb45d6a6c1b98ce1b40b0a3b67b72263f5f722fc8b452d340325fd169",
"arm-unknown-linux-musleabihf-0.5.1":
"0205c18b606dd9e496bd664190ab380da27cedb09a84857367431c48bec71c82",
"armv7-unknown-linux-gnueabihf-0.5.1":
"f91a59e1fbd3f913464841afd6d7a65b570b2e9255e8df0b36866a8ccbe82833",
"armv7-unknown-linux-musleabihf-0.5.1":
"6285fc7f9c3c6872c55846fe57c643e47ba8fabf3c8be825ccbbd373369dba5c",
"i686-pc-windows-msvc-0.5.1":
"7b0d716352f36730b3bdd40e1785e5e0299a2fa84929537c69f0b7ad9a1040e7",
"i686-unknown-linux-gnu-0.5.1":
"db2950f841070db17192fbba149aebfe64f4087eb6ba842974a03ee12c66fddb",
"i686-unknown-linux-musl-0.5.1":
"bac54f3c4afc0508fc91d03091dbce87efc8ab30e8d6ed2fcb7b9fc23533d040",
"powerpc64-unknown-linux-gnu-0.5.1":
"40c415fa19fbaa4fe7452bea6248a381cc509c43eb25aa77b1d207b4d201987a",
"powerpc64le-unknown-linux-gnu-0.5.1":
"1ce2764b411864597309fc331a31009dfb44abdd5ce767b83e4fa8208b9a7a9a",
"powerpc64le-unknown-linux-musl-0.5.1":
"44239fdc81cd3eaf510683009aea1728cd7f647aea8b5901fa6e17071e77cbfa",
"s390x-unknown-linux-gnu-0.5.1":
"362fbe64935721239c7e75e96ad1b313b30a2fc13b4a87470a5ff040c883bf2c",
"x86_64-apple-darwin-0.5.1":
"817c11ee1808a775290d694c28090e032076be2c97e04c3fb7d5563a2aa52041",
"x86_64-pc-windows-msvc-0.5.1":
"3dcb47a9334d7527e402eba8ba5aae3a62c77cddc3ce400f57fe2a40a621000d",
"x86_64-unknown-linux-gnu-0.5.1":
"942e29ff6769b096c7c99e9c3b1c08276869667d0d5d6121852dd9b9d875b3f3",
"x86_64-unknown-linux-musl-0.5.1":
"c446a98876ed86c810a80621a43e2378c35f39794020f8de99da72b003b17dd5",
"undefined-0.5.0":
"2a5a63a6d7ddc2413c2f31e17d841b6d9b0815825f6e72789b7b9b405f5dacf5",
"aarch64-apple-darwin-0.5.0":
"400f1e87d211af5ba4c412984b6d0e1e885cae480ee37cab58b5fabe9f9539c5",
"aarch64-unknown-linux-gnu-0.5.0":
"ae2832e4e4cc923cdc62072eb23eab784be10450d6c1f10da58a24a3d552aa46",
"aarch64-unknown-linux-musl-0.5.0":
"f49e979a2d64de50006951f15eb303524548a40c240b111acf3bf422abba7aa8",
"arm-unknown-linux-musleabihf-0.5.0":
"9d77d34abbae1e77fdeb022dffc3dc736ddb193e2fd5e99068d16ebd0583b7ef",
"armv7-unknown-linux-gnueabihf-0.5.0":
"e18fd84a30b89da3d850c003381b7946ac9a2c10e097206883c6f3d041a8b4ab",
"armv7-unknown-linux-musleabihf-0.5.0":
"e1ccf1342253f5124442981b1fd01e8715a6ae20932370b8ebb4ddae06dd0003",
"i686-pc-windows-msvc-0.5.0":
"288a13a986ac78c6f6a8b303b537e5eafc0501aab77249b2724484fa6ffae21f",
"i686-unknown-linux-gnu-0.5.0":
"2edca509d6a57d07ad4b755cd992e4733531954374b7220c5795fcdef267af71",
"i686-unknown-linux-musl-0.5.0":
"509a326cff65ca2fcf467b117ecb30c689b98ed35f79542fd358b44958fd7aa3",
"powerpc64-unknown-linux-gnu-0.5.0":
"be94c615d8767f174beaf354fdb3fa3374bddb4ff88b8c157ce3c9e648ce4f95",
"powerpc64le-unknown-linux-gnu-0.5.0":
"04c5883f4f4f1bcdfee452db51e97e00a2fbdc5abfd20a080aede481e7478743",
"powerpc64le-unknown-linux-musl-0.5.0":
"4d8b6b581344d4ebd3fa3cb7c144e62be6671c62eca6f1dee8e799f0daf23707",
"s390x-unknown-linux-gnu-0.5.0":
"68bb232360d081407674f740460071c6c34567dda0ff1782eb352ff7ca437b8f",
"x86_64-apple-darwin-0.5.0":
"e0b64fb827ad2d93e0bf5fc508c38a9c6cdd295949f66efee92448c89a786913",
"x86_64-pc-windows-msvc-0.5.0":
"47ce6713934f9c692a2051551e04cc9d63ee2e418f4179dd3ec8545b5cc22cb3",
"x86_64-unknown-linux-gnu-0.5.0":
"e8f8c7e55ef2dfb0b57faba265faeb5049e30b9065a38e2a4fef89d6f6a492d0",
"x86_64-unknown-linux-musl-0.5.0":
"a82a2e9c0cf4af58aa1f8d4a6f910c2d36abd38dd6d3315a6e11e7176c872a8d",
"undefined-0.4.30":
"f077365676f0ed0e2275bd55015ad32f381a9d8684559ce9ee4d0e3c84906a0a",
"aarch64-apple-darwin-0.4.30":

48
src/hash/hash-files.ts Normal file
View File

@@ -0,0 +1,48 @@
import * as crypto from "node:crypto";
import * as core from "@actions/core";
import * as fs from "node:fs";
import * as stream from "node:stream";
import * as util from "node:util";
import { create } from "@actions/glob";
/**
* Hashes files matching the given glob pattern.
*
* Copied from https://github.com/actions/toolkit/blob/20ed2908f19538e9dfb66d8083f1171c0a50a87c/packages/glob/src/internal-hash-files.ts#L9-L49
* But supports hashing files outside the GITHUB_WORKSPACE.
* @param pattern The glob pattern to match files.
* @param verbose Whether to log the files being hashed.
*/
export async function hashFiles(
pattern: string,
verbose = false,
): Promise<string> {
const globber = await create(pattern);
let hasMatch = false;
const writeDelegate = verbose ? core.info : core.debug;
const result = crypto.createHash("sha256");
let count = 0;
for await (const file of globber.globGenerator()) {
writeDelegate(file);
if (fs.statSync(file).isDirectory()) {
writeDelegate(`Skip directory '${file}'.`);
continue;
}
const hash = crypto.createHash("sha256");
const pipeline = util.promisify(stream.pipeline);
await pipeline(fs.createReadStream(file), hash);
result.write(hash.digest());
count++;
if (!hasMatch) {
hasMatch = true;
}
}
result.end();
if (hasMatch) {
writeDelegate(`Found ${count} files to hash.`);
return result.digest("hex");
}
writeDelegate("No matches found for glob");
return "";
}

View File

@@ -1,6 +1,7 @@
import * as cache from "@actions/cache";
import * as core from "@actions/core";
import * as exec from "@actions/exec";
import * as fs from "node:fs";
import {
STATE_CACHE_MATCHED_KEY,
STATE_CACHE_KEY,
@@ -8,6 +9,7 @@ import {
import {
cacheLocalPath,
enableCache,
ignoreNothingToCache,
pruneCache as shouldPruneCache,
} from "./utils/inputs";
@@ -15,12 +17,17 @@ export async function run(): Promise<void> {
try {
if (enableCache) {
await saveCache();
// node will stay alive if any promises are not resolved,
// which is a possibility if HTTP requests are dangling
// due to retries or timeouts. We know that if we got here
// that all promises that we care about have successfully
// resolved, so simply exit with success.
process.exit(0);
}
} catch (error) {
const err = error as Error;
core.setFailed(err.message);
}
process.exit(0);
}
async function saveCache(): Promise<void> {
@@ -41,9 +48,27 @@ async function saveCache(): Promise<void> {
}
core.info(`Saving cache path: ${cacheLocalPath}`);
await cache.saveCache([cacheLocalPath], cacheKey);
core.info(`cache saved with the key: ${cacheKey}`);
if (!fs.existsSync(cacheLocalPath) && !ignoreNothingToCache) {
throw new Error(
`Cache path ${cacheLocalPath} does not exist on disk. This likely indicates that there are no dependencies to cache. Consider disabling the cache input if it is not needed.`,
);
}
try {
await cache.saveCache([cacheLocalPath], cacheKey);
core.info(`cache saved with the key: ${cacheKey}`);
} catch (e) {
if (
e instanceof Error &&
e.message ===
"Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved."
) {
core.info(
"No cacheable paths were found. Ignoring because ignore-nothing-to-save is enabled.",
);
} else {
throw e;
}
}
}
async function pruneCache(): Promise<void> {

View File

@@ -8,6 +8,8 @@ export const cacheSuffix = core.getInput("cache-suffix") || "";
export const cacheLocalPath = getCacheLocalPath();
export const cacheDependencyGlob = core.getInput("cache-dependency-glob");
export const pruneCache = core.getInput("prune-cache") === "true";
export const ignoreNothingToCache =
core.getInput("ignore-nothing-to-cache") === "true";
export const toolBinDir = getToolBinDir();
export const toolDir = getToolDir();
export const githubToken = core.getInput("github-token");
@@ -15,7 +17,7 @@ export const githubToken = core.getInput("github-token");
function getToolBinDir(): string | undefined {
const toolBinDirInput = core.getInput("tool-bin-dir");
if (toolBinDirInput !== "") {
return toolBinDirInput;
return expandTilde(toolBinDirInput);
}
if (process.platform === "win32") {
if (process.env.RUNNER_TEMP !== undefined) {
@@ -31,7 +33,7 @@ function getToolBinDir(): string | undefined {
function getToolDir(): string | undefined {
const toolDirInput = core.getInput("tool-dir");
if (toolDirInput !== "") {
return toolDirInput;
return expandTilde(toolDirInput);
}
if (process.platform === "win32") {
if (process.env.RUNNER_TEMP !== undefined) {
@@ -47,7 +49,7 @@ function getToolDir(): string | undefined {
function getCacheLocalPath(): string {
const cacheLocalPathInput = core.getInput("cache-local-path");
if (cacheLocalPathInput !== "") {
return cacheLocalPathInput;
return expandTilde(cacheLocalPathInput);
}
if (process.env.RUNNER_TEMP !== undefined) {
return `${process.env.RUNNER_TEMP}${path.sep}setup-uv-cache`;
@@ -56,3 +58,10 @@ function getCacheLocalPath(): string {
"Could not determine UV_CACHE_DIR. Please make sure RUNNER_TEMP is set or provide the cache-local-path input",
);
}
function expandTilde(input: string): string {
if (input.startsWith("~")) {
return `${process.env.HOME}${input.substring(1)}`;
}
return input;
}