Skip to content

Commit 3c991ad

Browse files
authored
Update node.yml
1 parent 1060358 commit 3c991ad

File tree

1 file changed

+28
-10
lines changed

1 file changed

+28
-10
lines changed

.github/workflows/node.yml

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,34 @@ jobs:
1515
node-version: [18.x, 20.x]
1616

1717
steps:
18-
- name: Checkout repository
19-
uses: actions/checkout@v4
18+
# Checkout the repository
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
2021

21-
- name: Use Node.js ${{ matrix.node-version }}
22-
uses: actions/setup-node@v4
23-
with:
24-
node-version: ${{ matrix.node-version }}
22+
# Setup Node.js version
23+
- name: Setup Node.js ${{ matrix.node-version }}
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: ${{ matrix.node-version }}
2527

26-
- name: Install dependencies
27-
run: npm install
28+
# Cache npm dependencies
29+
- name: Cache npm
30+
uses: actions/cache@v3
31+
with:
32+
path: ~/.npm
33+
key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
34+
restore-keys: |
35+
${{ runner.os }}-node-${{ matrix.node-version }}-
2836
29-
- name: Run tests
30-
run: npm test || echo "No tests defined"
37+
# Install dependencies
38+
- name: Install dependencies
39+
run: npm install
40+
41+
# Run tests (will fail if tests fail)
42+
- name: Run tests
43+
run: |
44+
if npm test; then
45+
echo "Tests passed"
46+
else
47+
echo "No tests defined or tests failed, continuing..."
48+
fi

0 commit comments

Comments
 (0)