Skip to content

Commit 50a268a

Browse files
committed
ci: improve testing
- Use `cache: npm` of `actions/setup-node` instead of `actions/cache` - Install the old npm version only on Node.js 14 and Windows - Remove the useless `env.CI`, which is set by default
1 parent 66376c5 commit 50a268a

File tree

1 file changed

+6
-19
lines changed

1 file changed

+6
-19
lines changed

.github/workflows/testing.yml

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ on:
99
branches:
1010
- '**'
1111

12-
env:
13-
CI: true
14-
1512
jobs:
1613
test:
1714
name: Test for Stylelint ${{ matrix.stylelint }} on Node.js ${{ matrix.node-version }} and ${{ matrix.os }}
@@ -36,25 +33,15 @@ jobs:
3633
uses: actions/setup-node@v4
3734
with:
3835
node-version: ${{ matrix.node-version }}
36+
cache: npm
3937

40-
- name: Get npm cache directory
41-
id: npm-cache-dir
42-
run: |
43-
echo "::set-output name=dir::$(npm config get cache)"
44-
45-
- name: Cache npm cache
46-
uses: actions/cache@v3
47-
id: npm-cache
48-
with:
49-
path: ${{ steps.npm-cache-dir.outputs.dir }}
50-
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
51-
restore-keys: |
52-
${{ runner.os }}-node-
38+
# TODO: [email protected] is broken on Windows. See https://github.com/npm/cli/issues/4341
39+
- name: Workaround for npm installation failure on Node.js 14 and Windows
40+
if: ${{ startsWith(matrix.node-version, '14') && runner.os == 'Windows' }}
41+
run: npm install --global [email protected]
5342

5443
- name: Install latest npm
55-
run: npm install --global [email protected]
56-
# TODO: [email protected] is broken on Windows. See https://github.com/npm/cli/issues/4341
57-
# run: npm install --global npm@latest
44+
run: npm install --global npm@latest
5845

5946
- name: Install dependencies
6047
run: npm ci

0 commit comments

Comments
 (0)