Update test#835.yml #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Node.js CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Cache npm dependencies | |
- name: Cache node_modules | |
uses: actions/cache@v3 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-npm- | |
# Step 2: Setup Node.js | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
# Step 3: Install dependencies using npm ci (with an existing package-lock.json) | |
- name: Install dependencies | |
run: npm ci --verbose | |
# Step 4: Check for cache hits and misses | |
- name: Check for cache hits | |
run: cat /home/runner/.npm/_logs/*-debug-*.log | grep "cache hit" || echo "No cache hit" |