Skip to content

Commit

Permalink
Update CI
Browse files Browse the repository at this point in the history
  • Loading branch information
XhmikosR committed May 5, 2023
1 parent dfbdf16 commit 5bb4e3d
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 43 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/lint.yml
@@ -0,0 +1,38 @@
name: Lint

on:
push:
branches:
- master
- '!dependabot/**'
pull_request:
workflow_dispatch:

env:
FORCE_COLOR: 2
NODE: 18

permissions:
contents: read

jobs:
lint:
runs-on: ubuntu-latest

steps:
- name: Clone repository
uses: actions/checkout@v3
with:
persist-credentials: false

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '${{ env.NODE }}'
cache: npm

- name: Install npm dependencies
run: npm ci

- name: Lint
run: npm run lint
62 changes: 19 additions & 43 deletions .github/workflows/test.yml
@@ -1,68 +1,44 @@
name: CI
name: Tests

on:
push:
branches:
- main
- 'dependabot/**'
- master
- '!dependabot/**'
pull_request:
branches:
- '**'

jobs:
lint:
name: Lint
workflow_dispatch:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Use Node.js LTS
uses: actions/setup-node@v3
with:
node-version: 'lts/*'
cache: npm
env:
FORCE_COLOR: 2

- name: Install latest npm
run: npm install --global npm@latest

- name: Install dependencies && npm --version
run: npm ci

- name: Lint
run: npm run lint

test:
name: Test on Node.js ${{ matrix.node }} and ${{ matrix.os }}
permissions:
contents: read

jobs:
run:
name: Node ${{ matrix.node }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
node: [14, 16, 18]
node: [14, 16, 18, 20]
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
- uses: actions/checkout@v3
- name: Clone repository
uses: actions/checkout@v3
with:
persist-credentials: false

- name: Use Node.js ${{ matrix.node }}
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: npm

# HACK: See https://github.com/npm/cli/issues/4341
- name: Workaround for npm installation failure on Node.js 14 and Windows
if: ${{ startsWith(matrix.node, '14') && startsWith(matrix.os, 'windows') }}
run: npm install --global npm@8.3

- name: Install latest npm
run: npm install --global npm@latest && npm --version

- name: Install dependencies
- name: Install npm dependencies
run: npm ci

- name: Test
- name: Run tests
run: npm test

0 comments on commit 5bb4e3d

Please sign in to comment.