Skip to content

Commit

Permalink
Add GitHub action
Browse files Browse the repository at this point in the history
  • Loading branch information
mantoni committed Jan 28, 2024
1 parent 45073bc commit 2b22838
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
42 changes: 42 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Build

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ['16.x', '18.x', '20.x']

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install
run: npm ci
env:
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 1
- name: Lint
if: matrix.node-version == '20.x'
run: npm run lint
- name: Types
if: matrix.node-version == '20.x'
run: node_modules/.bin/tsc
- name: Test Node
run: npm run test:node
- name: Test Browser
if: matrix.node-version == '20.x'
run: |
export PUPPETEER_EXECUTABLE_PATH=$(which google-chrome-stable)
npm run test:browser
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
"main": "lib/log.js",
"scripts": {
"lint": "eslint .",
"test": "mocha && mochify",
"test": "npm run test:node && npm run test:browser",
"test:node": "mocha",
"test:browser": "mochify",
"watch": "mocha --watch",
"build": "tsc --project tsconfig.pack.json",
"clean": "rimraf --glob 'lib/*.d.ts'",
Expand Down

0 comments on commit 2b22838

Please sign in to comment.