Compare commits

..

3 Commits

Author SHA1 Message Date
gustavderdrache 5f9e43ae73 pnpm run all 2025-06-23 12:43:41 -04:00
gustavderdrache 0b77516ea1 Bump detsys-ts PR reference 2025-06-23 11:40:39 -04:00
gustavderdrache 3610f32cba Track correlations (DeterminateSystems/detsys-ts#101) 2025-06-20 18:07:13 -04:00
18 changed files with 6467 additions and 2546 deletions
+74
View File
@@ -0,0 +1,74 @@
{
"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
}
}
+6 -8
View File
@@ -8,7 +8,7 @@ on:
jobs:
tests:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
needs:
- check-dist-up-to-date
- install-nix
@@ -24,19 +24,17 @@ jobs:
check-dist-up-to-date:
name: Check the dist/ folder is up to date
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
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: Check formatting
- name: prettier format
run: nix develop --command pnpm run check-fmt
- name: Link
- name: ESLint
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
@@ -148,7 +146,7 @@ jobs:
install-with-non-default-source-inputs:
name: Install Nix using non-default source-${{ matrix.inputs.key }}
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
strategy:
matrix:
inputs:
@@ -173,7 +171,7 @@ jobs:
install-no-id-token:
name: Install Nix without an ID token
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: ./
+3
View File
@@ -53,6 +53,9 @@ typings/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
+3
View File
@@ -0,0 +1,3 @@
dist/
lib/
node_modules/
+1
View File
@@ -0,0 +1 @@
{}
-148
View File
@@ -1,148 +0,0 @@
{
"$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
+422 -231
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__(5545);
const supportsColor = __nccwpck_require__(1953);
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
exports.colors = [
@@ -43135,6 +43135,21 @@ 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:
@@ -45926,7 +45941,7 @@ const auto = __nccwpck_require__(2342);
const {
HttpOverHttp2,
HttpsOverHttp2
} = __nccwpck_require__(2830);
} = __nccwpck_require__(449);
const Http2OverHttp2 = __nccwpck_require__(2016);
const {
Http2OverHttp,
@@ -45992,7 +46007,7 @@ module.exports = self => {
/***/ }),
/***/ 2830:
/***/ 449:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
@@ -50345,6 +50360,148 @@ 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:
@@ -73243,14 +73400,6 @@ function wrappy (fn, cb) {
}
/***/ }),
/***/ 5545:
/***/ ((module) => {
module.exports = eval("require")("supports-color");
/***/ }),
/***/ 2613:
@@ -86501,36 +86650,69 @@ 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 "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 "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: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
@@ -88109,8 +88291,6 @@ 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
@@ -88223,6 +88403,8 @@ 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';
@@ -89745,6 +89927,8 @@ 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) {
@@ -90046,6 +90230,8 @@ 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
@@ -93620,15 +93806,13 @@ const got = source_create(defaults);
;// CONCATENATED MODULE: external "node:dns/promises"
const external_node_dns_promises_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:dns/promises");
;// CONCATENATED MODULE: external "dns/promises"
const external_dns_promises_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("dns/promises");
// EXTERNAL MODULE: ./node_modules/.pnpm/@actions+cache@4.0.3/node_modules/@actions/cache/lib/cache.js
var cache = __nccwpck_require__(7389);
;// 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
// EXTERNAL MODULE: external "child_process"
var external_child_process_ = __nccwpck_require__(5317);
;// CONCATENATED MODULE: ./node_modules/.pnpm/github.com+DeterminateSystems+detsys-ts@4e79c5b32d326f3596e09300d5d5ce5e7a412786_objx2bnahfcrlmccv7oxmqb33m/node_modules/detsys-ts/dist/index.js
var __defProp = Object.defineProperty;
var __export = (target, all) => {
for (var name in all)
@@ -93639,7 +93823,7 @@ var __export = (target, all) => {
var readFileAsync = (0,external_node_util_.promisify)(external_node_fs_namespaceObject.readFile);
var readFileAsync = (0,external_util_.promisify)(external_fs_.readFile);
var linuxReleaseInfoOptionsDefaults = {
mode: "async",
customFile: null,
@@ -93650,7 +93834,7 @@ function releaseInfo(infoOptions) {
const searchOsReleaseFileList = osReleaseFileList(
options.customFile
);
if (external_node_os_.type() !== "Linux") {
if (external_os_.type() !== "Linux") {
if (options.mode === "sync") {
return getOsInfo();
} else {
@@ -93691,11 +93875,11 @@ function osReleaseFileList(customFile) {
}
function getOsInfo() {
return {
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()
type: external_os_.type(),
platform: external_os_.platform(),
hostname: external_os_.hostname(),
arch: external_os_.arch(),
release: external_os_.release()
};
}
async function readAsyncOsReleaseFile(fileList, options) {
@@ -93729,7 +93913,7 @@ function readSyncOsreleaseFile(releaseFileList, options) {
if (options.debug) {
console.log(`Trying to read '${osReleaseFile}'...`);
}
fileData = external_node_fs_namespaceObject.readFileSync(osReleaseFile, "binary");
fileData = external_fs_.readFileSync(osReleaseFile, "binary");
if (options.debug) {
console.log(`Read data:
${fileData}`);
@@ -93913,7 +94097,7 @@ async function collectBacktracesMacOS(prefixes, programNameDenyList, startTimest
["user", `${process.env["HOME"]}/Library/Logs/DiagnosticReports/`]
];
for (const [source, dir] of dirs) {
const fileNames = (await (0,external_node_fs_promises_namespaceObject.readdir)(dir)).filter((fileName) => {
const fileNames = (await (0,promises_namespaceObject.readdir)(dir)).filter((fileName) => {
return prefixes.some((prefix) => fileName.startsWith(prefix));
}).filter((fileName) => {
return !programNameDenyList.some(
@@ -93922,11 +94106,11 @@ async function collectBacktracesMacOS(prefixes, programNameDenyList, startTimest
}).filter((fileName) => {
return !fileName.endsWith(".diag");
});
const doGzip = (0,external_node_util_.promisify)(external_node_zlib_.gzip);
const doGzip = (0,external_util_.promisify)(external_zlib_.gzip);
for (const fileName of fileNames) {
try {
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}`);
if ((await (0,promises_namespaceObject.stat)(`${dir}/${fileName}`)).ctimeMs >= startTimestampMs) {
const logText = await (0,promises_namespaceObject.readFile)(`${dir}/${fileName}`);
const buf = await doGzip(logText);
backtraces.set(
`backtrace_value_${source}_${fileName}`,
@@ -93988,7 +94172,7 @@ async function collectBacktracesSystemd(prefixes, programNameDenyList, startTime
);
return backtraces;
}
const doGzip = (0,external_node_util_.promisify)(external_node_zlib_.gzip);
const doGzip = (0,external_util_.promisify)(external_zlib_.gzip);
for (const coredump of coredumps) {
try {
const { stdout: logText } = await exec.getExecOutput(
@@ -94072,14 +94256,15 @@ function identify(projectName) {
"GITHUB_REPOSITORY_OWNER",
"GITHUB_REPOSITORY_OWNER_ID"
])
}
},
is_ci: true
};
core.debug("Correlation data:");
core.debug(JSON.stringify(ident, null, 2));
return ident;
}
function hashEnvironmentVariables(prefix, variables) {
const hash = (0,external_node_crypto_.createHash)("sha256");
const hash = (0,external_crypto_.createHash)("sha256");
for (const varName of variables) {
let value = process.env[varName];
if (value === void 0) {
@@ -94260,7 +94445,7 @@ function recordToUrl(record) {
}
}
async function discoverServiceRecords() {
return await discoverServicesStub((0,external_node_dns_promises_namespaceObject.resolveSrv)(LOOKUP), 1e3);
return await discoverServicesStub((0,external_dns_promises_namespaceObject.resolveSrv)(LOOKUP), 1e3);
}
async function discoverServicesStub(lookup, timeout) {
const defaultFallback = new Promise(
@@ -94514,6 +94699,7 @@ var EVENT_ARTIFACT_CACHE_HIT = "artifact_cache_hit";
var EVENT_ARTIFACT_CACHE_MISS = "artifact_cache_miss";
var EVENT_ARTIFACT_CACHE_PERSIST = "artifact_cache_persist";
var EVENT_PREFLIGHT_REQUIRE_NIX_DENIED = "preflight-require-nix-denied";
var EVENT_STORE_IDENTITY_FAILED = "store_identity_failed";
var FACT_ARTIFACT_FETCHED_FROM_CACHE = "artifact_fetched_from_cache";
var FACT_ENDED_WITH_EXCEPTION = "ended_with_exception";
var FACT_FINAL_EXCEPTION = "final_exception";
@@ -94538,6 +94724,49 @@ var PROGRAM_NAME_CRASH_DENY_LIST = [
"nix-store-tests",
"nix-util-tests"
];
var determinateStateDir = "/var/lib/determinate";
var determinateIdentityFile = external_path_.join(determinateStateDir, "identity.json");
var isRoot = external_os_.userInfo().uid === 0;
async function sudoEnsureDeterminateStateDir() {
const code = await exec.exec("sudo", [
"mkdir",
"-p",
determinateStateDir
]);
if (code !== 0) {
throw new Error(`sudo mkdir -p exit: ${code}`);
}
}
async function ensureDeterminateStateDir() {
if (isRoot) {
await (0,promises_namespaceObject.mkdir)(determinateStateDir, { recursive: true });
} else {
return sudoEnsureDeterminateStateDir();
}
}
async function sudoWriteCorrelationHashes(hashes) {
const buffer = Buffer.from(hashes);
const code = await exec.exec(
"sudo",
["tee", determinateIdentityFile],
{
input: buffer,
// Ignore output from tee
outStream: (0,external_fs_.createWriteStream)("/dev/null")
}
);
if (code !== 0) {
throw new Error(`sudo tee exit: ${code}`);
}
}
async function writeCorrelationHashes(hashes) {
await ensureDeterminateStateDir();
if (isRoot) {
await promises_namespaceObject.writeFile(determinateIdentityFile, hashes, "utf-8");
} else {
return sudoWriteCorrelationHashes(hashes);
}
}
var DetSysAction = class {
determineExecutionPhase() {
const currentPhase = core.getState(STATE_KEY_EXECUTION_PHASE);
@@ -94648,8 +94877,8 @@ var DetSysAction = class {
});
}
getTemporaryName() {
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)()}`);
const tmpDir = process.env["RUNNER_TEMP"] || (0,external_os_.tmpdir)();
return external_path_.join(tmpDir, `${this.actionOptions.name}-${(0,external_crypto_.randomUUID)()}`);
}
addFact(key, value) {
this.facts[key] = value;
@@ -94658,13 +94887,13 @@ var DetSysAction = class {
return await this.idsHost.getDiagnosticsUrl();
}
getUniqueId() {
return this.identity.run_differentiator || process.env.RUNNER_TRACKING_ID || (0,external_node_crypto_.randomUUID)();
return this.identity.run_differentiator || process.env.RUNNER_TRACKING_ID || (0,external_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_node_crypto_.randomUUID)();
crossPhaseId = (0,external_crypto_.randomUUID)();
core.saveState(STATE_KEY_CROSS_PHASE_ID, crossPhaseId);
}
return crossPhaseId;
@@ -94681,7 +94910,7 @@ var DetSysAction = class {
facts: this.facts,
features: this.featureEventMetadata,
timestamp: /* @__PURE__ */ new Date(),
uuid: (0,external_node_crypto_.randomUUID)()
uuid: (0,external_crypto_.randomUUID)()
});
}
/**
@@ -94691,10 +94920,10 @@ var DetSysAction = class {
*/
async unpackClosure(bin) {
const artifact = await this.fetchArtifact();
const { stdout } = await (0,external_node_util_.promisify)(external_node_child_process_namespaceObject.exec)(
const { stdout } = await (0,external_util_.promisify)(external_child_process_.exec)(
`cat "${artifact}" | xz -d | nix-store --import`
);
const paths = stdout.split(external_node_os_.EOL);
const paths = stdout.split(external_os_.EOL);
const lastPath = paths.at(-2);
return `${lastPath}/bin/${bin}`;
}
@@ -94704,7 +94933,7 @@ var DetSysAction = class {
*/
async fetchExecutable() {
const binaryPath = await this.fetchArtifact();
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);
await (0,promises_namespaceObject.chmod)(binaryPath, promises_namespaceObject.constants.S_IXUSR | promises_namespaceObject.constants.S_IXGRP);
return binaryPath;
}
get isMain() {
@@ -94716,9 +94945,13 @@ var DetSysAction = class {
async executeAsync() {
try {
await this.checkIn();
process.env.DETSYS_CORRELATION = JSON.stringify(
this.getCorrelationHashes()
);
const correlationHashes = JSON.stringify(this.getCorrelationHashes());
process.env.DETSYS_CORRELATION = correlationHashes;
try {
await writeCorrelationHashes(correlationHashes);
} catch (error3) {
this.recordEvent(EVENT_STORE_IDENTITY_FAILED, { error: String(error3) });
}
if (!await this.preflightRequireNix()) {
this.recordEvent(EVENT_PREFLIGHT_REQUIRE_NIX_DENIED);
return;
@@ -94741,11 +94974,11 @@ var DetSysAction = class {
} else {
core.setFailed(reportable);
}
const doGzip = (0,external_node_util_.promisify)(external_node_zlib_.gzip);
const doGzip = (0,external_util_.promisify)(external_zlib_.gzip);
const exceptionContext = /* @__PURE__ */ new Map();
for (const [attachmentLabel, filePath] of this.exceptionAttachments) {
try {
const logText = (0,external_node_fs_namespaceObject.readFileSync)(filePath);
const logText = (0,external_fs_.readFileSync)(filePath);
const buf = await doGzip(logText);
exceptionContext.set(
`staple_value_${attachmentLabel}`,
@@ -94961,7 +95194,7 @@ var DetSysAction = class {
if (writeStream) {
writeStream.destroy();
}
writeStream = (0,external_node_fs_namespaceObject.createWriteStream)(destination, {
writeStream = (0,external_fs_.createWriteStream)(destination, {
encoding: "binary",
mode: 493
});
@@ -95025,7 +95258,7 @@ var DetSysAction = class {
const startCwd = process.cwd();
try {
const tempDir = this.getTemporaryName();
await (0,external_node_fs_promises_namespaceObject.mkdir)(tempDir);
await (0,promises_namespaceObject.mkdir)(tempDir);
process.chdir(tempDir);
process.env.GITHUB_WORKSPACE_BACKUP = process.env.GITHUB_WORKSPACE;
delete process.env.GITHUB_WORKSPACE;
@@ -95051,9 +95284,9 @@ var DetSysAction = class {
const startCwd = process.cwd();
try {
const tempDir = this.getTemporaryName();
await (0,external_node_fs_promises_namespaceObject.mkdir)(tempDir);
await (0,promises_namespaceObject.mkdir)(tempDir);
process.chdir(tempDir);
await (0,external_node_fs_promises_namespaceObject.copyFile)(toolPath, `${tempDir}/${this.actionOptions.name}`);
await (0,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(
@@ -95102,9 +95335,9 @@ var DetSysAction = class {
let nixLocation;
const pathParts = (process.env["PATH"] || "").split(":");
for (const location of pathParts) {
const candidateNix = external_node_path_namespaceObject.join(location, "nix");
const candidateNix = external_path_.join(location, "nix");
try {
await external_node_fs_promises_namespaceObject.access(candidateNix, external_node_fs_promises_namespaceObject.constants.X_OK);
await promises_namespaceObject.access(candidateNix, promises_namespaceObject.constants.X_OK);
core.debug(`Found Nix at ${candidateNix}`);
nixLocation = candidateNix;
break;
@@ -95249,49 +95482,8 @@ function makeOptionsConfident(actionOptions) {
* Copyright (c) 2018-2020 [Samuel Carreira]
*/
//# sourceMappingURL=index.js.map
;// 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: external "timers/promises"
const external_timers_promises_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("timers/promises");
;// CONCATENATED MODULE: ./dist/index.js
// src/index.ts
@@ -95307,6 +95499,22 @@ function firstString() {
// 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
@@ -95398,6 +95606,84 @@ 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
@@ -95486,102 +95772,8 @@ async function getLogFromNix(drv) {
return output.stdout;
}
// 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";
@@ -95701,7 +95893,7 @@ var NixInstallerAction = class extends DetSysAction {
await this.cleanupNoSystemd();
await this.reportOverall();
}
get isMacOs() {
get isMacOS() {
return this.runnerOs === "macOS";
}
get isLinux() {
@@ -95729,21 +95921,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,
// biome-ignore lint/style/useNamingConvention: Posthog JSON
// eslint-disable-line camelcase
debug_probe_urls_ok: resp.ok,
// biome-ignore lint/style/useNamingConvention: Posthog JSON
// eslint-disable-line camelcase
debug_probe_urls_status_code: resp.statusCode,
// biome-ignore lint/style/useNamingConvention: Posthog JSON
// eslint-disable-line camelcase
debug_probe_urls_body: resp.body,
// biome-ignore lint/style/useNamingConvention: Posthog JSON
// eslint-disable-line camelcase
// eslint-disable-next-line camelcase
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) {
@@ -95821,13 +96013,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`"
);
@@ -95835,7 +96027,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`"
);
@@ -95843,7 +96035,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;
@@ -95855,7 +96047,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`"
);
@@ -96173,7 +96365,6 @@ 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
@@ -96349,7 +96540,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": 1721999734,
"narHash": "sha256-G5CxYeJVm4lcEtaO87LKzOsVnWeTcHGKbKxNamNWgOw=",
"rev": "0a5c42297d870156d9c57d8f99e476b738dcd982",
"revCount": 75,
"lastModified": 1693491534,
"narHash": "sha256-ifw8Td8kD08J8DxFbYjeIx5naHcDLz7s2IFP3X42I/U=",
"rev": "c702cbb663d6d70bbb716584a2ee3aeb35017279",
"revCount": 21,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/DeterminateSystems/flake-schemas/0.1.5/0190ef2f-61e0-794b-ba14-e82f225e55e6/source.tar.gz"
"url": "https://api.flakehub.com/f/pinned/DeterminateSystems/flake-schemas/0.1.1/018a4c59-80e1-708a-bb4d-854930c20f72/source.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://flakehub.com/f/DeterminateSystems/flake-schemas/0.1"
"url": "https://flakehub.com/f/DeterminateSystems/flake-schemas/%2A.tar.gz"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1748460289,
"narHash": "sha256-7doLyJBzCllvqX4gszYtmZUToxKvMUrg45EUWaUYmBg=",
"rev": "96ec055edbe5ee227f28cdbc3f1ddf1df5965102",
"revCount": 807377,
"lastModified": 1696879762,
"narHash": "sha256-Ud6bH4DMcYHUDKavNMxAhcIpDGgHMyL/yaDEAVSImQY=",
"rev": "f99e5f03cc0aa231ab5950a15ed02afec45ed51a",
"revCount": 534224,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.1.807377%2Brev-96ec055edbe5ee227f28cdbc3f1ddf1df5965102/01972133-94d2-786e-bfeb-34136c7f0b07/source.tar.gz"
"url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.1.534224%2Brev-f99e5f03cc0aa231ab5950a15ed02afec45ed51a/018b1d3c-12f0-76a5-b796-7668d7633f08/source.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://flakehub.com/f/NixOS/nixpkgs/0.1"
"url": "https://flakehub.com/f/NixOS/nixpkgs/0.1.0.tar.gz"
}
},
"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/0.1";
nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1";
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";
};
outputs = { self, flake-schemas, nixpkgs }:
@@ -21,9 +21,9 @@
default = pkgs.mkShell {
packages = with pkgs; [
nodejs_latest
nodePackages_latest.pnpm
biome
nixpkgs-fmt
nodePackages_latest.pnpm
nodePackages_latest.typescript-language-server
];
};
});
+13 -5
View File
@@ -7,12 +7,12 @@
"type": "module",
"scripts": {
"build": "tsup",
"format": "biome format --write",
"check-fmt": "biome format",
"lint": "biome lint",
"format": "prettier --write .",
"check-fmt": "prettier --check .",
"lint": "eslint src/**/*.ts",
"package": "ncc build",
"test": "vitest --watch false",
"all": "pnpm run test && pnpm run format && pnpm run lint && pnpm run test && pnpm run build && pnpm run package"
"all": "pnpm run test && pnpm run format && pnpm run lint && pnpm run build && pnpm run package"
},
"repository": {
"type": "git",
@@ -29,15 +29,23 @@
"@actions/core": "^1.11.1",
"@actions/exec": "^1.1.1",
"@actions/github": "^6.0.1",
"detsys-ts": "github:DeterminateSystems/detsys-ts",
"detsys-ts": "github:DeterminateSystems/detsys-ts#gustavderdrache/write-correlation",
"got": "^14.4.7",
"string-argv": "^0.3.2",
"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"
}
+5876 -2036
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:
// biome-ignore lint/correctness/noConstantCondition: testing
// eslint-disable-next-line no-constant-condition
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 Event {
export interface DEvent {
v: string;
c: string;
drv: string;
@@ -11,7 +11,7 @@ export interface Event {
}
export interface ParsedEventsResult {
readonly events: Event[];
readonly events: DEvent[];
readonly hasMismatches: boolean;
}
+10 -14
View File
@@ -5,6 +5,8 @@ import {
summarizeFailures,
} from "./failuresummary.js";
/* eslint-disable @typescript-eslint/no-non-null-assertion */
test("Select for failure events", () => {
const events = [
{
@@ -97,12 +99,10 @@ 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,9 +150,8 @@ 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
@@ -229,16 +228,14 @@ 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>
@@ -257,9 +254,8 @@ 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 { stripVTControlCharacters } from "node:util";
import { getExecOutput } from "@actions/exec";
import { Event } from "./events.js";
import { DEvent } from "./events.js";
import { stripVTControlCharacters } from "node:util";
// 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: Event[]): Event[] {
return events.filter((event: Event): Boolean => {
export function getBuildFailures(events: DEvent[]): DEvent[] {
return events.filter((event: DEvent): Boolean => {
return event.c === "BuildFailureResponseEventV1";
});
}
@@ -19,7 +19,7 @@ export interface FailureSummary {
}
export async function summarizeFailures(
events: Event[],
events: DEvent[],
getLog: (drv: string) => Promise<string | undefined> = getLogFromNix,
maxLength: number = defaultMaxSummaryLength,
): Promise<FailureSummary | undefined> {
+25 -52
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 stringArgv from "string-argv";
import { setTimeout } from "node:timers/promises";
import { getFixHashes } from "./fixHashes.js";
import { annotateMismatches } from "./annotate.js";
import { getRecentEvents } from "./events.js";
import { summarizeFailures } from "./failuresummary.js";
import { getFixHashes } from "./fixHashes.js";
import { makeMermaidReport } from "./mermaid.js";
import { summarizeFailures } from "./failuresummary.js";
import { SpawnOptions, spawn } from "node:child_process";
// 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,22 +194,17 @@ class NixInstallerAction extends DetSysAction {
});
this.recordEvent("debug-probe-urls:response", {
// 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_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
debug_probe_urls_elapsed:
(resp.timings.end ?? 0) - resp.timings.start,
});
} catch (e: unknown) {
this.recordEvent("debug-probe-urls:exception", {
// biome-ignore lint/style/useNamingConvention: Posthog JSON
debug_probe_urls_exception: stringifyError(e),
debug_probe_urls_exception: stringifyError(e), // eslint-disable-line camelcase
});
}
} catch (err: unknown) {
@@ -307,14 +302,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`",
);
@@ -323,7 +318,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`",
);
@@ -332,7 +327,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;
@@ -348,7 +343,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`",
);
@@ -601,6 +596,7 @@ 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;
@@ -739,7 +735,6 @@ class NixInstallerAction extends DetSysAction {
["uninstall"],
{
env: {
// biome-ignore lint/style/useNamingConvention: environment variable
NIX_INSTALLER_NO_CONFIRM: "true",
...process.env, // To get $PATH, etc
},
@@ -955,7 +950,7 @@ class NixInstallerAction extends DetSysAction {
}
private get defaultPlanner(): string {
if (this.isMacOs) {
if (this.isMacOS) {
return "macos";
} else if (this.isLinux) {
return "linux";
@@ -1001,51 +996,29 @@ class NixInstallerAction extends DetSysAction {
}
}
// All env vars are strings, no fanciness here.
type ExecuteEnvironment = {
// biome-ignore lint/style/useNamingConvention: environment variable
// All env vars are strings, no fanciness here.
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;
};
+6 -24
View File
@@ -1,9 +1,11 @@
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";
function generateEvents(count: number): Event[] {
const events: Event[] = [];
/* eslint-disable @typescript-eslint/no-non-null-assertion */
function generateEvents(count: number): DEvent[] {
const events: DEvent[] = [];
for (let i = 0; i < count; i++) {
events.push({
@@ -27,21 +29,16 @@ 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 ");
@@ -52,19 +49,15 @@ 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(
@@ -76,15 +69,12 @@ 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);
@@ -93,13 +83,9 @@ 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);
@@ -187,13 +173,9 @@ 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 { Event } from "./events.js";
import { DEvent } from "./events.js";
import { truncateDerivation } from "./util.js";
export function makeMermaidReport(events: Event[]): string | undefined {
export function makeMermaidReport(events: DEvent[]): 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: Event[]): string | undefined {
}
export function mermaidify(
allEvents: Event[],
allEvents: DEvent[],
pruneLevel: number,
): string | undefined {
const events = allEvents