Skip to content

chore: use includes to test puppeteer rather than separate job #198

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Feb 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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