Skip to content

Commit

Permalink
chore: use includes to test puppeteer rather than separate job (#198)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB authored Feb 20, 2021
1 parent a82d13d commit 77e5de2
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 35 deletions.
58 changes: 24 additions & 34 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,22 @@ on:

jobs:
test-node:
name:
# prettier-ignore
Test on Node.js v${{ matrix.node-version }} and html-webpack-plugin v${{ matrix.html-plugin-version }}
name: Test on Node.js v${{ matrix.node-version }} and html-webpack-plugin v${{ matrix.html-plugin-version }} and webpack v${{ matrix.webpack-version }}
strategy:
fail-fast: false
matrix:
node-version: [6.x, 8.x, 10.x, 12.x, 14.x, 15.x]
html-plugin-version: [3, 4]
webpack-version: [4]
include:
- node-version: 10.x
install-puppeteer: true
- node-version: 12.x
install-puppeteer: true
- node-version: 14.x
install-puppeteer: true
- node-version: 15.x
install-puppeteer: true
runs-on: ubuntu-latest

steps:
Expand All @@ -38,10 +46,17 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: install with html-webpack-plugin v${{matrix.html-plugin-version }}
- name: install with html-webpack-plugin v${{matrix.html-plugin-version }} and webpack v${{ matrix.webpack-version }}
run: |
yarn
yarn add --dev html-webpack-plugin@${{matrix.html-plugin-version }}
yarn add --dev html-webpack-plugin@${{matrix.html-plugin-version }} webpack@${{ matrix.webpack-version }}
git checkout yarn.lock
- name: install puppeteer
if: ${{ matrix.install-puppeteer }}
run: |
yarn add --dev puppeteer
yarn example
git checkout yarn.lock
- name: run tests
run: yarn cover
- uses: codecov/codecov-action@v1
Expand Down Expand Up @@ -70,36 +85,13 @@ jobs:
with:
node-version: 14.x
- run: yarn
- name: run tests
run: yarn cover
test-browser:
name: Test DLL example with Puppeteer
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- uses: actions/[email protected]
with:
node-version: 14.x
- name: install puppeteer
run: |
yarn
yarn add --dev puppeteer
yarn example
git checkout yarn.lock
- name: run examples
run: yarn example
- name: run tests
run: yarn jest
run: yarn cover
lint:
name: Run ESLint using Node.js LTS
runs-on: ubuntu-latest
Expand All @@ -123,11 +115,9 @@ jobs:
- run: yarn lint

release:
if:
# prettier-ignore
${{ github.event_name == 'push' && github.event.ref == 'refs/heads/main' }}
if: ${{ github.event_name == 'push' && github.event.ref == 'refs/heads/main' }}
name: Release new version
needs: [lint, test-node, test-os, test-browser]
needs: [lint, test-node, test-os]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand Down
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@
"options": {
"trailingComma": "es5"
}
},
{
"files": ".github/workflows/**/*.yml",
"options": {
"printWidth": 175
}
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion puppeteer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ let browser;

(() => {
try {
// eslint-disable-next-line global-require,import/no-unresolved
// eslint-disable-next-line global-require,import/no-unresolved,import/no-extraneous-dependencies
puppeteer = require('puppeteer');
} catch (error) {
if (error.code !== 'MODULE_NOT_FOUND') {
Expand Down

0 comments on commit 77e5de2

Please sign in to comment.