Enable reachable Gitea npm cache

This commit is contained in:
Kevin
2026-09-04 02:50:04 -04:00
parent 052fa31d87
commit 09a491b16b
7 changed files with 17 additions and 8 deletions
@@ -20,6 +20,8 @@ jobs:
uses: https://github.com/actions/setup-node@v4 uses: https://github.com/actions/setup-node@v4
with: with:
node-version: 22 node-version: 22
cache: npm
cache-dependency-path: package-lock.json
- name: Install locked dependencies - name: Install locked dependencies
run: npm ci --prefer-offline --no-audit --no-fund run: npm ci --prefer-offline --no-audit --no-fund
- name: Verify Decap configuration and content boundaries - name: Verify Decap configuration and content boundaries
+2
View File
@@ -33,6 +33,8 @@ jobs:
uses: https://github.com/actions/setup-node@v4 uses: https://github.com/actions/setup-node@v4
with: with:
node-version: 22 node-version: 22
cache: npm
cache-dependency-path: package-lock.json
- name: Install locked dependencies - name: Install locked dependencies
run: npm ci --prefer-offline --no-audit --no-fund run: npm ci --prefer-offline --no-audit --no-fund
- name: Validate and build selected site - name: Validate and build selected site
+2
View File
@@ -33,6 +33,8 @@ jobs:
uses: https://github.com/actions/setup-node@v4 uses: https://github.com/actions/setup-node@v4
with: with:
node-version: 22 node-version: 22
cache: npm
cache-dependency-path: package-lock.json
- name: Install locked dependencies - name: Install locked dependencies
run: npm ci --prefer-offline --no-audit --no-fund run: npm ci --prefer-offline --no-audit --no-fund
- name: Validate and build selected site - name: Validate and build selected site
+2
View File
@@ -34,6 +34,8 @@ jobs:
uses: https://github.com/actions/setup-node@v4 uses: https://github.com/actions/setup-node@v4
with: with:
node-version: 22 node-version: 22
cache: npm
cache-dependency-path: package-lock.json
- name: Install locked dependencies - name: Install locked dependencies
run: npm ci --prefer-offline --no-audit --no-fund run: npm ci --prefer-offline --no-audit --no-fund
- name: Validate and build production blog - name: Validate and build production blog
@@ -34,6 +34,8 @@ jobs:
uses: https://github.com/actions/setup-node@v4 uses: https://github.com/actions/setup-node@v4
with: with:
node-version: 22 node-version: 22
cache: npm
cache-dependency-path: package-lock.json
- name: Install locked dependencies - name: Install locked dependencies
run: npm ci --prefer-offline --no-audit --no-fund run: npm ci --prefer-offline --no-audit --no-fund
- name: Validate and build production site - name: Validate and build production site
+6 -8
View File
@@ -81,14 +81,12 @@ the pilot:
- The existing branch preview workflows remain in place. Local output checks - The existing branch preview workflows remain in place. Local output checks
now prove preview robots rules and page metadata stay no-index and that the now prove preview robots rules and page metadata stay no-index and that the
admin response has a no-index header rule. admin response has a no-index header rule.
- Validation, preview, and production workflows use clean `npm ci` installs with - Validation, preview, and production workflows cache npm's download store by
`--prefer-offline --no-audit --no-fund`. Do not enable `setup-node`'s npm cache `package-lock.json` while retaining clean `npm ci` installs with
until the Actions runner cache service is reachable from job containers. The `--prefer-offline --no-audit --no-fund`. The runner advertises its cache on a
September 4 pilot test timed out against the runner's auto-detected private fixed host and port reachable from job containers, avoiding the timeout caused
address during both cache restore and cleanup. Give `act_runner` a fixed by its former auto-detected private address. Warm jobs reuse dependency
`cache.host` and `cache.port` reachable from its job containers, publish that tarballs without caching `node_modules`.
port (or attach runner and jobs to a shared network), restart the runner, and
then restore the lockfile-keyed `cache: npm` configuration.
The pilot dependencies are active: the public client ID, exact-origin CORS The pilot dependencies are active: the public client ID, exact-origin CORS
policy, `cms-pilot` branch, and both protection rules have been verified. policy, `cms-pilot` branch, and both protection rules have been verified.
+1
View File
@@ -227,6 +227,7 @@ for (const path of [
'.gitea/workflows/production-blog.yml', '.gitea/workflows/production-blog.yml',
]) { ]) {
const text = await readFile(path, 'utf8'); const text = await readFile(path, 'utf8');
assert(/cache:\s*npm/.test(text) && /cache-dependency-path:\s*package-lock\.json/.test(text), `${path} must cache npm downloads by package-lock.json.`);
assert(text.includes('npm ci --prefer-offline --no-audit --no-fund'), `${path} must retain a clean lockfile install with quiet, cache-friendly npm options.`); assert(text.includes('npm ci --prefer-offline --no-audit --no-fund'), `${path} must retain a clean lockfile install with quiet, cache-friendly npm options.`);
} }