Skip to content

Commit 579d213

Browse files
authored
replace node action cache with custom cache in ci (#5454)
1 parent 174a5cd commit 579d213

File tree

9 files changed

+25
-8
lines changed

9 files changed

+25
-8
lines changed

.github/actions/install/action.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,25 @@
11
name: Install dependencies
22
description: Install dependencies
3+
inputs:
4+
cache:
5+
description: "Whether to enable caching of node_modules."
6+
required: false
7+
default: 'false'
38
runs:
49
using: composite
5-
steps: # retry in case of server error from registry
10+
steps:
11+
- id: yarn-cache
12+
uses: actions/cache@v4
13+
with:
14+
key: yarn-cache-${{ github.workflow }}-${{ github.job }}-${{ hashFiles('yarn.lock') }}
15+
path: node_modules.tar
16+
if: inputs.cache == 'true'
17+
- run: 7z x -y node_modules.tar
18+
shell: bash
19+
if: inputs.cache == 'true' && steps.yarn-cache.outputs.cache-hit == 'true'
20+
# Retry in case of server error from registry.
621
- run: yarn install --frozen-lockfile --ignore-engines || yarn install --frozen-lockfile --ignore-engines
722
shell: bash
8-
23+
- run: 7z -mx0 a node_modules.tar node_modules
24+
shell: bash
25+
if: inputs.cache == 'true' && steps.yarn-cache.outputs.cache-hit != 'true'

.github/actions/node/active-lts/action.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@ runs:
55
steps:
66
- uses: actions/setup-node@v4
77
with:
8-
cache: yarn
98
node-version: '22'

.github/actions/node/latest/action.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@ runs:
55
steps:
66
- uses: actions/setup-node@v4
77
with:
8-
cache: yarn
98
node-version: 'latest'

.github/actions/node/newest-maintenance-lts/action.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@ runs:
55
steps:
66
- uses: actions/setup-node@v4
77
with:
8-
cache: yarn
98
node-version: '20'

.github/actions/node/oldest-maintenance-lts/action.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@ runs:
55
steps:
66
- uses: actions/setup-node@v4
77
with:
8-
cache: yarn
98
node-version: '18'

.github/workflows/appsec.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ jobs:
4444
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
4545
- uses: ./.github/actions/node/active-lts
4646
- uses: ./.github/actions/install
47+
with:
48+
cache: 'true'
4749
- run: yarn test:appsec:ci
4850
- uses: codecov/codecov-action@13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3 # v5.3.1
4951

@@ -230,7 +232,6 @@ jobs:
230232
- uses: ./.github/actions/testagent/start
231233
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
232234
with:
233-
cache: yarn
234235
node-version: ${{ matrix.version }}
235236
- uses: ./.github/actions/install
236237
- run: yarn test:appsec:plugins:ci

.github/workflows/plugins.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,6 @@ jobs:
877877
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
878878
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
879879
with:
880-
cache: yarn
881880
node-version: '16'
882881
- uses: ./.github/actions/install
883882
- run: yarn config set ignore-engines true

.github/workflows/profiling.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ jobs:
4949
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
5050
- uses: ./.github/actions/node/active-lts
5151
- uses: ./.github/actions/install
52+
with:
53+
cache: 'true'
5254
- run: yarn test:profiler:ci
5355
- run: yarn test:integration:profiler
5456
- uses: codecov/codecov-action@13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3 # v5.3.1

.github/workflows/tracing.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,7 @@ jobs:
4444
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
4545
- uses: ./.github/actions/node/active-lts
4646
- uses: ./.github/actions/install
47+
with:
48+
cache: 'true'
4749
- run: yarn test:trace:core:ci
4850
- uses: codecov/codecov-action@13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3 # v5.3.1

0 commit comments

Comments
 (0)