Skip to content

Commit 55858d8

Browse files
committed
ci(action): switch GitHub Actions to use pnpm and update actions
1 parent 597ac14 commit 55858d8

File tree

1 file changed

+39
-38
lines changed

1 file changed

+39
-38
lines changed

.github/workflows/node.js.yml

Lines changed: 39 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: Node.js CI
22

33
on:
44
pull_request:
5-
branches: [ main ]
5+
branches: [main]
66
push:
7-
branches: [ main ]
7+
branches: [main]
88
permissions:
99
contents: read
1010

@@ -14,46 +14,47 @@ jobs:
1414
runs-on: ubuntu-latest
1515
strategy:
1616
matrix:
17-
node-version: [14.x, 16.x, 18.x ]
17+
node-version: [16.x, 18.x, 22.x]
1818
steps:
19-
- uses: actions/checkout@v5
20-
- name: Use Node.js ${{ matrix.node-version }}
21-
uses: actions/setup-node@v5
22-
with:
23-
node-version: ${{ matrix.node-version }}
24-
- uses: actions/cache@v4
25-
with:
26-
path: ~/.npm
27-
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
28-
restore-keys: |
29-
${{ runner.os }}-node-
30-
- run: npm ci
31-
name: Install dependencies
32-
- name: Test
33-
env:
34-
NCM_API_TEST_LOGIN_COUNTRY_CODE: ${{ secrets.NCM_API_TEST_LOGIN_COUNTRY_CODE }}
35-
NCM_API_TEST_LOGIN_PHONE: ${{ secrets.NCM_API_TEST_LOGIN_PHONE }}
36-
NCM_API_TEST_LOGIN_PASSWORD: ${{ secrets.NCM_API_TEST_LOGIN_PASSWORD }}
37-
run: npm test
19+
- uses: actions/checkout@v5
20+
- name: Use Node.js ${{ matrix.node-version }}
21+
uses: actions/setup-node@v5
22+
with:
23+
node-version: ${{ matrix.node-version }}
24+
# Use built-in package manager cache for pnpm
25+
cache: 'pnpm'
26+
cache-dependency-path: '**/pnpm-lock.yaml'
27+
- name: Setup pnpm
28+
uses: pnpm/action-setup@v2
29+
with:
30+
version: 8
31+
- name: Install dependencies (pnpm)
32+
run: pnpm install --frozen-lockfile
33+
- name: Test
34+
env:
35+
NCM_API_TEST_LOGIN_COUNTRY_CODE: ${{ secrets.NCM_API_TEST_LOGIN_COUNTRY_CODE }}
36+
NCM_API_TEST_LOGIN_PHONE: ${{ secrets.NCM_API_TEST_LOGIN_PHONE }}
37+
NCM_API_TEST_LOGIN_PASSWORD: ${{ secrets.NCM_API_TEST_LOGIN_PASSWORD }}
38+
run: pnpm test
3839
lint:
3940
name: Lint
4041
runs-on: ubuntu-latest
4142
strategy:
4243
matrix:
43-
node-version: [14.x]
44+
node-version: [18.x]
4445
steps:
45-
- uses: actions/checkout@v5
46-
- name: Use Node.js ${{ matrix.node-version }}
47-
uses: actions/setup-node@v5
48-
with:
49-
node-version: ${{ matrix.node-version }}
50-
- uses: actions/cache@v4
51-
with:
52-
path: ~/.npm
53-
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
54-
restore-keys: |
55-
${{ runner.os }}-node-
56-
- run: npm ci
57-
name: Install dependencies
58-
- name: Lint
59-
run: npm run lint
46+
- uses: actions/checkout@v5
47+
- name: Use Node.js ${{ matrix.node-version }}
48+
uses: actions/setup-node@v5
49+
with:
50+
node-version: ${{ matrix.node-version }}
51+
cache: 'pnpm'
52+
cache-dependency-path: '**/pnpm-lock.yaml'
53+
- name: Setup pnpm
54+
uses: pnpm/action-setup@v2
55+
with:
56+
version: 8
57+
- name: Install dependencies (pnpm)
58+
run: pnpm install --frozen-lockfile
59+
- name: Lint
60+
run: pnpm run lint

0 commit comments

Comments
 (0)