Compare commits

...

6 Commits

Author SHA1 Message Date
Luc Perkins a474366708 Use gitignore for Biome ignoring 2025-06-05 14:52:33 -07:00
Luc Perkins 1803d0211a Use ubuntu-latest 2025-06-02 13:10:44 -07:00
Luc Perkins 5f11b96c1b Add test step to CI workflow 2025-06-02 13:01:56 -07:00
Luc Perkins 526dc45652 Add test step to script 2025-06-02 13:01:05 -07:00
Luc Perkins 4d4228670a Fix merge conflicts with main 2025-06-02 13:00:44 -07:00
Luc Perkins 7ace8b67c6 Switch to Biome JS 2025-05-30 10:49:24 -07:00
18 changed files with 2544 additions and 6416 deletions
-74
View File
@@ -1,74 +0,0 @@
{
"plugins": ["@typescript-eslint"],
"extends": ["plugin:github/recommended"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 9,
"sourceType": "module",
"project": "./tsconfig.json"
},
"settings": {
"import/resolver": {
"typescript": {}
}
},
"rules": {
"i18n-text/no-en": "off",
"eslint-comments/no-use": "off",
"import/no-namespace": "off",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{
"argsIgnorePattern": "^_"
}
],
"@typescript-eslint/explicit-member-accessibility": [
"error",
{
"accessibility": "no-public"
}
],
"@typescript-eslint/no-base-to-string": "error",
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/array-type": "error",
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/ban-ts-comment": "error",
"camelcase": "error",
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/explicit-function-return-type": [
"error",
{
"allowExpressions": true
}
],
"@typescript-eslint/func-call-spacing": ["error", "never"],
"@typescript-eslint/no-array-constructor": "error",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/no-extraneous-class": "error",
"@typescript-eslint/no-for-in-array": "error",
"@typescript-eslint/no-inferrable-types": "error",
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-namespace": "error",
"@typescript-eslint/no-non-null-assertion": "warn",
"@typescript-eslint/no-unnecessary-qualifier": "error",
"@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/no-useless-constructor": "error",
"@typescript-eslint/no-var-requires": "error",
"@typescript-eslint/prefer-for-of": "warn",
"@typescript-eslint/prefer-function-type": "warn",
"@typescript-eslint/prefer-includes": "error",
"@typescript-eslint/prefer-string-starts-ends-with": "error",
"@typescript-eslint/promise-function-async": "error",
"@typescript-eslint/require-array-sort-compare": "error",
"@typescript-eslint/restrict-plus-operands": "error",
"@typescript-eslint/type-annotation-spacing": "error",
"@typescript-eslint/unbound-method": "error"
},
"env": {
"node": true,
"es6": true
}
}
+8 -6
View File
@@ -8,7 +8,7 @@ on:
jobs:
tests:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
needs:
- check-dist-up-to-date
- install-nix
@@ -24,17 +24,19 @@ jobs:
check-dist-up-to-date:
name: Check the dist/ folder is up to date
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/flakehub-cache-action@main
- name: pnpm install
run: nix develop --command pnpm install
- name: prettier format
- name: Check formatting
run: nix develop --command pnpm run check-fmt
- name: ESLint
- name: Link
run: nix develop --command pnpm run lint
- name: Test
run: nix develop --command pnpm run test
- name: tsup build
run: nix develop --command pnpm run build
- name: ncc package
@@ -146,7 +148,7 @@ jobs:
install-with-non-default-source-inputs:
name: Install Nix using non-default source-${{ matrix.inputs.key }}
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
strategy:
matrix:
inputs:
@@ -171,7 +173,7 @@ jobs:
install-no-id-token:
name: Install Nix without an ID token
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./
-3
View File
@@ -53,9 +53,6 @@ typings/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
-3
View File
@@ -1,3 +0,0 @@
dist/
lib/
node_modules/
-1
View File
@@ -1 +0,0 @@
{}
+148
View File
@@ -0,0 +1,148 @@
{
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
"vcs": { "enabled": true, "clientKind": "git", "useIgnoreFile": true },
"files": {
"ignoreUnknown": false,
"ignore": ["dist"]
},
"formatter": {
"enabled": true,
"useEditorconfig": true,
"formatWithErrors": false,
"indentStyle": "space",
"indentWidth": 2,
"lineEnding": "lf",
"lineWidth": 80,
"attributePosition": "auto",
"bracketSpacing": true
},
"organizeImports": { "enabled": true },
"linter": {
"enabled": true,
"rules": {
"recommended": false,
"complexity": {
"noExtraBooleanCast": "error",
"noMultipleSpacesInRegularExpressionLiterals": "error",
"noStaticOnlyClass": "error",
"noUselessConstructor": "error",
"noUselessStringConcat": "error",
"noUselessTypeConstraint": "error"
},
"correctness": {
"noConstAssign": "error",
"noConstantCondition": "error",
"noEmptyCharacterClassInRegex": "error",
"noEmptyPattern": "error",
"noGlobalObjectCalls": "error",
"noInnerDeclarations": "error",
"noInvalidConstructorSuper": "error",
"noNewSymbol": "error",
"noSelfAssign": "error",
"noSwitchDeclarations": "error",
"noUndeclaredVariables": "error",
"noUnreachable": "error",
"noUnreachableSuper": "error",
"noUnsafeFinally": "error",
"noUnusedLabels": "error",
"noUnusedVariables": "error",
"useArrayLiterals": "off",
"useIsNan": "error",
"useYield": "error"
},
"style": {
"noArguments": "error",
"noCommaOperator": "error",
"noInferrableTypes": "error",
"noNamespace": "error",
"noNonNullAssertion": "warn",
"noVar": "error",
"useAsConstAssertion": "error",
"useConsistentArrayType": "error",
"useConst": "error",
"useForOf": "warn",
"useShorthandFunctionType": "warn",
"useSingleVarDeclarator": "error",
"useTemplate": "error"
},
"suspicious": {
"noCatchAssign": "error",
"noClassAssign": "error",
"noCompareNegZero": "error",
"noConsole": "error",
"noControlCharactersInRegex": "error",
"noDebugger": "error",
"noDoubleEquals": "error",
"noDuplicateCase": "error",
"noDuplicateClassMembers": "error",
"noDuplicateObjectKeys": "error",
"noDuplicateParameters": "error",
"noEmptyBlockStatements": "error",
"noExplicitAny": "error",
"noExtraNonNullAssertion": "error",
"noFallthroughSwitchClause": "error",
"noFunctionAssign": "error",
"noGlobalAssign": "error",
"noMisleadingInstantiator": "error",
"noRedeclare": "error",
"noSparseArray": "error",
"noUnsafeDeclarationMerging": "error",
"noUnsafeNegation": "error",
"useNamespaceKeyword": "error",
"useValidTypeof": "error"
}
}
},
"javascript": {
"formatter": {
"jsxQuoteStyle": "double",
"quoteProperties": "asNeeded",
"trailingCommas": "all",
"semicolons": "always",
"arrowParentheses": "always",
"bracketSameLine": false,
"quoteStyle": "double",
"attributePosition": "auto",
"bracketSpacing": true
},
"globals": ["exports"]
},
"overrides": [
{
"include": ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"],
"linter": {
"rules": {
"complexity": { "noWith": "off" },
"correctness": {
"noConstAssign": "off",
"noGlobalObjectCalls": "off",
"noInvalidBuiltinInstantiation": "off",
"noInvalidConstructorSuper": "off",
"noNewSymbol": "off",
"noSetterReturn": "off",
"noUndeclaredVariables": "off",
"noUnreachable": "off",
"noUnreachableSuper": "off"
},
"style": {
"noArguments": "error",
"noVar": "error",
"useConst": "error",
"useNamingConvention": "error"
},
"suspicious": {
"noClassAssign": "off",
"noDuplicateClassMembers": "off",
"noDuplicateObjectKeys": "off",
"noDuplicateParameters": "off",
"noFunctionAssign": "off",
"noImportAssign": "off",
"noRedeclare": "off",
"noUnsafeNegation": "off",
"useGetterReturn": "off"
}
}
}
}
]
}
Generated Vendored
+227 -369
View File
@@ -42755,7 +42755,7 @@ exports.colors = [6, 2, 3, 4, 5, 1];
try {
// Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
// eslint-disable-next-line import/no-extraneous-dependencies
const supportsColor = __nccwpck_require__(1953);
const supportsColor = __nccwpck_require__(5545);
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
exports.colors = [
@@ -43135,21 +43135,6 @@ class Deprecation extends Error {
exports.Deprecation = Deprecation;
/***/ }),
/***/ 1330:
/***/ ((module) => {
module.exports = (flag, argv = process.argv) => {
const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
const position = argv.indexOf(prefix + flag);
const terminatorPosition = argv.indexOf('--');
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
};
/***/ }),
/***/ 6644:
@@ -45941,7 +45926,7 @@ const auto = __nccwpck_require__(2342);
const {
HttpOverHttp2,
HttpsOverHttp2
} = __nccwpck_require__(449);
} = __nccwpck_require__(2830);
const Http2OverHttp2 = __nccwpck_require__(2016);
const {
Http2OverHttp,
@@ -46007,7 +45992,7 @@ module.exports = self => {
/***/ }),
/***/ 449:
/***/ 2830:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
@@ -50360,148 +50345,6 @@ function coerce (version, options) {
}
/***/ }),
/***/ 1953:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
const os = __nccwpck_require__(857);
const tty = __nccwpck_require__(2018);
const hasFlag = __nccwpck_require__(1330);
const {env} = process;
let forceColor;
if (hasFlag('no-color') ||
hasFlag('no-colors') ||
hasFlag('color=false') ||
hasFlag('color=never')) {
forceColor = 0;
} else if (hasFlag('color') ||
hasFlag('colors') ||
hasFlag('color=true') ||
hasFlag('color=always')) {
forceColor = 1;
}
if ('FORCE_COLOR' in env) {
if (env.FORCE_COLOR === 'true') {
forceColor = 1;
} else if (env.FORCE_COLOR === 'false') {
forceColor = 0;
} else {
forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
}
}
function translateLevel(level) {
if (level === 0) {
return false;
}
return {
level,
hasBasic: true,
has256: level >= 2,
has16m: level >= 3
};
}
function supportsColor(haveStream, streamIsTTY) {
if (forceColor === 0) {
return 0;
}
if (hasFlag('color=16m') ||
hasFlag('color=full') ||
hasFlag('color=truecolor')) {
return 3;
}
if (hasFlag('color=256')) {
return 2;
}
if (haveStream && !streamIsTTY && forceColor === undefined) {
return 0;
}
const min = forceColor || 0;
if (env.TERM === 'dumb') {
return min;
}
if (process.platform === 'win32') {
// Windows 10 build 10586 is the first Windows release that supports 256 colors.
// Windows 10 build 14931 is the first release that supports 16m/TrueColor.
const osRelease = os.release().split('.');
if (
Number(osRelease[0]) >= 10 &&
Number(osRelease[2]) >= 10586
) {
return Number(osRelease[2]) >= 14931 ? 3 : 2;
}
return 1;
}
if ('CI' in env) {
if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
return 1;
}
return min;
}
if ('TEAMCITY_VERSION' in env) {
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
}
if (env.COLORTERM === 'truecolor') {
return 3;
}
if ('TERM_PROGRAM' in env) {
const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
switch (env.TERM_PROGRAM) {
case 'iTerm.app':
return version >= 3 ? 3 : 2;
case 'Apple_Terminal':
return 2;
// No default
}
}
if (/-256(color)?$/i.test(env.TERM)) {
return 2;
}
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
return 1;
}
if ('COLORTERM' in env) {
return 1;
}
return min;
}
function getSupportLevel(stream) {
const level = supportsColor(stream, stream && stream.isTTY);
return translateLevel(level);
}
module.exports = {
supportsColor: getSupportLevel,
stdout: translateLevel(supportsColor(true, tty.isatty(1))),
stderr: translateLevel(supportsColor(true, tty.isatty(2)))
};
/***/ }),
/***/ 1577:
@@ -73400,6 +73243,14 @@ function wrappy (fn, cb) {
}
/***/ }),
/***/ 5545:
/***/ ((module) => {
module.exports = eval("require")("supports-color");
/***/ }),
/***/ 2613:
@@ -86650,69 +86501,36 @@ module.exports = /*#__PURE__*/JSON.parse('{"name":"@actions/cache","version":"4.
/************************************************************************/
var __webpack_exports__ = {};
// EXTERNAL MODULE: external "child_process"
var external_child_process_ = __nccwpck_require__(5317);
// EXTERNAL MODULE: external "fs"
var external_fs_ = __nccwpck_require__(9896);
;// CONCATENATED MODULE: external "fs/promises"
const promises_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("fs/promises");
// EXTERNAL MODULE: external "os"
var external_os_ = __nccwpck_require__(857);
// EXTERNAL MODULE: external "path"
var external_path_ = __nccwpck_require__(6928);
;// CONCATENATED MODULE: external "timers/promises"
const external_timers_promises_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("timers/promises");
// EXTERNAL MODULE: ./node_modules/.pnpm/@actions+core@1.11.1/node_modules/@actions/core/lib/core.js
var core = __nccwpck_require__(9999);
// EXTERNAL MODULE: ./node_modules/.pnpm/@actions+exec@1.1.1/node_modules/@actions/exec/lib/exec.js
var exec = __nccwpck_require__(8872);
// EXTERNAL MODULE: ./node_modules/.pnpm/@actions+github@6.0.1/node_modules/@actions/github/lib/github.js
var github = __nccwpck_require__(5380);
;// CONCATENATED MODULE: external "fs/promises"
const promises_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("fs/promises");
// EXTERNAL MODULE: external "path"
var external_path_ = __nccwpck_require__(6928);
// EXTERNAL MODULE: external "fs"
var external_fs_ = __nccwpck_require__(9896);
// EXTERNAL MODULE: external "os"
var external_os_ = __nccwpck_require__(857);
;// CONCATENATED MODULE: ./node_modules/.pnpm/string-argv@0.3.2/node_modules/string-argv/index.js
function parseArgsStringToArgv(value, env, file) {
// ([^\s'"]([^\s'"]*(['"])([^\3]*?)\3)+[^\s'"]*) Matches nested quotes until the first space outside of quotes
// [^\s'"]+ or Match if not a space ' or "
// (['"])([^\5]*?)\5 or Match "quoted text" without quotes
// `\3` and `\5` are a backreference to the quote style (' or ") captured
var myRegexp = /([^\s'"]([^\s'"]*(['"])([^\3]*?)\3)+[^\s'"]*)|[^\s'"]+|(['"])([^\5]*?)\5/gi;
var myString = value;
var myArray = [];
if (env) {
myArray.push(env);
}
if (file) {
myArray.push(file);
}
var match;
do {
// Each call to exec returns the next regex match as an array
match = myRegexp.exec(myString);
if (match !== null) {
// Index 1 in the array is the captured group if it exists
// Index 0 is the matched text, which we use if no captured group exists
myArray.push(firstString(match[1], match[6], match[0]));
}
} while (match !== null);
return myArray;
}
// Accepts any number of arguments, and returns the first one that is a string
// (even an empty string)
function firstString() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
for (var i = 0; i < args.length; i++) {
var arg = args[i];
if (typeof arg === "string") {
return arg;
}
}
}
// EXTERNAL MODULE: external "util"
var external_util_ = __nccwpck_require__(9023);
// EXTERNAL MODULE: external "zlib"
var external_zlib_ = __nccwpck_require__(3106);
// EXTERNAL MODULE: external "crypto"
var external_crypto_ = __nccwpck_require__(6982);
;// CONCATENATED MODULE: external "node:fs"
const external_node_fs_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:fs");
// EXTERNAL MODULE: external "node:os"
var external_node_os_ = __nccwpck_require__(8161);
// EXTERNAL MODULE: external "node:util"
var external_node_util_ = __nccwpck_require__(7975);
;// CONCATENATED MODULE: external "node:fs/promises"
const external_node_fs_promises_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:fs/promises");
// EXTERNAL MODULE: external "node:zlib"
var external_node_zlib_ = __nccwpck_require__(8522);
// EXTERNAL MODULE: external "node:crypto"
var external_node_crypto_ = __nccwpck_require__(7598);
;// CONCATENATED MODULE: external "node:timers/promises"
const external_node_timers_promises_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:timers/promises");
;// CONCATENATED MODULE: ./node_modules/.pnpm/@sindresorhus+is@7.0.1/node_modules/@sindresorhus/is/distribution/index.js
@@ -88291,6 +88109,8 @@ var external_node_stream_ = __nccwpck_require__(7075);
var external_node_http_ = __nccwpck_require__(7067);
// EXTERNAL MODULE: external "events"
var external_events_ = __nccwpck_require__(4434);
// EXTERNAL MODULE: external "util"
var external_util_ = __nccwpck_require__(9023);
// EXTERNAL MODULE: ./node_modules/.pnpm/defer-to-connect@2.0.1/node_modules/defer-to-connect/dist/source/index.js
var source = __nccwpck_require__(7596);
;// CONCATENATED MODULE: ./node_modules/.pnpm/@szmarczak+http-timer@5.0.1/node_modules/@szmarczak/http-timer/dist/source/index.js
@@ -88403,8 +88223,6 @@ const timer = (request) => {
;// CONCATENATED MODULE: external "node:url"
const external_node_url_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:url");
// EXTERNAL MODULE: external "node:crypto"
var external_node_crypto_ = __nccwpck_require__(7598);
;// CONCATENATED MODULE: ./node_modules/.pnpm/normalize-url@8.0.1/node_modules/normalize-url/index.js
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs
const DATA_URL_DEFAULT_MIME_TYPE = 'text/plain';
@@ -89927,8 +89745,6 @@ getContentLength_fn = function() {
};
// EXTERNAL MODULE: external "node:util"
var external_node_util_ = __nccwpck_require__(7975);
;// CONCATENATED MODULE: ./node_modules/.pnpm/got@14.4.7/node_modules/got/dist/source/core/utils/is-form-data.js
function is_form_data_isFormData(body) {
@@ -90230,8 +90046,6 @@ const external_node_tls_namespaceObject = __WEBPACK_EXTERNAL_createRequire(impor
var external_node_https_ = __nccwpck_require__(4708);
;// CONCATENATED MODULE: external "node:dns"
const external_node_dns_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:dns");
// EXTERNAL MODULE: external "node:os"
var external_node_os_ = __nccwpck_require__(8161);
;// CONCATENATED MODULE: ./node_modules/.pnpm/cacheable-lookup@7.0.0/node_modules/cacheable-lookup/source/index.js
@@ -93806,13 +93620,15 @@ const got = source_create(defaults);
;// CONCATENATED MODULE: external "dns/promises"
const external_dns_promises_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("dns/promises");
;// CONCATENATED MODULE: external "node:dns/promises"
const external_node_dns_promises_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:dns/promises");
// EXTERNAL MODULE: ./node_modules/.pnpm/@actions+cache@4.0.3/node_modules/@actions/cache/lib/cache.js
var cache = __nccwpck_require__(7389);
// EXTERNAL MODULE: external "child_process"
var external_child_process_ = __nccwpck_require__(5317);
;// CONCATENATED MODULE: ./node_modules/.pnpm/github.com+DeterminateSystems+detsys-ts@4bf247b1cb6b057abe94721ea1bfa131618e2b7f_qygv7jy5hm2oenc72q37xutlhi/node_modules/detsys-ts/dist/index.js
;// CONCATENATED MODULE: external "node:child_process"
const external_node_child_process_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:child_process");
;// CONCATENATED MODULE: external "node:path"
const external_node_path_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:path");
;// CONCATENATED MODULE: ./node_modules/.pnpm/detsys-ts@https+++codeload.github.com+DeterminateSystems+detsys-ts+tar.gz+74999c82de35e_a754901a6826e5fd30cb4252e10d4dc7/node_modules/detsys-ts/dist/index.js
var __defProp = Object.defineProperty;
var __export = (target, all) => {
for (var name in all)
@@ -93823,7 +93639,7 @@ var __export = (target, all) => {
var readFileAsync = (0,external_util_.promisify)(external_fs_.readFile);
var readFileAsync = (0,external_node_util_.promisify)(external_node_fs_namespaceObject.readFile);
var linuxReleaseInfoOptionsDefaults = {
mode: "async",
customFile: null,
@@ -93834,7 +93650,7 @@ function releaseInfo(infoOptions) {
const searchOsReleaseFileList = osReleaseFileList(
options.customFile
);
if (external_os_.type() !== "Linux") {
if (external_node_os_.type() !== "Linux") {
if (options.mode === "sync") {
return getOsInfo();
} else {
@@ -93875,11 +93691,11 @@ function osReleaseFileList(customFile) {
}
function getOsInfo() {
return {
type: external_os_.type(),
platform: external_os_.platform(),
hostname: external_os_.hostname(),
arch: external_os_.arch(),
release: external_os_.release()
type: external_node_os_.type(),
platform: external_node_os_.platform(),
hostname: external_node_os_.hostname(),
arch: external_node_os_.arch(),
release: external_node_os_.release()
};
}
async function readAsyncOsReleaseFile(fileList, options) {
@@ -93913,7 +93729,7 @@ function readSyncOsreleaseFile(releaseFileList, options) {
if (options.debug) {
console.log(`Trying to read '${osReleaseFile}'...`);
}
fileData = external_fs_.readFileSync(osReleaseFile, "binary");
fileData = external_node_fs_namespaceObject.readFileSync(osReleaseFile, "binary");
if (options.debug) {
console.log(`Read data:
${fileData}`);
@@ -94097,7 +93913,7 @@ async function collectBacktracesMacOS(prefixes, programNameDenyList, startTimest
["user", `${process.env["HOME"]}/Library/Logs/DiagnosticReports/`]
];
for (const [source, dir] of dirs) {
const fileNames = (await (0,promises_namespaceObject.readdir)(dir)).filter((fileName) => {
const fileNames = (await (0,external_node_fs_promises_namespaceObject.readdir)(dir)).filter((fileName) => {
return prefixes.some((prefix) => fileName.startsWith(prefix));
}).filter((fileName) => {
return !programNameDenyList.some(
@@ -94106,11 +93922,11 @@ async function collectBacktracesMacOS(prefixes, programNameDenyList, startTimest
}).filter((fileName) => {
return !fileName.endsWith(".diag");
});
const doGzip = (0,external_util_.promisify)(external_zlib_.gzip);
const doGzip = (0,external_node_util_.promisify)(external_node_zlib_.gzip);
for (const fileName of fileNames) {
try {
if ((await (0,promises_namespaceObject.stat)(`${dir}/${fileName}`)).ctimeMs >= startTimestampMs) {
const logText = await (0,promises_namespaceObject.readFile)(`${dir}/${fileName}`);
if ((await (0,external_node_fs_promises_namespaceObject.stat)(`${dir}/${fileName}`)).ctimeMs >= startTimestampMs) {
const logText = await (0,external_node_fs_promises_namespaceObject.readFile)(`${dir}/${fileName}`);
const buf = await doGzip(logText);
backtraces.set(
`backtrace_value_${source}_${fileName}`,
@@ -94172,7 +93988,7 @@ async function collectBacktracesSystemd(prefixes, programNameDenyList, startTime
);
return backtraces;
}
const doGzip = (0,external_util_.promisify)(external_zlib_.gzip);
const doGzip = (0,external_node_util_.promisify)(external_node_zlib_.gzip);
for (const coredump of coredumps) {
try {
const { stdout: logText } = await exec.getExecOutput(
@@ -94263,7 +94079,7 @@ function identify(projectName) {
return ident;
}
function hashEnvironmentVariables(prefix, variables) {
const hash = (0,external_crypto_.createHash)("sha256");
const hash = (0,external_node_crypto_.createHash)("sha256");
for (const varName of variables) {
let value = process.env[varName];
if (value === void 0) {
@@ -94444,7 +94260,7 @@ function recordToUrl(record) {
}
}
async function discoverServiceRecords() {
return await discoverServicesStub((0,external_dns_promises_namespaceObject.resolveSrv)(LOOKUP), 1e3);
return await discoverServicesStub((0,external_node_dns_promises_namespaceObject.resolveSrv)(LOOKUP), 1e3);
}
async function discoverServicesStub(lookup, timeout) {
const defaultFallback = new Promise(
@@ -94832,8 +94648,8 @@ var DetSysAction = class {
});
}
getTemporaryName() {
const tmpDir = process.env["RUNNER_TEMP"] || (0,external_os_.tmpdir)();
return external_path_.join(tmpDir, `${this.actionOptions.name}-${(0,external_crypto_.randomUUID)()}`);
const tmpDir = process.env["RUNNER_TEMP"] || (0,external_node_os_.tmpdir)();
return external_node_path_namespaceObject.join(tmpDir, `${this.actionOptions.name}-${(0,external_node_crypto_.randomUUID)()}`);
}
addFact(key, value) {
this.facts[key] = value;
@@ -94842,13 +94658,13 @@ var DetSysAction = class {
return await this.idsHost.getDiagnosticsUrl();
}
getUniqueId() {
return this.identity.run_differentiator || process.env.RUNNER_TRACKING_ID || (0,external_crypto_.randomUUID)();
return this.identity.run_differentiator || process.env.RUNNER_TRACKING_ID || (0,external_node_crypto_.randomUUID)();
}
// This ID will be saved in the action's state, to be persisted across phase steps
getCrossPhaseId() {
let crossPhaseId = core.getState(STATE_KEY_CROSS_PHASE_ID);
if (crossPhaseId === "") {
crossPhaseId = (0,external_crypto_.randomUUID)();
crossPhaseId = (0,external_node_crypto_.randomUUID)();
core.saveState(STATE_KEY_CROSS_PHASE_ID, crossPhaseId);
}
return crossPhaseId;
@@ -94865,7 +94681,7 @@ var DetSysAction = class {
facts: this.facts,
features: this.featureEventMetadata,
timestamp: /* @__PURE__ */ new Date(),
uuid: (0,external_crypto_.randomUUID)()
uuid: (0,external_node_crypto_.randomUUID)()
});
}
/**
@@ -94875,10 +94691,10 @@ var DetSysAction = class {
*/
async unpackClosure(bin) {
const artifact = await this.fetchArtifact();
const { stdout } = await (0,external_util_.promisify)(external_child_process_.exec)(
const { stdout } = await (0,external_node_util_.promisify)(external_node_child_process_namespaceObject.exec)(
`cat "${artifact}" | xz -d | nix-store --import`
);
const paths = stdout.split(external_os_.EOL);
const paths = stdout.split(external_node_os_.EOL);
const lastPath = paths.at(-2);
return `${lastPath}/bin/${bin}`;
}
@@ -94888,7 +94704,7 @@ var DetSysAction = class {
*/
async fetchExecutable() {
const binaryPath = await this.fetchArtifact();
await (0,promises_namespaceObject.chmod)(binaryPath, promises_namespaceObject.constants.S_IXUSR | promises_namespaceObject.constants.S_IXGRP);
await (0,external_node_fs_promises_namespaceObject.chmod)(binaryPath, external_node_fs_promises_namespaceObject.constants.S_IXUSR | external_node_fs_promises_namespaceObject.constants.S_IXGRP);
return binaryPath;
}
get isMain() {
@@ -94925,11 +94741,11 @@ var DetSysAction = class {
} else {
core.setFailed(reportable);
}
const doGzip = (0,external_util_.promisify)(external_zlib_.gzip);
const doGzip = (0,external_node_util_.promisify)(external_node_zlib_.gzip);
const exceptionContext = /* @__PURE__ */ new Map();
for (const [attachmentLabel, filePath] of this.exceptionAttachments) {
try {
const logText = (0,external_fs_.readFileSync)(filePath);
const logText = (0,external_node_fs_namespaceObject.readFileSync)(filePath);
const buf = await doGzip(logText);
exceptionContext.set(
`staple_value_${attachmentLabel}`,
@@ -95145,7 +94961,7 @@ var DetSysAction = class {
if (writeStream) {
writeStream.destroy();
}
writeStream = (0,external_fs_.createWriteStream)(destination, {
writeStream = (0,external_node_fs_namespaceObject.createWriteStream)(destination, {
encoding: "binary",
mode: 493
});
@@ -95209,7 +95025,7 @@ var DetSysAction = class {
const startCwd = process.cwd();
try {
const tempDir = this.getTemporaryName();
await (0,promises_namespaceObject.mkdir)(tempDir);
await (0,external_node_fs_promises_namespaceObject.mkdir)(tempDir);
process.chdir(tempDir);
process.env.GITHUB_WORKSPACE_BACKUP = process.env.GITHUB_WORKSPACE;
delete process.env.GITHUB_WORKSPACE;
@@ -95235,9 +95051,9 @@ var DetSysAction = class {
const startCwd = process.cwd();
try {
const tempDir = this.getTemporaryName();
await (0,promises_namespaceObject.mkdir)(tempDir);
await (0,external_node_fs_promises_namespaceObject.mkdir)(tempDir);
process.chdir(tempDir);
await (0,promises_namespaceObject.copyFile)(toolPath, `${tempDir}/${this.actionOptions.name}`);
await (0,external_node_fs_promises_namespaceObject.copyFile)(toolPath, `${tempDir}/${this.actionOptions.name}`);
process.env.GITHUB_WORKSPACE_BACKUP = process.env.GITHUB_WORKSPACE;
delete process.env.GITHUB_WORKSPACE;
await cache.saveCache(
@@ -95286,9 +95102,9 @@ var DetSysAction = class {
let nixLocation;
const pathParts = (process.env["PATH"] || "").split(":");
for (const location of pathParts) {
const candidateNix = external_path_.join(location, "nix");
const candidateNix = external_node_path_namespaceObject.join(location, "nix");
try {
await promises_namespaceObject.access(candidateNix, promises_namespaceObject.constants.X_OK);
await external_node_fs_promises_namespaceObject.access(candidateNix, external_node_fs_promises_namespaceObject.constants.X_OK);
core.debug(`Found Nix at ${candidateNix}`);
nixLocation = candidateNix;
break;
@@ -95433,8 +95249,49 @@ function makeOptionsConfident(actionOptions) {
* Copyright (c) 2018-2020 [Samuel Carreira]
*/
//# sourceMappingURL=index.js.map
;// CONCATENATED MODULE: external "timers/promises"
const external_timers_promises_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("timers/promises");
;// CONCATENATED MODULE: ./node_modules/.pnpm/string-argv@0.3.2/node_modules/string-argv/index.js
function parseArgsStringToArgv(value, env, file) {
// ([^\s'"]([^\s'"]*(['"])([^\3]*?)\3)+[^\s'"]*) Matches nested quotes until the first space outside of quotes
// [^\s'"]+ or Match if not a space ' or "
// (['"])([^\5]*?)\5 or Match "quoted text" without quotes
// `\3` and `\5` are a backreference to the quote style (' or ") captured
var myRegexp = /([^\s'"]([^\s'"]*(['"])([^\3]*?)\3)+[^\s'"]*)|[^\s'"]+|(['"])([^\5]*?)\5/gi;
var myString = value;
var myArray = [];
if (env) {
myArray.push(env);
}
if (file) {
myArray.push(file);
}
var match;
do {
// Each call to exec returns the next regex match as an array
match = myRegexp.exec(myString);
if (match !== null) {
// Index 1 in the array is the captured group if it exists
// Index 0 is the matched text, which we use if no captured group exists
myArray.push(firstString(match[1], match[6], match[0]));
}
} while (match !== null);
return myArray;
}
// Accepts any number of arguments, and returns the first one that is a string
// (even an empty string)
function firstString() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
for (var i = 0; i < args.length; i++) {
var arg = args[i];
if (typeof arg === "string") {
return arg;
}
}
}
;// CONCATENATED MODULE: ./dist/index.js
// src/index.ts
@@ -95450,22 +95307,6 @@ const external_timers_promises_namespaceObject = __WEBPACK_EXTERNAL_createRequir
// src/fixHashes.ts
async function getFixHashes(since) {
const output = await (0,exec.getExecOutput)(
"determinate-nixd",
["fix", "hashes", "--json", "--since", since],
{ silent: true }
);
if (output.exitCode !== 0) {
throw new Error(
`determinate-nixd fix hashes returned non-zero exit code ${output.exitCode} with the following error output:
${output.stderr}`
);
}
return JSON.parse(output.stdout);
}
// src/annotate.ts
@@ -95557,84 +95398,6 @@ async function getRecentEvents(since) {
return parseEvents(resp);
}
// src/util.ts
function truncateDerivation(drv) {
return drv.replace(/^\/nix\/store\/[a-z0-9]+-/, "").replace(/\.drv$/, "");
}
// src/mermaid.ts
function makeMermaidReport(events) {
const maxLength = 49900;
let mermaid = "";
let pruneLevel = -2;
do {
pruneLevel += 1;
mermaid = mermaidify(events, pruneLevel) ?? "";
} while (mermaid.length > maxLength);
if (!mermaid) {
return void 0;
}
const lines = [
"<details open><summary><strong>Build timeline</strong> :hourglass_flowing_sand:</summary>",
"",
// load bearing whitespace, deleting it breaks the details expander / markdown
mermaid,
""
// load bearing whitespace, deleting it breaks the details expander / markdown
];
if (pruneLevel === 0) {
lines.push("> [!NOTE]");
lines.push(
"> `/nix/store/[hash]` and the `.drv` suffixes have been removed to make the graph small enough to render."
);
} else if (pruneLevel > 0) {
lines.push("> [!NOTE]");
lines.push(
`> \`/nix/store/[hash]\`, the \`.drv\` suffix, and builds that took less than ${formatDuration(pruneLevel)} have been removed to make the graph small enough to render.`
);
}
lines.push("");
lines.push("</details>");
return lines.join("\n");
}
function mermaidify(allEvents, pruneLevel) {
const events = allEvents.filter(
(event) => event.c === "BuiltPathResponseEventV1" || event.c === "BuildFailureResponseEventV1"
).sort(
(a, b) => a.timing.startTime.getTime() - b.timing.startTime.getTime()
);
const firstEvent = events.at(0);
if (firstEvent === void 0) {
return void 0;
}
const zeroMoment = firstEvent.timing.startTime.getTime();
const lines = [
"```mermaid",
"gantt",
" dateFormat X",
" axisFormat %Mm%Ss"
];
for (const event of events) {
const duration = event.timing.durationSeconds;
if (duration < pruneLevel) {
continue;
}
const label = pruneLevel >= 0 ? truncateDerivation(event.drv) : event.drv;
const tag = event.c === "BuildFailureResponseEventV1" ? "crit" : "d";
const relativeStartTime = (event.timing.startTime.getTime() - zeroMoment) / 1e3;
lines.push(
`${label} (${formatDuration(duration)}):${tag}, ${relativeStartTime}, ${duration}s`
);
}
lines.push("```");
return lines.join("\n");
}
function formatDuration(duration) {
const durSeconds = duration % 60;
const durMinutes = (duration - durSeconds) / 60;
return `${durMinutes > 0 ? `${durMinutes}m` : ""}${durSeconds}s`;
}
// src/failuresummary.ts
@@ -95723,8 +95486,102 @@ async function getLogFromNix(drv) {
return output.stdout;
}
// src/index.ts
// src/fixHashes.ts
async function getFixHashes(since) {
const output = await (0,exec.getExecOutput)(
"determinate-nixd",
["fix", "hashes", "--json", "--since", since],
{ silent: true }
);
if (output.exitCode !== 0) {
throw new Error(
`determinate-nixd fix hashes returned non-zero exit code ${output.exitCode} with the following error output:
${output.stderr}`
);
}
return JSON.parse(output.stdout);
}
// src/util.ts
function truncateDerivation(drv) {
return drv.replace(/^\/nix\/store\/[a-z0-9]+-/, "").replace(/\.drv$/, "");
}
// src/mermaid.ts
function makeMermaidReport(events) {
const maxLength = 49900;
let mermaid = "";
let pruneLevel = -2;
do {
pruneLevel += 1;
mermaid = mermaidify(events, pruneLevel) ?? "";
} while (mermaid.length > maxLength);
if (!mermaid) {
return void 0;
}
const lines = [
"<details open><summary><strong>Build timeline</strong> :hourglass_flowing_sand:</summary>",
"",
// load bearing whitespace, deleting it breaks the details expander / markdown
mermaid,
""
// load bearing whitespace, deleting it breaks the details expander / markdown
];
if (pruneLevel === 0) {
lines.push("> [!NOTE]");
lines.push(
"> `/nix/store/[hash]` and the `.drv` suffixes have been removed to make the graph small enough to render."
);
} else if (pruneLevel > 0) {
lines.push("> [!NOTE]");
lines.push(
`> \`/nix/store/[hash]\`, the \`.drv\` suffix, and builds that took less than ${formatDuration(pruneLevel)} have been removed to make the graph small enough to render.`
);
}
lines.push("");
lines.push("</details>");
return lines.join("\n");
}
function mermaidify(allEvents, pruneLevel) {
const events = allEvents.filter(
(event) => event.c === "BuiltPathResponseEventV1" || event.c === "BuildFailureResponseEventV1"
).sort(
(a, b) => a.timing.startTime.getTime() - b.timing.startTime.getTime()
);
const firstEvent = events.at(0);
if (firstEvent === void 0) {
return void 0;
}
const zeroMoment = firstEvent.timing.startTime.getTime();
const lines = [
"```mermaid",
"gantt",
" dateFormat X",
" axisFormat %Mm%Ss"
];
for (const event of events) {
const duration = event.timing.durationSeconds;
if (duration < pruneLevel) {
continue;
}
const label = pruneLevel >= 0 ? truncateDerivation(event.drv) : event.drv;
const tag = event.c === "BuildFailureResponseEventV1" ? "crit" : "d";
const relativeStartTime = (event.timing.startTime.getTime() - zeroMoment) / 1e3;
lines.push(
`${label} (${formatDuration(duration)}):${tag}, ${relativeStartTime}, ${duration}s`
);
}
lines.push("```");
return lines.join("\n");
}
function formatDuration(duration) {
const durSeconds = duration % 60;
const durMinutes = (duration - durSeconds) / 60;
return `${durMinutes > 0 ? `${durMinutes}m` : ""}${durSeconds}s`;
}
// src/index.ts
var EVENT_INSTALL_NIX_FAILURE = "install_nix_failure";
var EVENT_INSTALL_NIX_START = "install_nix_start";
var EVENT_INSTALL_NIX_SUCCESS = "install_nix_start";
@@ -95844,7 +95701,7 @@ var NixInstallerAction = class extends DetSysAction {
await this.cleanupNoSystemd();
await this.reportOverall();
}
get isMacOS() {
get isMacOs() {
return this.runnerOs === "macOS";
}
get isLinux() {
@@ -95872,21 +95729,21 @@ var NixInstallerAction = class extends DetSysAction {
}
});
this.recordEvent("debug-probe-urls:response", {
// biome-ignore lint/style/useNamingConvention: Posthog JSON
debug_probe_urls_ip: resp.ip,
// eslint-disable-line camelcase
// biome-ignore lint/style/useNamingConvention: Posthog JSON
debug_probe_urls_ok: resp.ok,
// eslint-disable-line camelcase
// biome-ignore lint/style/useNamingConvention: Posthog JSON
debug_probe_urls_status_code: resp.statusCode,
// eslint-disable-line camelcase
// biome-ignore lint/style/useNamingConvention: Posthog JSON
debug_probe_urls_body: resp.body,
// eslint-disable-line camelcase
// eslint-disable-next-line camelcase
// biome-ignore lint/style/useNamingConvention: Posthog JSON
debug_probe_urls_elapsed: (resp.timings.end ?? 0) - resp.timings.start
});
} catch (e) {
this.recordEvent("debug-probe-urls:exception", {
// biome-ignore lint/style/useNamingConvention: Posthog JSON
debug_probe_urls_exception: stringifyError(e)
// eslint-disable-line camelcase
});
}
} catch (err) {
@@ -95964,13 +95821,13 @@ var NixInstallerAction = class extends DetSysAction {
}
executionEnv.NIX_INSTALLER_DIAGNOSTIC_ENDPOINT = (await this.getDiagnosticsUrl())?.toString() ?? "";
if (this.macEncrypt !== null) {
if (!this.isMacOS) {
if (!this.isMacOs) {
throw new Error("`mac-encrypt` while `$RUNNER_OS` was not `macOS`");
}
executionEnv.NIX_INSTALLER_ENCRYPT = this.macEncrypt;
}
if (this.macCaseSensitive !== null) {
if (!this.isMacOS) {
if (!this.isMacOs) {
throw new Error(
"`mac-case-sensitive` while `$RUNNER_OS` was not `macOS`"
);
@@ -95978,7 +95835,7 @@ var NixInstallerAction = class extends DetSysAction {
executionEnv.NIX_INSTALLER_CASE_SENSITIVE = this.macCaseSensitive;
}
if (this.macVolumeLabel !== null) {
if (!this.isMacOS) {
if (!this.isMacOs) {
throw new Error(
"`mac-volume-label` while `$RUNNER_OS` was not `macOS`"
);
@@ -95986,7 +95843,7 @@ var NixInstallerAction = class extends DetSysAction {
executionEnv.NIX_INSTALLER_VOLUME_LABEL = this.macVolumeLabel;
}
if (this.macRootDisk !== null) {
if (!this.isMacOS) {
if (!this.isMacOs) {
throw new Error("`mac-root-disk` while `$RUNNER_OS` was not `macOS`");
}
executionEnv.NIX_INSTALLER_ROOT_DISK = this.macRootDisk;
@@ -95998,7 +95855,7 @@ var NixInstallerAction = class extends DetSysAction {
executionEnv.NIX_INSTALLER_LOG_DIRECTIVES = this.logDirectives;
}
if (this.init !== null) {
if (this.isMacOS) {
if (this.isMacOs) {
throw new Error(
"`init` is not a valid option when `$RUNNER_OS` is `macOS`"
);
@@ -96316,6 +96173,7 @@ var NixInstallerAction = class extends DetSysAction {
["uninstall"],
{
env: {
// biome-ignore lint/style/useNamingConvention: environment variable
NIX_INSTALLER_NO_CONFIRM: "true",
...process.env
// To get $PATH, etc
@@ -96491,7 +96349,7 @@ var NixInstallerAction = class extends DetSysAction {
}
}
get defaultPlanner() {
if (this.isMacOS) {
if (this.isMacOs) {
return "macos";
} else if (this.isLinux) {
return "linux";
Generated
+12 -12
View File
@@ -2,30 +2,30 @@
"nodes": {
"flake-schemas": {
"locked": {
"lastModified": 1693491534,
"narHash": "sha256-ifw8Td8kD08J8DxFbYjeIx5naHcDLz7s2IFP3X42I/U=",
"rev": "c702cbb663d6d70bbb716584a2ee3aeb35017279",
"revCount": 21,
"lastModified": 1721999734,
"narHash": "sha256-G5CxYeJVm4lcEtaO87LKzOsVnWeTcHGKbKxNamNWgOw=",
"rev": "0a5c42297d870156d9c57d8f99e476b738dcd982",
"revCount": 75,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/DeterminateSystems/flake-schemas/0.1.1/018a4c59-80e1-708a-bb4d-854930c20f72/source.tar.gz"
"url": "https://api.flakehub.com/f/pinned/DeterminateSystems/flake-schemas/0.1.5/0190ef2f-61e0-794b-ba14-e82f225e55e6/source.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://flakehub.com/f/DeterminateSystems/flake-schemas/%2A.tar.gz"
"url": "https://flakehub.com/f/DeterminateSystems/flake-schemas/0.1"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1696879762,
"narHash": "sha256-Ud6bH4DMcYHUDKavNMxAhcIpDGgHMyL/yaDEAVSImQY=",
"rev": "f99e5f03cc0aa231ab5950a15ed02afec45ed51a",
"revCount": 534224,
"lastModified": 1748460289,
"narHash": "sha256-7doLyJBzCllvqX4gszYtmZUToxKvMUrg45EUWaUYmBg=",
"rev": "96ec055edbe5ee227f28cdbc3f1ddf1df5965102",
"revCount": 807377,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.1.534224%2Brev-f99e5f03cc0aa231ab5950a15ed02afec45ed51a/018b1d3c-12f0-76a5-b796-7668d7633f08/source.tar.gz"
"url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.1.807377%2Brev-96ec055edbe5ee227f28cdbc3f1ddf1df5965102/01972133-94d2-786e-bfeb-34136c7f0b07/source.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://flakehub.com/f/NixOS/nixpkgs/0.1.0.tar.gz"
"url": "https://flakehub.com/f/NixOS/nixpkgs/0.1"
}
},
"root": {
+4 -4
View File
@@ -3,8 +3,8 @@
description = "Development environment for the Nix Installer action for GitHub.";
inputs = {
flake-schemas.url = "https://flakehub.com/f/DeterminateSystems/flake-schemas/*.tar.gz";
nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.0.tar.gz";
flake-schemas.url = "https://flakehub.com/f/DeterminateSystems/flake-schemas/0.1";
nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1";
};
outputs = { self, flake-schemas, nixpkgs }:
@@ -21,9 +21,9 @@
default = pkgs.mkShell {
packages = with pkgs; [
nodejs_latest
nixpkgs-fmt
nodePackages_latest.pnpm
nodePackages_latest.typescript-language-server
biome
nixpkgs-fmt
];
};
});
+4 -12
View File
@@ -7,12 +7,12 @@
"type": "module",
"scripts": {
"build": "tsup",
"format": "prettier --write .",
"check-fmt": "prettier --check .",
"lint": "eslint src/**/*.ts",
"format": "biome format --write",
"check-fmt": "biome format",
"lint": "biome lint",
"package": "ncc build",
"test": "vitest --watch false",
"all": "pnpm run test && pnpm run format && pnpm run lint && pnpm run build && pnpm run package"
"all": "pnpm run test && pnpm run format && pnpm run lint && pnpm run test && pnpm run build && pnpm run package"
},
"repository": {
"type": "git",
@@ -35,17 +35,9 @@
"vitest": "^3.2.0"
},
"devDependencies": {
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
"@types/node": "^20.17.57",
"@types/uuid": "^9.0.8",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@vercel/ncc": "^0.38.3",
"eslint": "^8.57.1",
"eslint-import-resolver-typescript": "^3.10.1",
"eslint-plugin-github": "^4.10.2",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-prettier": "^5.4.1",
"prettier": "^3.5.3",
"tsup": "^8.5.0",
"typescript": "^5.8.3"
}
+2039 -5879
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -1,8 +1,8 @@
import { parseEvents, getRecentEvents } from "./events.js";
import { expect, test } from "vitest";
import { getRecentEvents, parseEvents } from "./events.js";
// Handy test for locally making sure you can fetch recent events:
// eslint-disable-next-line no-constant-condition
// biome-ignore lint/correctness/noConstantCondition: testing
if (false) {
test("Parsing existing events", async () => {
expect(await getRecentEvents(new Date(Date.now() - 1000000))).toStrictEqual(
+2 -2
View File
@@ -1,6 +1,6 @@
import got from "got";
export interface DEvent {
export interface Event {
v: string;
c: string;
drv: string;
@@ -11,7 +11,7 @@ export interface DEvent {
}
export interface ParsedEventsResult {
readonly events: DEvent[];
readonly events: Event[];
readonly hasMismatches: boolean;
}
+14 -10
View File
@@ -5,8 +5,6 @@ import {
summarizeFailures,
} from "./failuresummary.js";
/* eslint-disable @typescript-eslint/no-non-null-assertion */
test("Select for failure events", () => {
const events = [
{
@@ -99,10 +97,12 @@ test("Summarize Failures", async () => {
}
};
// biome-ignore lint/style/noNonNullAssertion: testing
const summary: FailureSummary = (await summarizeFailures(events, logMaker))!;
expect(summary.markdownLines.join("\n"))
.toStrictEqual(`### Build error review :boom:
expect(
summary.markdownLines.join("\n"),
).toStrictEqual(`### Build error review :boom:
> [!NOTE]
> 2 builds failed
<details><summary>Failure log: <code>/nix/store/rz9hrpay90sjrid5hx3x8v606ji679xa-<strong>dep-1</strong>.drv</code></summary>
@@ -150,8 +150,9 @@ test("Summarize Failures", async () => {
</details>
`);
expect(summary.logLines.join("\n"))
.toStrictEqual(`\u001b[38;2;255;0;0mBuild logs from 2 failures
expect(
summary.logLines.join("\n"),
).toStrictEqual(`\u001b[38;2;255;0;0mBuild logs from 2 failures
The following build logs are also available in the Markdown summary:
::group::Failed build: /nix/store/rz9hrpay90sjrid5hx3x8v606ji679xa-dep-1.drv
/nix/store/rz9hrpay90sjrid5hx3x8v606ji679xa-dep-1.drv
@@ -228,14 +229,16 @@ test("Omit some logs if there are too many", async () => {
return `${drv}\n`.repeat(5).trimEnd();
};
// biome-ignore lint/style/noNonNullAssertion: testing
const summary: FailureSummary = (await summarizeFailures(
events,
logMaker,
500,
))!;
expect(summary.markdownLines.join("\n"))
.toStrictEqual(`### Build error review :boom:
expect(
summary.markdownLines.join("\n"),
).toStrictEqual(`### Build error review :boom:
> [!NOTE]
> 2 builds failed
<details><summary>Failure log: <code>/nix/store/rz9hrpay90sjrid5hx3x8v606ji679xa-<strong>dep-1</strong>.drv</code></summary>
@@ -254,8 +257,9 @@ test("Omit some logs if there are too many", async () => {
> The full logs are available in the post-run phase of the Nix Installer Action.
> * \`/nix/store/rz9hrpay90sjrid5hx3x8v606ji679xa-dep-3.drv\``);
expect(summary.logLines.join("\n"))
.toStrictEqual(`\u001b[38;2;255;0;0mBuild logs from 2 failures
expect(
summary.logLines.join("\n"),
).toStrictEqual(`\u001b[38;2;255;0;0mBuild logs from 2 failures
The following build logs are also available in the Markdown summary:
::group::Failed build: /nix/store/rz9hrpay90sjrid5hx3x8v606ji679xa-dep-1.drv
/nix/store/rz9hrpay90sjrid5hx3x8v606ji679xa-dep-1.drv
+5 -5
View File
@@ -1,14 +1,14 @@
import { getExecOutput } from "@actions/exec";
import { DEvent } from "./events.js";
import { stripVTControlCharacters } from "node:util";
import { getExecOutput } from "@actions/exec";
import { Event } from "./events.js";
// CI summaries have a max length of "1024k" which I assume to be 1048576 bytes.
// Generously, the mermaid doc is about 50,000 bytes.
// Rounding it all down a bit further for wiggle room, that leaves lots of log space.
const defaultMaxSummaryLength = 995_000;
export function getBuildFailures(events: DEvent[]): DEvent[] {
return events.filter((event: DEvent): Boolean => {
export function getBuildFailures(events: Event[]): Event[] {
return events.filter((event: Event): Boolean => {
return event.c === "BuildFailureResponseEventV1";
});
}
@@ -19,7 +19,7 @@ export interface FailureSummary {
}
export async function summarizeFailures(
events: DEvent[],
events: Event[],
getLog: (drv: string) => Promise<string | undefined> = getLogFromNix,
maxLength: number = defaultMaxSummaryLength,
): Promise<FailureSummary | undefined> {
+52 -25
View File
@@ -1,21 +1,21 @@
import { SpawnOptions, spawn } from "node:child_process";
import fs, { mkdirSync, openSync } from "node:fs";
import { access, readFile, stat, writeFile } from "node:fs/promises";
import { userInfo } from "node:os";
import { join } from "node:path";
import { setTimeout } from "node:timers/promises";
import * as path from "path";
import * as actionsCore from "@actions/core";
import * as actionsExec from "@actions/exec";
import * as github from "@actions/github";
import { access, readFile, stat, writeFile } from "node:fs/promises";
import { join } from "node:path";
import fs, { mkdirSync, openSync } from "node:fs";
import { userInfo } from "node:os";
import stringArgv from "string-argv";
import * as path from "path";
import { DetSysAction, inputs, platform, stringifyError } from "detsys-ts";
import got from "got";
import { setTimeout } from "node:timers/promises";
import { getFixHashes } from "./fixHashes.js";
import stringArgv from "string-argv";
import { annotateMismatches } from "./annotate.js";
import { getRecentEvents } from "./events.js";
import { makeMermaidReport } from "./mermaid.js";
import { summarizeFailures } from "./failuresummary.js";
import { SpawnOptions, spawn } from "node:child_process";
import { getFixHashes } from "./fixHashes.js";
import { makeMermaidReport } from "./mermaid.js";
// Nix installation events
const EVENT_INSTALL_NIX_FAILURE = "install_nix_failure";
@@ -157,7 +157,7 @@ class NixInstallerAction extends DetSysAction {
await this.reportOverall();
}
private get isMacOS(): boolean {
private get isMacOs(): boolean {
return this.runnerOs === "macOS";
}
@@ -194,17 +194,22 @@ class NixInstallerAction extends DetSysAction {
});
this.recordEvent("debug-probe-urls:response", {
debug_probe_urls_ip: resp.ip, // eslint-disable-line camelcase
debug_probe_urls_ok: resp.ok, // eslint-disable-line camelcase
debug_probe_urls_status_code: resp.statusCode, // eslint-disable-line camelcase
debug_probe_urls_body: resp.body, // eslint-disable-line camelcase
// eslint-disable-next-line camelcase
// biome-ignore lint/style/useNamingConvention: Posthog JSON
debug_probe_urls_ip: resp.ip,
// biome-ignore lint/style/useNamingConvention: Posthog JSON
debug_probe_urls_ok: resp.ok,
// biome-ignore lint/style/useNamingConvention: Posthog JSON
debug_probe_urls_status_code: resp.statusCode,
// biome-ignore lint/style/useNamingConvention: Posthog JSON
debug_probe_urls_body: resp.body,
// biome-ignore lint/style/useNamingConvention: Posthog JSON
debug_probe_urls_elapsed:
(resp.timings.end ?? 0) - resp.timings.start,
});
} catch (e: unknown) {
this.recordEvent("debug-probe-urls:exception", {
debug_probe_urls_exception: stringifyError(e), // eslint-disable-line camelcase
// biome-ignore lint/style/useNamingConvention: Posthog JSON
debug_probe_urls_exception: stringifyError(e),
});
}
} catch (err: unknown) {
@@ -302,14 +307,14 @@ class NixInstallerAction extends DetSysAction {
// TODO: Error if the user uses these on not-MacOS
if (this.macEncrypt !== null) {
if (!this.isMacOS) {
if (!this.isMacOs) {
throw new Error("`mac-encrypt` while `$RUNNER_OS` was not `macOS`");
}
executionEnv.NIX_INSTALLER_ENCRYPT = this.macEncrypt;
}
if (this.macCaseSensitive !== null) {
if (!this.isMacOS) {
if (!this.isMacOs) {
throw new Error(
"`mac-case-sensitive` while `$RUNNER_OS` was not `macOS`",
);
@@ -318,7 +323,7 @@ class NixInstallerAction extends DetSysAction {
}
if (this.macVolumeLabel !== null) {
if (!this.isMacOS) {
if (!this.isMacOs) {
throw new Error(
"`mac-volume-label` while `$RUNNER_OS` was not `macOS`",
);
@@ -327,7 +332,7 @@ class NixInstallerAction extends DetSysAction {
}
if (this.macRootDisk !== null) {
if (!this.isMacOS) {
if (!this.isMacOs) {
throw new Error("`mac-root-disk` while `$RUNNER_OS` was not `macOS`");
}
executionEnv.NIX_INSTALLER_ROOT_DISK = this.macRootDisk;
@@ -343,7 +348,7 @@ class NixInstallerAction extends DetSysAction {
// TODO: Error if the user uses these on MacOS
if (this.init !== null) {
if (this.isMacOS) {
if (this.isMacOs) {
throw new Error(
"`init` is not a valid option when `$RUNNER_OS` is `macOS`",
);
@@ -596,7 +601,6 @@ class NixInstallerAction extends DetSysAction {
await stat(socketPath);
return true;
} catch (error: unknown) {
// eslint-disable-next-line no-undef
if ((error as NodeJS.ErrnoException).code === "ENOENT") {
actionsCore.debug(`Socket '${socketPath}' does not exist yet`);
return false;
@@ -735,6 +739,7 @@ class NixInstallerAction extends DetSysAction {
["uninstall"],
{
env: {
// biome-ignore lint/style/useNamingConvention: environment variable
NIX_INSTALLER_NO_CONFIRM: "true",
...process.env, // To get $PATH, etc
},
@@ -950,7 +955,7 @@ class NixInstallerAction extends DetSysAction {
}
private get defaultPlanner(): string {
if (this.isMacOS) {
if (this.isMacOs) {
return "macos";
} else if (this.isLinux) {
return "linux";
@@ -996,29 +1001,51 @@ class NixInstallerAction extends DetSysAction {
}
}
// All env vars are strings, no fanciness here.
type ExecuteEnvironment = {
// All env vars are strings, no fanciness here.
// biome-ignore lint/style/useNamingConvention: environment variable
RUST_BACKTRACE?: string;
// biome-ignore lint/style/useNamingConvention: environment variable
NIX_INSTALLER_MODIFY_PROFILE?: string;
// biome-ignore lint/style/useNamingConvention: environment variable
NIX_INSTALLER_NIX_BUILD_GROUP_NAME?: string;
// biome-ignore lint/style/useNamingConvention: environment variable
NIX_INSTALLER_NIX_BUILD_GROUP_ID?: string;
// biome-ignore lint/style/useNamingConvention: environment variable
NIX_INSTALLER_NIX_BUILD_USER_PREFIX?: string;
// biome-ignore lint/style/useNamingConvention: environment variable
NIX_INSTALLER_NIX_BUILD_USER_COUNT?: string;
// biome-ignore lint/style/useNamingConvention: environment variable
NIX_INSTALLER_NIX_BUILD_USER_ID_BASE?: string;
// biome-ignore lint/style/useNamingConvention: environment variable
NIX_INSTALLER_NIX_PACKAGE_URL?: string;
// biome-ignore lint/style/useNamingConvention: environment variable
NIX_INSTALLER_PROXY?: string;
// biome-ignore lint/style/useNamingConvention: environment variable
NIX_INSTALLER_SSL_CERT_FILE?: string;
// biome-ignore lint/style/useNamingConvention: environment variable
NIX_INSTALLER_DIAGNOSTIC_ENDPOINT?: string;
// biome-ignore lint/style/useNamingConvention: environment variable
NIX_INSTALLER_DIAGNOSTIC_ATTRIBUTION?: string;
// biome-ignore lint/style/useNamingConvention: environment variable
NIX_INSTALLER_ENCRYPT?: string;
// biome-ignore lint/style/useNamingConvention: environment variable
NIX_INSTALLER_CASE_SENSITIVE?: string;
// biome-ignore lint/style/useNamingConvention: environment variable
NIX_INSTALLER_VOLUME_LABEL?: string;
// biome-ignore lint/style/useNamingConvention: environment variable
NIX_INSTALLER_ROOT_DISK?: string;
// biome-ignore lint/style/useNamingConvention: environment variable
NIX_INSTALLER_INIT?: string;
// biome-ignore lint/style/useNamingConvention: environment variable
NIX_INSTALLER_START_DAEMON?: string;
// biome-ignore lint/style/useNamingConvention: environment variable
NIX_INSTALLER_NO_CONFIRM?: string;
// biome-ignore lint/style/useNamingConvention: environment variable
NIX_INSTALLER_EXTRA_CONF?: string;
// biome-ignore lint/style/useNamingConvention: environment variable
NIX_INSTALLER_LOG_DIRECTIVES?: string;
// biome-ignore lint/style/useNamingConvention: environment variable
NIX_INSTALLER_LOGGER?: string;
};
+24 -6
View File
@@ -1,11 +1,9 @@
import { mermaidify, makeMermaidReport } from "./mermaid.js";
import { DEvent, parseEvents } from "./events.js";
import { expect, test } from "vitest";
import { Event, parseEvents } from "./events.js";
import { makeMermaidReport, mermaidify } from "./mermaid.js";
/* eslint-disable @typescript-eslint/no-non-null-assertion */
function generateEvents(count: number): DEvent[] {
const events: DEvent[] = [];
function generateEvents(count: number): Event[] {
const events: Event[] = [];
for (let i = 0; i < count; i++) {
events.push({
@@ -29,16 +27,21 @@ test("Empty event list returns no report", () => {
});
test("Create a very large report doc and make sure it is small enough", () => {
// biome-ignore lint/style/noNonNullAssertion: testing
const report = makeMermaidReport(generateEvents(2500))!;
// Assert the `.drv` suffix was pruned (1 reference = the NOTE at the end)
// biome-ignore lint/style/noNonNullAssertion: testing
expect(report.match(/\.drv/g)!.length).equals(1);
// Assert the `/nix/store` prefix was pruned (1 reference = the NOTE at the end)
// biome-ignore lint/style/noNonNullAssertion: testing
expect(report.match(/\/nix\/store\//g)!.length).equals(1);
// Assert that some events were pruned
// biome-ignore lint/style/noNonNullAssertion: testing
expect(report.match(/dep-/g)!.length).lessThan(2500);
// biome-ignore lint/style/noNonNullAssertion: testing
expect(report.match(/dep-/g)!.length).greaterThan(1500);
expect(report).toContain("suffix, and builds that took less than ");
@@ -49,15 +52,19 @@ test("Create a very large report doc and make sure it is small enough", () => {
test("Create a medium large report doc and make sure it is small enough", () => {
const eventCount = 675;
// biome-ignore lint/style/noNonNullAssertion: testing
const report = makeMermaidReport(generateEvents(eventCount))!;
// Assert the `.drv` suffix was pruned (1 reference = the NOTE at the end)
// biome-ignore lint/style/noNonNullAssertion: testing
expect(report.match(/\.drv/g)!.length).equals(1);
// Assert the `/nix/store` prefix was pruned (1 reference = the NOTE at the end)
// biome-ignore lint/style/noNonNullAssertion: testing
expect(report.match(/\/nix\/store\//g)!.length).equals(1);
// Assert that no lines were pruned
// biome-ignore lint/style/noNonNullAssertion: testing
expect(report.match(/dep-/g)!.length).toStrictEqual(eventCount);
expect(report).toContain(
@@ -69,12 +76,15 @@ test("Create a medium large report doc and make sure it is small enough", () =>
});
test("Create a small report doc and make sure it isn't pruned", () => {
// biome-ignore lint/style/noNonNullAssertion: testing
const report = makeMermaidReport(generateEvents(100))!;
// Assert 100 events have the `.drv` suffix, ie: were not pruned
// biome-ignore lint/style/noNonNullAssertion: testing
expect(report.match(/\.drv/g)!.length).equals(100);
// Assert 100 events have the `.drv` suffix, ie: were not pruned
// biome-ignore lint/style/noNonNullAssertion: testing
expect(report.match(/\/nix\/store\//g)!.length).equals(100);
expect(report.length).lessThan(50000);
@@ -83,9 +93,13 @@ test("Create a small report doc and make sure it isn't pruned", () => {
test("Generate a really big report and shrink it", () => {
const events = generateEvents(1000);
// biome-ignore lint/style/noNonNullAssertion: testing
const originalLength = mermaidify(events, -1)!.length;
// biome-ignore lint/style/noNonNullAssertion: testing
const limitedLengthZero = mermaidify(events, 0)!.length;
// biome-ignore lint/style/noNonNullAssertion: testing
const limitedLengthOne = mermaidify(events, 1)!.length;
// biome-ignore lint/style/noNonNullAssertion: testing
const limitedLengthTwo = mermaidify(events, 2)!.length;
expect(originalLength).greaterThan(limitedLengthZero);
@@ -173,9 +187,13 @@ hash-mismatch-md5-base16 (4s):crit, 3, 4s
test("Generate a really big report and shrink it", () => {
const events = generateEvents(1000);
// biome-ignore lint/style/noNonNullAssertion: testing
const originalLength = mermaidify(events, -1)!.length;
// biome-ignore lint/style/noNonNullAssertion: testing
const limitedLengthZero = mermaidify(events, 0)!.length;
// biome-ignore lint/style/noNonNullAssertion: testing
const limitedLengthOne = mermaidify(events, 1)!.length;
// biome-ignore lint/style/noNonNullAssertion: testing
const limitedLengthTwo = mermaidify(events, 2)!.length;
expect(originalLength).greaterThan(limitedLengthZero);
+3 -3
View File
@@ -1,7 +1,7 @@
import { DEvent } from "./events.js";
import { Event } from "./events.js";
import { truncateDerivation } from "./util.js";
export function makeMermaidReport(events: DEvent[]): string | undefined {
export function makeMermaidReport(events: Event[]): string | undefined {
// # 50k is the max: https://github.com/mermaid-js/mermaid/blob/c269dc822c528e1afbde34e18a1cad03d972d4fe/src/defaultConfig.js#L55
const maxLength = 49900;
let mermaid = "";
@@ -42,7 +42,7 @@ export function makeMermaidReport(events: DEvent[]): string | undefined {
}
export function mermaidify(
allEvents: DEvent[],
allEvents: Event[],
pruneLevel: number,
): string | undefined {
const events = allEvents