mirror of
https://github.com/astral-sh/setup-uv.git
synced 2025-12-23 11:01:03 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
caf0cab7a6 | ||
|
|
7c238111e6 | ||
|
|
3eca4c2715 | ||
|
|
aee2e918ee | ||
|
|
4ffb6d766c |
46
.github/workflows/test-cache.yml
vendored
46
.github/workflows/test-cache.yml
vendored
@@ -121,3 +121,49 @@ jobs:
|
|||||||
CACHE_HIT: ${{ steps.restore.outputs.cache-hit }}
|
CACHE_HIT: ${{ steps.restore.outputs.cache-hit }}
|
||||||
- run: uv sync
|
- run: uv sync
|
||||||
working-directory: __tests__/fixtures/uv-project
|
working-directory: __tests__/fixtures/uv-project
|
||||||
|
|
||||||
|
prepare-tilde-expansion-tests:
|
||||||
|
runs-on: selfhosted-ubuntu-arm64
|
||||||
|
steps:
|
||||||
|
- name: Create cache directory
|
||||||
|
run: mkdir -p ~/uv-cache
|
||||||
|
shell: bash
|
||||||
|
- name: Create cache dependency glob file
|
||||||
|
run: touch ~/uv-cache.glob
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
test-tilde-expansion-cache-local-path:
|
||||||
|
needs: prepare-tilde-expansion-tests
|
||||||
|
runs-on: selfhosted-ubuntu-arm64
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Setup with cache
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
enable-cache: true
|
||||||
|
cache-local-path: ~/uv-cache/cache-local-path
|
||||||
|
|
||||||
|
test-tilde-expansion-cache-dependency-glob:
|
||||||
|
needs: prepare-tilde-expansion-tests
|
||||||
|
runs-on: selfhosted-ubuntu-arm64
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Setup with cache
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
enable-cache: true
|
||||||
|
cache-local-path: ~/uv-cache/cache-dependency-glob
|
||||||
|
cache-dependency-glob: "~/uv-cache.glob"
|
||||||
|
|
||||||
|
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
|
||||||
|
|||||||
21
.github/workflows/test.yml
vendored
21
.github/workflows/test.yml
vendored
@@ -123,3 +123,24 @@ jobs:
|
|||||||
uses: ./
|
uses: ./
|
||||||
- run: uv tool install ruff
|
- run: uv tool install ruff
|
||||||
- run: ruff --version
|
- 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
|
||||||
|
|
||||||
|
|||||||
30
README.md
30
README.md
@@ -21,6 +21,7 @@ Set up your GitHub Actions workflow with a specific version of [uv](https://docs
|
|||||||
- [GitHub authentication token](#github-authentication-token)
|
- [GitHub authentication token](#github-authentication-token)
|
||||||
- [UV_TOOL_DIR](#uv_tool_dir)
|
- [UV_TOOL_DIR](#uv_tool_dir)
|
||||||
- [UV_TOOL_BIN_DIR](#uv_tool_bin_dir)
|
- [UV_TOOL_BIN_DIR](#uv_tool_bin_dir)
|
||||||
|
- [Tilde Expansion](#tilde-expansion)
|
||||||
- [How it works](#how-it-works)
|
- [How it works](#how-it-works)
|
||||||
- [FAQ](#faq)
|
- [FAQ](#faq)
|
||||||
|
|
||||||
@@ -120,7 +121,7 @@ use it in subsequent steps. For example, to use the cache in the above case:
|
|||||||
|
|
||||||
If you want to control when the cache is invalidated, specify a glob pattern with the
|
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
|
`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.
|
changes. If you use relative paths, the glob matches files relative to the repository root.
|
||||||
|
|
||||||
> [!NOTE]
|
> [!NOTE]
|
||||||
>
|
>
|
||||||
@@ -144,6 +145,14 @@ changes. The glob matches files relative to the repository root.
|
|||||||
**/pyproject.toml
|
**/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
|
```yaml
|
||||||
- name: Never invalidate the cache
|
- name: Never invalidate the cache
|
||||||
uses: astral-sh/setup-uv@v3
|
uses: astral-sh/setup-uv@v3
|
||||||
@@ -240,6 +249,25 @@ If you want to change this behaviour (especially on self-hosted runners) you can
|
|||||||
tool-bin-dir: "/path/to/tool-bin/dir"
|
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
|
## How it works
|
||||||
|
|
||||||
This action downloads uv from the uv repo's official
|
This action downloads uv from the uv repo's official
|
||||||
|
|||||||
140
dist/save-cache/index.js
generated
vendored
140
dist/save-cache/index.js
generated
vendored
@@ -82304,10 +82304,10 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||||||
exports.STATE_CACHE_MATCHED_KEY = exports.STATE_CACHE_KEY = void 0;
|
exports.STATE_CACHE_MATCHED_KEY = exports.STATE_CACHE_KEY = void 0;
|
||||||
exports.restoreCache = restoreCache;
|
exports.restoreCache = restoreCache;
|
||||||
const cache = __importStar(__nccwpck_require__(5116));
|
const cache = __importStar(__nccwpck_require__(5116));
|
||||||
const glob = __importStar(__nccwpck_require__(7206));
|
|
||||||
const core = __importStar(__nccwpck_require__(7484));
|
const core = __importStar(__nccwpck_require__(7484));
|
||||||
const inputs_1 = __nccwpck_require__(9612);
|
const inputs_1 = __nccwpck_require__(9612);
|
||||||
const platforms_1 = __nccwpck_require__(8361);
|
const platforms_1 = __nccwpck_require__(8361);
|
||||||
|
const hash_files_1 = __nccwpck_require__(9660);
|
||||||
exports.STATE_CACHE_KEY = "cache-key";
|
exports.STATE_CACHE_KEY = "cache-key";
|
||||||
exports.STATE_CACHE_MATCHED_KEY = "cache-matched-key";
|
exports.STATE_CACHE_MATCHED_KEY = "cache-matched-key";
|
||||||
const CACHE_VERSION = "1";
|
const CACHE_VERSION = "1";
|
||||||
@@ -82334,7 +82334,7 @@ function computeKeys(version) {
|
|||||||
let cacheDependencyPathHash = "-";
|
let cacheDependencyPathHash = "-";
|
||||||
if (inputs_1.cacheDependencyGlob !== "") {
|
if (inputs_1.cacheDependencyGlob !== "") {
|
||||||
core.info(`Searching files using cache dependency glob: ${inputs_1.cacheDependencyGlob.split("\n").join(",")}`);
|
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 === "-") {
|
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 in ${process.cwd()} matched to [${inputs_1.cacheDependencyGlob.split("\n").join(",")}], make sure you have checked out the target repository`);
|
||||||
}
|
}
|
||||||
@@ -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:
|
/***/ 1653:
|
||||||
@@ -82501,7 +82609,7 @@ exports.githubToken = core.getInput("github-token");
|
|||||||
function getToolBinDir() {
|
function getToolBinDir() {
|
||||||
const toolBinDirInput = core.getInput("tool-bin-dir");
|
const toolBinDirInput = core.getInput("tool-bin-dir");
|
||||||
if (toolBinDirInput !== "") {
|
if (toolBinDirInput !== "") {
|
||||||
return toolBinDirInput;
|
return expandTilde(toolBinDirInput);
|
||||||
}
|
}
|
||||||
if (process.platform === "win32") {
|
if (process.platform === "win32") {
|
||||||
if (process.env.RUNNER_TEMP !== undefined) {
|
if (process.env.RUNNER_TEMP !== undefined) {
|
||||||
@@ -82514,7 +82622,7 @@ function getToolBinDir() {
|
|||||||
function getToolDir() {
|
function getToolDir() {
|
||||||
const toolDirInput = core.getInput("tool-dir");
|
const toolDirInput = core.getInput("tool-dir");
|
||||||
if (toolDirInput !== "") {
|
if (toolDirInput !== "") {
|
||||||
return toolDirInput;
|
return expandTilde(toolDirInput);
|
||||||
}
|
}
|
||||||
if (process.platform === "win32") {
|
if (process.platform === "win32") {
|
||||||
if (process.env.RUNNER_TEMP !== undefined) {
|
if (process.env.RUNNER_TEMP !== undefined) {
|
||||||
@@ -82527,13 +82635,19 @@ function getToolDir() {
|
|||||||
function getCacheLocalPath() {
|
function getCacheLocalPath() {
|
||||||
const cacheLocalPathInput = core.getInput("cache-local-path");
|
const cacheLocalPathInput = core.getInput("cache-local-path");
|
||||||
if (cacheLocalPathInput !== "") {
|
if (cacheLocalPathInput !== "") {
|
||||||
return cacheLocalPathInput;
|
return expandTilde(cacheLocalPathInput);
|
||||||
}
|
}
|
||||||
if (process.env.RUNNER_TEMP !== undefined) {
|
if (process.env.RUNNER_TEMP !== undefined) {
|
||||||
return `${process.env.RUNNER_TEMP}${node_path_1.default.sep}setup-uv-cache`;
|
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");
|
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 +82798,14 @@ module.exports = require("net");
|
|||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 7598:
|
||||||
|
/***/ ((module) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
module.exports = require("node:crypto");
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
/***/ 8474:
|
/***/ 8474:
|
||||||
/***/ ((module) => {
|
/***/ ((module) => {
|
||||||
|
|
||||||
@@ -82692,6 +82814,14 @@ module.exports = require("node:events");
|
|||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 3024:
|
||||||
|
/***/ ((module) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
module.exports = require("node:fs");
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
/***/ 6760:
|
/***/ 6760:
|
||||||
/***/ ((module) => {
|
/***/ ((module) => {
|
||||||
|
|
||||||
|
|||||||
160
dist/setup/index.js
generated
vendored
160
dist/setup/index.js
generated
vendored
@@ -87387,10 +87387,10 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||||||
exports.STATE_CACHE_MATCHED_KEY = exports.STATE_CACHE_KEY = void 0;
|
exports.STATE_CACHE_MATCHED_KEY = exports.STATE_CACHE_KEY = void 0;
|
||||||
exports.restoreCache = restoreCache;
|
exports.restoreCache = restoreCache;
|
||||||
const cache = __importStar(__nccwpck_require__(5116));
|
const cache = __importStar(__nccwpck_require__(5116));
|
||||||
const glob = __importStar(__nccwpck_require__(7206));
|
|
||||||
const core = __importStar(__nccwpck_require__(7484));
|
const core = __importStar(__nccwpck_require__(7484));
|
||||||
const inputs_1 = __nccwpck_require__(9612);
|
const inputs_1 = __nccwpck_require__(9612);
|
||||||
const platforms_1 = __nccwpck_require__(8361);
|
const platforms_1 = __nccwpck_require__(8361);
|
||||||
|
const hash_files_1 = __nccwpck_require__(9660);
|
||||||
exports.STATE_CACHE_KEY = "cache-key";
|
exports.STATE_CACHE_KEY = "cache-key";
|
||||||
exports.STATE_CACHE_MATCHED_KEY = "cache-matched-key";
|
exports.STATE_CACHE_MATCHED_KEY = "cache-matched-key";
|
||||||
const CACHE_VERSION = "1";
|
const CACHE_VERSION = "1";
|
||||||
@@ -87417,7 +87417,7 @@ function computeKeys(version) {
|
|||||||
let cacheDependencyPathHash = "-";
|
let cacheDependencyPathHash = "-";
|
||||||
if (inputs_1.cacheDependencyGlob !== "") {
|
if (inputs_1.cacheDependencyGlob !== "") {
|
||||||
core.info(`Searching files using cache dependency glob: ${inputs_1.cacheDependencyGlob.split("\n").join(",")}`);
|
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 === "-") {
|
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 in ${process.cwd()} matched to [${inputs_1.cacheDependencyGlob.split("\n").join(",")}], make sure you have checked out the target repository`);
|
||||||
}
|
}
|
||||||
@@ -87544,6 +87544,42 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||||||
exports.KNOWN_CHECKSUMS = void 0;
|
exports.KNOWN_CHECKSUMS = void 0;
|
||||||
// AUTOGENERATED_DO_NOT_EDIT
|
// AUTOGENERATED_DO_NOT_EDIT
|
||||||
exports.KNOWN_CHECKSUMS = {
|
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",
|
"undefined-0.5.2": "60465d87552cd6febfdee8c58176d699e00d5549f2d35db3261ec5a113996099",
|
||||||
"aarch64-apple-darwin-0.5.2": "b4dc200d88ee9a8c9c3d5c755d9641fdf0e22b7d77239b4eeda08f204571f871",
|
"aarch64-apple-darwin-0.5.2": "b4dc200d88ee9a8c9c3d5c755d9641fdf0e22b7d77239b4eeda08f204571f871",
|
||||||
"aarch64-unknown-linux-gnu-0.5.2": "e118c53908dc5baf779319129ed93ac783796fbe0b8416db03066877f0425ee6",
|
"aarch64-unknown-linux-gnu-0.5.2": "e118c53908dc5baf779319129ed93ac783796fbe0b8416db03066877f0425ee6",
|
||||||
@@ -89932,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:
|
/***/ 2180:
|
||||||
@@ -90140,7 +90284,7 @@ exports.githubToken = core.getInput("github-token");
|
|||||||
function getToolBinDir() {
|
function getToolBinDir() {
|
||||||
const toolBinDirInput = core.getInput("tool-bin-dir");
|
const toolBinDirInput = core.getInput("tool-bin-dir");
|
||||||
if (toolBinDirInput !== "") {
|
if (toolBinDirInput !== "") {
|
||||||
return toolBinDirInput;
|
return expandTilde(toolBinDirInput);
|
||||||
}
|
}
|
||||||
if (process.platform === "win32") {
|
if (process.platform === "win32") {
|
||||||
if (process.env.RUNNER_TEMP !== undefined) {
|
if (process.env.RUNNER_TEMP !== undefined) {
|
||||||
@@ -90153,7 +90297,7 @@ function getToolBinDir() {
|
|||||||
function getToolDir() {
|
function getToolDir() {
|
||||||
const toolDirInput = core.getInput("tool-dir");
|
const toolDirInput = core.getInput("tool-dir");
|
||||||
if (toolDirInput !== "") {
|
if (toolDirInput !== "") {
|
||||||
return toolDirInput;
|
return expandTilde(toolDirInput);
|
||||||
}
|
}
|
||||||
if (process.platform === "win32") {
|
if (process.platform === "win32") {
|
||||||
if (process.env.RUNNER_TEMP !== undefined) {
|
if (process.env.RUNNER_TEMP !== undefined) {
|
||||||
@@ -90166,13 +90310,19 @@ function getToolDir() {
|
|||||||
function getCacheLocalPath() {
|
function getCacheLocalPath() {
|
||||||
const cacheLocalPathInput = core.getInput("cache-local-path");
|
const cacheLocalPathInput = core.getInput("cache-local-path");
|
||||||
if (cacheLocalPathInput !== "") {
|
if (cacheLocalPathInput !== "") {
|
||||||
return cacheLocalPathInput;
|
return expandTilde(cacheLocalPathInput);
|
||||||
}
|
}
|
||||||
if (process.env.RUNNER_TEMP !== undefined) {
|
if (process.env.RUNNER_TEMP !== undefined) {
|
||||||
return `${process.env.RUNNER_TEMP}${node_path_1.default.sep}setup-uv-cache`;
|
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");
|
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
28
package-lock.json
generated
@@ -20,9 +20,9 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@biomejs/biome": "1.9.4",
|
"@biomejs/biome": "1.9.4",
|
||||||
"@types/node": "^22.9.0",
|
"@types/node": "^22.9.1",
|
||||||
"@types/semver": "^7.5.8",
|
"@types/semver": "^7.5.8",
|
||||||
"@vercel/ncc": "^0.38.2",
|
"@vercel/ncc": "^0.38.3",
|
||||||
"jest": "^29.7.0",
|
"jest": "^29.7.0",
|
||||||
"js-yaml": "^4.1.0",
|
"js-yaml": "^4.1.0",
|
||||||
"ts-jest": "^29.2.5",
|
"ts-jest": "^29.2.5",
|
||||||
@@ -2025,9 +2025,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@types/node": {
|
"node_modules/@types/node": {
|
||||||
"version": "22.9.0",
|
"version": "22.9.1",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.9.0.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.9.1.tgz",
|
||||||
"integrity": "sha512-vuyHg81vvWA1Z1ELfvLko2c8f34gyA0zaic0+Rllc5lbCnbSyuvb2Oxpm6TAUAC/2xZN3QGqxBNggD1nNR2AfQ==",
|
"integrity": "sha512-p8Yy/8sw1caA8CdRIQBG5tiLHmxtQKObCijiAa9Ez+d4+PRffM4054xbju0msf+cvhJpnFEeNjxmVT/0ipktrg==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"undici-types": "~6.19.8"
|
"undici-types": "~6.19.8"
|
||||||
}
|
}
|
||||||
@@ -2090,9 +2090,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/@vercel/ncc": {
|
"node_modules/@vercel/ncc": {
|
||||||
"version": "0.38.2",
|
"version": "0.38.3",
|
||||||
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.38.2.tgz",
|
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.38.3.tgz",
|
||||||
"integrity": "sha512-3yel3jaxUg9pHBv4+KeC9qlbdZPug+UMtUOlhvpDYCMSgcNSrS2Hv1LoqMsOV7hf2lYscx+BESfJOIla1WsmMQ==",
|
"integrity": "sha512-rnK6hJBS6mwc+Bkab+PGPs9OiS0i/3kdTO+CkI8V0/VrW3vmz7O2Pxjw/owOlmo6PKEIxRSeZKv/kuL9itnpYA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"ncc": "dist/ncc/cli.js"
|
"ncc": "dist/ncc/cli.js"
|
||||||
@@ -6464,9 +6464,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@types/node": {
|
"@types/node": {
|
||||||
"version": "22.9.0",
|
"version": "22.9.1",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.9.0.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.9.1.tgz",
|
||||||
"integrity": "sha512-vuyHg81vvWA1Z1ELfvLko2c8f34gyA0zaic0+Rllc5lbCnbSyuvb2Oxpm6TAUAC/2xZN3QGqxBNggD1nNR2AfQ==",
|
"integrity": "sha512-p8Yy/8sw1caA8CdRIQBG5tiLHmxtQKObCijiAa9Ez+d4+PRffM4054xbju0msf+cvhJpnFEeNjxmVT/0ipktrg==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"undici-types": "~6.19.8"
|
"undici-types": "~6.19.8"
|
||||||
}
|
}
|
||||||
@@ -6528,9 +6528,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@vercel/ncc": {
|
"@vercel/ncc": {
|
||||||
"version": "0.38.2",
|
"version": "0.38.3",
|
||||||
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.38.2.tgz",
|
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.38.3.tgz",
|
||||||
"integrity": "sha512-3yel3jaxUg9pHBv4+KeC9qlbdZPug+UMtUOlhvpDYCMSgcNSrS2Hv1LoqMsOV7hf2lYscx+BESfJOIla1WsmMQ==",
|
"integrity": "sha512-rnK6hJBS6mwc+Bkab+PGPs9OiS0i/3kdTO+CkI8V0/VrW3vmz7O2Pxjw/owOlmo6PKEIxRSeZKv/kuL9itnpYA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"abort-controller": {
|
"abort-controller": {
|
||||||
|
|||||||
@@ -34,9 +34,9 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@biomejs/biome": "1.9.4",
|
"@biomejs/biome": "1.9.4",
|
||||||
"@types/node": "^22.9.0",
|
"@types/node": "^22.9.1",
|
||||||
"@types/semver": "^7.5.8",
|
"@types/semver": "^7.5.8",
|
||||||
"@vercel/ncc": "^0.38.2",
|
"@vercel/ncc": "^0.38.3",
|
||||||
"jest": "^29.7.0",
|
"jest": "^29.7.0",
|
||||||
"js-yaml": "^4.1.0",
|
"js-yaml": "^4.1.0",
|
||||||
"ts-jest": "^29.2.5",
|
"ts-jest": "^29.2.5",
|
||||||
|
|||||||
9
src/cache/restore-cache.ts
vendored
9
src/cache/restore-cache.ts
vendored
@@ -1,5 +1,4 @@
|
|||||||
import * as cache from "@actions/cache";
|
import * as cache from "@actions/cache";
|
||||||
import * as glob from "@actions/glob";
|
|
||||||
import * as core from "@actions/core";
|
import * as core from "@actions/core";
|
||||||
import {
|
import {
|
||||||
cacheDependencyGlob,
|
cacheDependencyGlob,
|
||||||
@@ -7,6 +6,7 @@ import {
|
|||||||
cacheSuffix,
|
cacheSuffix,
|
||||||
} from "../utils/inputs";
|
} from "../utils/inputs";
|
||||||
import { getArch, getPlatform } from "../utils/platforms";
|
import { getArch, getPlatform } from "../utils/platforms";
|
||||||
|
import { hashFiles } from "../hash/hash-files";
|
||||||
|
|
||||||
export const STATE_CACHE_KEY = "cache-key";
|
export const STATE_CACHE_KEY = "cache-key";
|
||||||
export const STATE_CACHE_MATCHED_KEY = "cache-matched-key";
|
export const STATE_CACHE_MATCHED_KEY = "cache-matched-key";
|
||||||
@@ -39,12 +39,7 @@ async function computeKeys(version: string): Promise<string> {
|
|||||||
core.info(
|
core.info(
|
||||||
`Searching files using cache dependency glob: ${cacheDependencyGlob.split("\n").join(",")}`,
|
`Searching files using cache dependency glob: ${cacheDependencyGlob.split("\n").join(",")}`,
|
||||||
);
|
);
|
||||||
cacheDependencyPathHash += await glob.hashFiles(
|
cacheDependencyPathHash += await hashFiles(cacheDependencyGlob, true);
|
||||||
cacheDependencyGlob,
|
|
||||||
undefined,
|
|
||||||
undefined,
|
|
||||||
true,
|
|
||||||
);
|
|
||||||
if (cacheDependencyPathHash === "-") {
|
if (cacheDependencyPathHash === "-") {
|
||||||
throw new Error(
|
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 in ${process.cwd()} matched to [${cacheDependencyGlob.split("\n").join(",")}], make sure you have checked out the target repository`,
|
||||||
|
|||||||
@@ -1,5 +1,77 @@
|
|||||||
// AUTOGENERATED_DO_NOT_EDIT
|
// AUTOGENERATED_DO_NOT_EDIT
|
||||||
export const KNOWN_CHECKSUMS: { [key: string]: string } = {
|
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":
|
"undefined-0.5.2":
|
||||||
"60465d87552cd6febfdee8c58176d699e00d5549f2d35db3261ec5a113996099",
|
"60465d87552cd6febfdee8c58176d699e00d5549f2d35db3261ec5a113996099",
|
||||||
"aarch64-apple-darwin-0.5.2":
|
"aarch64-apple-darwin-0.5.2":
|
||||||
|
|||||||
48
src/hash/hash-files.ts
Normal file
48
src/hash/hash-files.ts
Normal 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 "";
|
||||||
|
}
|
||||||
@@ -15,7 +15,7 @@ export const githubToken = core.getInput("github-token");
|
|||||||
function getToolBinDir(): string | undefined {
|
function getToolBinDir(): string | undefined {
|
||||||
const toolBinDirInput = core.getInput("tool-bin-dir");
|
const toolBinDirInput = core.getInput("tool-bin-dir");
|
||||||
if (toolBinDirInput !== "") {
|
if (toolBinDirInput !== "") {
|
||||||
return toolBinDirInput;
|
return expandTilde(toolBinDirInput);
|
||||||
}
|
}
|
||||||
if (process.platform === "win32") {
|
if (process.platform === "win32") {
|
||||||
if (process.env.RUNNER_TEMP !== undefined) {
|
if (process.env.RUNNER_TEMP !== undefined) {
|
||||||
@@ -31,7 +31,7 @@ function getToolBinDir(): string | undefined {
|
|||||||
function getToolDir(): string | undefined {
|
function getToolDir(): string | undefined {
|
||||||
const toolDirInput = core.getInput("tool-dir");
|
const toolDirInput = core.getInput("tool-dir");
|
||||||
if (toolDirInput !== "") {
|
if (toolDirInput !== "") {
|
||||||
return toolDirInput;
|
return expandTilde(toolDirInput);
|
||||||
}
|
}
|
||||||
if (process.platform === "win32") {
|
if (process.platform === "win32") {
|
||||||
if (process.env.RUNNER_TEMP !== undefined) {
|
if (process.env.RUNNER_TEMP !== undefined) {
|
||||||
@@ -47,7 +47,7 @@ function getToolDir(): string | undefined {
|
|||||||
function getCacheLocalPath(): string {
|
function getCacheLocalPath(): string {
|
||||||
const cacheLocalPathInput = core.getInput("cache-local-path");
|
const cacheLocalPathInput = core.getInput("cache-local-path");
|
||||||
if (cacheLocalPathInput !== "") {
|
if (cacheLocalPathInput !== "") {
|
||||||
return cacheLocalPathInput;
|
return expandTilde(cacheLocalPathInput);
|
||||||
}
|
}
|
||||||
if (process.env.RUNNER_TEMP !== undefined) {
|
if (process.env.RUNNER_TEMP !== undefined) {
|
||||||
return `${process.env.RUNNER_TEMP}${path.sep}setup-uv-cache`;
|
return `${process.env.RUNNER_TEMP}${path.sep}setup-uv-cache`;
|
||||||
@@ -56,3 +56,10 @@ function getCacheLocalPath(): string {
|
|||||||
"Could not determine UV_CACHE_DIR. Please make sure RUNNER_TEMP is set or provide the cache-local-path input",
|
"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;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user