From 085dd75f90293c74d3f0a88288f867216e4c8bf8 Mon Sep 17 00:00:00 2001 From: Edmund Miller Date: Thu, 31 Aug 2023 09:05:41 -0500 Subject: [PATCH 1/6] Update README example --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 24aa9a2..db1e1ec 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,9 @@ jobs: - uses: actions/checkout@v3 - uses: DeterminateSystems/nix-installer-action@main - uses: DeterminateSystems/magic-nix-cache-action@main - - run: nix flake check + - uses: DeterminateSystems/flake-checker-action@main + - name: Run `nix build` + run: nix build . ``` That's it. From c5e19708dadc5eeec28ad88c208cc75377776943 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Mon, 4 Dec 2023 20:11:40 -0500 Subject: [PATCH 2/6] Fixup log aggregation --- dist/index.js | 2 +- src/index.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index 31fc9e6..e54c5f7 100644 --- a/dist/index.js +++ b/dist/index.js @@ -12181,7 +12181,7 @@ async function setUpAutoCache() { else { runEnv = process.env; } - const output = openSync(`${daemonDir}/parent.log`, 'a'); + const output = openSync(`${daemonDir}/daemon.log`, 'a'); const launch = spawn(daemonBin, [ '--daemon-dir', daemonDir, '--listen', coreExports.getInput('listen'), diff --git a/src/index.ts b/src/index.ts index 1d6afaf..2ea291e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -113,7 +113,7 @@ async function setUpAutoCache() { runEnv = process.env; } - const output = openSync(`${daemonDir}/parent.log`, 'a'); + const output = openSync(`${daemonDir}/daemon.log`, 'a'); const launch = spawn( daemonBin, [ From e4109712fa5499656bb16076542f970c7b16a197 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Mon, 4 Dec 2023 20:12:12 -0500 Subject: [PATCH 3/6] Trim retries to 1, 5 takes too long --- dist/index.js | 2 +- src/index.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index e54c5f7..79b0b10 100644 --- a/dist/index.js +++ b/dist/index.js @@ -12105,7 +12105,7 @@ var got$1 = got; const ENV_CACHE_DAEMONDIR = 'MAGIC_NIX_CACHE_DAEMONDIR'; const gotClient = got$1.extend({ retry: { - limit: 5, + limit: 1, methods: ['POST', 'GET', 'PUT', 'HEAD', 'DELETE', 'OPTIONS', 'TRACE'], }, hooks: { diff --git a/src/index.ts b/src/index.ts index 2ea291e..fce7712 100644 --- a/src/index.ts +++ b/src/index.ts @@ -17,7 +17,7 @@ const ENV_CACHE_DAEMONDIR = 'MAGIC_NIX_CACHE_DAEMONDIR'; const gotClient = got.extend({ retry: { - limit: 5, + limit: 1, methods: [ 'POST', 'GET', 'PUT', 'HEAD', 'DELETE', 'OPTIONS', 'TRACE' ], }, hooks: { From 879f4f5a348e874593a98053c4fad6e8919f2845 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Mon, 4 Dec 2023 20:30:23 -0500 Subject: [PATCH 4/6] Dump the entire log in debug --- dist/index.js | 12 ++++++++---- src/index.ts | 12 +++++++----- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/dist/index.js b/dist/index.js index 79b0b10..15b1d38 100644 --- a/dist/index.js +++ b/dist/index.js @@ -3,9 +3,8 @@ import * as os$2 from 'node:os'; import os__default from 'node:os'; import * as path$1 from 'node:path'; import { spawn } from 'node:child_process'; -import { openSync, writeSync, close, createWriteStream } from 'node:fs'; +import { openSync, writeSync, close, readFileSync, createWriteStream } from 'node:fs'; import { pipeline } from 'node:stream/promises'; -import { setTimeout as setTimeout$1 } from 'timers/promises'; import { promisify as promisify$1, inspect } from 'node:util'; import require$$0 from 'os'; import require$$1 from 'fs'; @@ -12244,7 +12243,6 @@ async function tearDownAutoCache() { const log = new Tail_1(path$1.join(daemonDir, 'daemon.log')); coreExports.debug(`tailing daemon.log...`); log.on('line', (line) => { - coreExports.debug(`got a log line`); coreExports.info(line); }); try { @@ -12254,7 +12252,6 @@ async function tearDownAutoCache() { coreExports.debug(res); } finally { - await setTimeout$1(5000); coreExports.debug(`unwatching the daemon log`); log.unwatch(); } @@ -12267,6 +12264,13 @@ async function tearDownAutoCache() { throw e; } } + finally { + if (coreExports.isDebug()) { + coreExports.info("Entire log:"); + const log = readFileSync(path$1.join(daemonDir, 'daemon.log')); + coreExports.info(log.toString()); + } + } } const isPost = !!process.env['STATE_isPost']; try { diff --git a/src/index.ts b/src/index.ts index fce7712..dcbc3a7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -4,9 +4,8 @@ import * as fs from 'node:fs/promises'; import * as os from 'node:os'; import * as path from 'node:path'; import { spawn } from 'node:child_process'; -import { createWriteStream, openSync, writeSync, close } from 'node:fs'; +import { createWriteStream, openSync, writeSync, close, readFileSync } from 'node:fs'; import { pipeline } from 'node:stream/promises'; -import { setTimeout } from 'timers/promises'; import { inspect } from 'node:util'; import * as core from '@actions/core'; @@ -187,7 +186,6 @@ async function tearDownAutoCache() { const log = new Tail(path.join(daemonDir, 'daemon.log')); core.debug(`tailing daemon.log...`); log.on('line', (line) => { - core.debug(`got a log line`); core.info(line); }); @@ -198,8 +196,6 @@ async function tearDownAutoCache() { core.debug(`back from post`); core.debug(res); } finally { - await setTimeout(5000); - core.debug(`unwatching the daemon log`); log.unwatch(); } @@ -211,6 +207,12 @@ async function tearDownAutoCache() { if (e.code !== 'ESRCH') { throw e; } + } finally { + if (core.isDebug()) { + core.info("Entire log:"); + const log = readFileSync(path.join(daemonDir, 'daemon.log')); + core.info(log.toString()); + } } } From 5dcd0624016739434c780c222c96c8376851637a Mon Sep 17 00:00:00 2001 From: Cameron Smith Date: Wed, 24 Jan 2024 13:44:35 -0500 Subject: [PATCH 5/6] build(action): update node16 to node20 Signed-off-by: Cameron Smith --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 2aa828b..a678a1f 100644 --- a/action.yml +++ b/action.yml @@ -33,6 +33,6 @@ inputs: default: "https://install.determinate.systems/magic-nix-cache/perf" runs: - using: "node16" + using: "node20" main: "./dist/index.js" post: "./dist/index.js" From d5ffaa70fdf3f5826754b4251124770878d0e2fd Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Sun, 25 Feb 2024 15:26:17 -0500 Subject: [PATCH 6/6] Correct privacy policy link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index db1e1ec..acce518 100644 --- a/README.md +++ b/README.md @@ -104,7 +104,7 @@ cat action.yml| nix run nixpkgs#yq-go -- '[[ "Parameter", "Description", "Requir [action]: https://github.com/DeterminateSystems/magic-nix-cache-action/ [installer]: https://github.com/DeterminateSystems/nix-installer/ [ghacache]: https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows -[privacy]: https://determinate.systems/privacy +[privacy]: https://determinate.systems/policies/privacy [telemetry]: https://github.com/DeterminateSystems/magic-nix-cache/blob/main/magic-nix-cache/src/telemetry.rs [semantics]: https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#restrictions-for-accessing-a-cache [z2ncache]: https://zero-to-nix.com/concepts/caching#binary-caches