Skip to content

Commit

Permalink
ci: improve testing
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
ybiquitous committed Feb 8, 2024
1 parent 66376c5 commit 50a268a
Showing 1 changed file with 6 additions and 19 deletions.
25 changes: 6 additions & 19 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ on:
branches:
- '**'

env:
CI: true

jobs:
test:
name: Test for Stylelint ${{ matrix.stylelint }} on Node.js ${{ matrix.node-version }} and ${{ matrix.os }}
Expand All @@ -36,25 +33,15 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm

- name: Get npm cache directory
id: npm-cache-dir
run: |
echo "::set-output name=dir::$(npm config get cache)"
- name: Cache npm cache
uses: actions/cache@v3
id: npm-cache
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
# TODO: npm@8.4 is broken on Windows. See https://github.com/npm/cli/issues/4341
- name: Workaround for npm installation failure on Node.js 14 and Windows
if: ${{ startsWith(matrix.node-version, '14') && runner.os == 'Windows' }}
run: npm install --global npm@8.3

- name: Install latest npm
run: npm install --global npm@8.3
# TODO: npm@8.4 is broken on Windows. See https://github.com/npm/cli/issues/4341
# run: npm install --global npm@latest
run: npm install --global npm@latest

- name: Install dependencies
run: npm ci
Expand Down

0 comments on commit 50a268a

Please sign in to comment.