Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions .github/actions/setup-ci/action.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: "Setup CI environment"
description: "Setup Cloudserver CI environment"
name: 'Setup CI environment'
description: 'Setup Cloudserver CI environment'

runs:
using: composite
Expand Down Expand Up @@ -28,12 +28,23 @@ runs:
- uses: actions/setup-node@v4
with:
node-version: '22.23.1'
cache: 'yarn'
# Cache node_modules directly (not the yarn download cache) so the git
# dependencies' TypeScript compilation and relink are skipped on a hit.
# Key includes runner.os because node_modules can hold native addons; all
# CI runners are Linux/ubuntu, so the cache stays homogeneous.
- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cache key doesn't include the Node.js version. Since this project has native addons (leveldown, node-gyp-build), a Node version bump (e.g. 22.23.1 → 22.x.y) without a yarn.lock change would serve node_modules compiled for the old version, risking segfaults or load failures.

The comment on line 33 already notes native addons as the reason for including runner.os — the same reasoning applies to the Node version. Same fix needed in tests.yaml (lines 94, 142, 162, 1117).

Suggested change
key: ${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }}
key: ${{ runner.os }}-node-22.23.1-modules-${{ hashFiles('yarn.lock') }}

- name: install typescript
shell: bash
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: yarn global add typescript@4.9.5
- name: install dependencies
shell: bash
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: yarn install --ignore-engines --frozen-lockfile --network-concurrency 1
- uses: actions/cache@v3
with:
Expand Down
34 changes: 30 additions & 4 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,18 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: '22.23.1'
cache: yarn
- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }}
- name: install typescript
shell: bash
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: yarn global add typescript@4.9.5
- name: install dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile --network-concurrency 1
- uses: actions/setup-python@v5
with:
Expand Down Expand Up @@ -127,8 +134,14 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: '22.23.1'
cache: yarn
- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }}
- name: install dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile --network-concurrency 1
- name: Count async/await migration progress
run: yarn run count-async
Expand All @@ -141,11 +154,18 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: '22.23.1'
cache: yarn
- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }}
- name: install typescript
shell: bash
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: yarn global add typescript@4.9.5
- name: install dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile --network-concurrency 1
- name: Unit Coverage
run: |
Expand Down Expand Up @@ -1089,8 +1109,14 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: '22.23.1'
cache: yarn
- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }}
- name: Install dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile --network-concurrency 1
- name: Delete stale GCP CI buckets
run: yarn run cleanup_gcp_buckets
Expand Down
Loading