ci: add Go and npm dependency caching via actions/cache
Add actions/cache@v4 to all four CI jobs. Go module cache (go/pkg/mod + go-build) keyed on go.sum for test, race, and vulns jobs. npm cache (~/.npm + node_modules) keyed on package-lock.json for frontend job. Cuts dependency download time to near-zero on cache hit. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -40,6 +40,16 @@ jobs:
|
||||
go-version: "1.25"
|
||||
cache: false
|
||||
|
||||
- name: Cache Go modules
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/go/pkg/mod
|
||||
~/.cache/go-build
|
||||
key: ${{ runner.os }}-go-${{ hashFiles('backend/go.sum') }}-test
|
||||
restore-keys: |
|
||||
${{ runner.os }}-go-
|
||||
|
||||
- name: Fix node toolcache path for Post-step cleanup
|
||||
run: |
|
||||
mkdir -p /opt/hostedtoolcache/node/22.23.1/x64/bin
|
||||
@@ -95,6 +105,16 @@ jobs:
|
||||
go-version: "1.25"
|
||||
cache: false
|
||||
|
||||
- name: Cache Go modules
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/go/pkg/mod
|
||||
~/.cache/go-build
|
||||
key: ${{ runner.os }}-go-${{ hashFiles('backend/go.sum') }}-race
|
||||
restore-keys: |
|
||||
${{ runner.os }}-go-
|
||||
|
||||
- name: Fix node toolcache path for Post-step cleanup
|
||||
run: |
|
||||
mkdir -p /opt/hostedtoolcache/node/22.23.1/x64/bin
|
||||
@@ -132,6 +152,16 @@ jobs:
|
||||
go-version: "1.25"
|
||||
cache: false
|
||||
|
||||
- name: Cache Go modules
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/go/pkg/mod
|
||||
~/.cache/go-build
|
||||
key: ${{ runner.os }}-go-${{ hashFiles('backend/go.sum') }}-vulns
|
||||
restore-keys: |
|
||||
${{ runner.os }}-go-
|
||||
|
||||
- name: Fix node toolcache path for Post-step cleanup
|
||||
run: |
|
||||
mkdir -p /opt/hostedtoolcache/node/22.23.1/x64/bin
|
||||
@@ -157,6 +187,16 @@ jobs:
|
||||
mkdir -p /opt/hostedtoolcache/node/22.23.1/x64/bin
|
||||
ln -sf /usr/local/bin/node /opt/hostedtoolcache/node/22.23.1/x64/bin/node
|
||||
|
||||
- name: Cache npm dependencies
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.npm
|
||||
frontend/node_modules
|
||||
key: ${{ runner.os }}-npm-${{ hashFiles('frontend/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-npm-
|
||||
|
||||
- name: Frontend type check
|
||||
run: |
|
||||
cd frontend
|
||||
|
||||
Reference in New Issue
Block a user