Skip to content

Commit 77e5de2

Browse files
authored
chore: use includes to test puppeteer rather than separate job (#198)
1 parent a82d13d commit 77e5de2

File tree

3 files changed

+31
-35
lines changed

3 files changed

+31
-35
lines changed

.github/workflows/node.js.yml

Lines changed: 24 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,22 @@ on:
1010

1111
jobs:
1212
test-node:
13-
name:
14-
# prettier-ignore
15-
Test on Node.js v${{ matrix.node-version }} and html-webpack-plugin v${{ matrix.html-plugin-version }}
13+
name: Test on Node.js v${{ matrix.node-version }} and html-webpack-plugin v${{ matrix.html-plugin-version }} and webpack v${{ matrix.webpack-version }}
1614
strategy:
1715
fail-fast: false
1816
matrix:
1917
node-version: [6.x, 8.x, 10.x, 12.x, 14.x, 15.x]
2018
html-plugin-version: [3, 4]
19+
webpack-version: [4]
20+
include:
21+
- node-version: 10.x
22+
install-puppeteer: true
23+
- node-version: 12.x
24+
install-puppeteer: true
25+
- node-version: 14.x
26+
install-puppeteer: true
27+
- node-version: 15.x
28+
install-puppeteer: true
2129
runs-on: ubuntu-latest
2230

2331
steps:
@@ -38,10 +46,17 @@ jobs:
3846
uses: actions/setup-node@v2
3947
with:
4048
node-version: ${{ matrix.node-version }}
41-
- name: install with html-webpack-plugin v${{matrix.html-plugin-version }}
49+
- name: install with html-webpack-plugin v${{matrix.html-plugin-version }} and webpack v${{ matrix.webpack-version }}
4250
run: |
4351
yarn
44-
yarn add --dev html-webpack-plugin@${{matrix.html-plugin-version }}
52+
yarn add --dev html-webpack-plugin@${{matrix.html-plugin-version }} webpack@${{ matrix.webpack-version }}
53+
git checkout yarn.lock
54+
- name: install puppeteer
55+
if: ${{ matrix.install-puppeteer }}
56+
run: |
57+
yarn add --dev puppeteer
58+
yarn example
59+
git checkout yarn.lock
4560
- name: run tests
4661
run: yarn cover
4762
- uses: codecov/codecov-action@v1
@@ -70,36 +85,13 @@ jobs:
7085
with:
7186
node-version: 14.x
7287
- run: yarn
73-
- name: run tests
74-
run: yarn cover
75-
test-browser:
76-
name: Test DLL example with Puppeteer
77-
runs-on: ubuntu-latest
78-
79-
steps:
80-
- uses: actions/checkout@v2
81-
- name: Get yarn cache directory path
82-
id: yarn-cache-dir-path
83-
run: echo "::set-output name=dir::$(yarn cache dir)"
84-
- uses: actions/cache@v2
85-
id: yarn-cache
86-
with:
87-
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
88-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
89-
restore-keys: |
90-
${{ runner.os }}-yarn-
91-
- uses: actions/setup-node@v2.1.4
92-
with:
93-
node-version: 14.x
9488
- name: install puppeteer
9589
run: |
96-
yarn
9790
yarn add --dev puppeteer
91+
yarn example
9892
git checkout yarn.lock
99-
- name: run examples
100-
run: yarn example
10193
- name: run tests
102-
run: yarn jest
94+
run: yarn cover
10395
lint:
10496
name: Run ESLint using Node.js LTS
10597
runs-on: ubuntu-latest
@@ -123,11 +115,9 @@ jobs:
123115
- run: yarn lint
124116

125117
release:
126-
if:
127-
# prettier-ignore
128-
${{ github.event_name == 'push' && github.event.ref == 'refs/heads/main' }}
118+
if: ${{ github.event_name == 'push' && github.event.ref == 'refs/heads/main' }}
129119
name: Release new version
130-
needs: [lint, test-node, test-os, test-browser]
120+
needs: [lint, test-node, test-os]
131121
runs-on: ubuntu-latest
132122
steps:
133123
- uses: actions/checkout@v2

package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,12 @@
121121
"options": {
122122
"trailingComma": "es5"
123123
}
124+
},
125+
{
126+
"files": ".github/workflows/**/*.yml",
127+
"options": {
128+
"printWidth": 175
129+
}
124130
}
125131
]
126132
},

puppeteer.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ let browser;
99

1010
(() => {
1111
try {
12-
// eslint-disable-next-line global-require,import/no-unresolved
12+
// eslint-disable-next-line global-require,import/no-unresolved,import/no-extraneous-dependencies
1313
puppeteer = require('puppeteer');
1414
} catch (error) {
1515
if (error.code !== 'MODULE_NOT_FOUND') {

0 commit comments

Comments
 (0)