Skip to content

Commit 401c4e6

Browse files
authored
Merge pull request #7 from allocsys/ci-lockfile-cache-yamllint
CI: use lockfile-based npm cache + npm ci, lint render.yaml
2 parents e9df75f + 68a0d36 commit 401c4e6

2 files changed

Lines changed: 10 additions & 18 deletions

File tree

.github/workflows/ci.yml

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,15 @@ jobs:
1515
- uses: actions/setup-node@v4
1616
with:
1717
node-version: "20"
18+
cache: npm
1819

19-
# Manual cache keyed on package.json, since no package-lock.json is
20-
# committed yet -- setup-node's built-in `cache: npm` requires a
21-
# lockfile to hash against. Once generate-lockfile.yml (workflow_dispatch)
22-
# has run and committed one, switch this to `cache: npm` on setup-node
23-
# (keyed on package-lock.json) + `npm ci` instead of `npm install`.
24-
- name: Cache npm dependencies
25-
uses: actions/cache@v4
26-
with:
27-
path: ~/.npm
28-
key: ${{ runner.os }}-npm-${{ hashFiles('package.json') }}
29-
restore-keys: |
30-
${{ runner.os }}-npm-
20+
- name: Lint render.yaml
21+
run: |
22+
set -e
23+
npx --yes yaml-lint render.yaml
3124
3225
- name: Install dependencies
33-
run: npm install
26+
run: npm ci
3427

3528
- name: Syntax-check all source files
3629
run: |

.github/workflows/generate-lockfile.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
name: Generate lockfile
22

3-
# Manual maintenance workflow: this session's sandbox has no network access,
4-
# so it can't run `npm install` to produce a real package-lock.json. GitHub
5-
# Actions does have network access, so run this once (and again any time
6-
# dependencies change) to generate and commit one -- then switch ci.yml over
7-
# to setup-node's built-in `cache: npm` (keyed on the lockfile) + `npm ci`.
3+
# Manual maintenance workflow: run this any time package.json's dependencies
4+
# change, to regenerate and commit package-lock.json. ci.yml already relies
5+
# on this lockfile (setup-node's `cache: npm` + `npm ci`), so a stale
6+
# lockfile will fail CI with a clear npm-ci mismatch error until this is run.
87
on:
98
workflow_dispatch: {}
109

0 commit comments

Comments
 (0)