Skip to content

Commit

Permalink
chore(ci): Add GitHub Action based testing (#245)
Browse files Browse the repository at this point in the history
Co-authored-by: Roman Filippov <[email protected]>
  • Loading branch information
Roman and moltar authored Jul 13, 2020
1 parent 5164f34 commit 006b553
Show file tree
Hide file tree
Showing 27 changed files with 280 additions and 115 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
76 changes: 76 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Test

on:
pull_request:
types:
- opened
- synchronize
- reopened

env:
CI: "true"
FORCE_COLOR: "true"

jobs:
test:
name: Node@${{ matrix.node }} pup@${{ matrix.puppeteer_version }} on ${{ matrix.os }}

runs-on: ${{ matrix.os }}

strategy:
matrix:
puppeteer_version:
- 5.0.0
- 2.1.1 # Chromium 79.0.3942.0, Oct 24 2019
# - 2.0.0 # Chromium 79.0.3942.0, Oct 24 2019
# - 1.20.0 # Chromium 78.0.3882.0, Sep 13 2019
# - 1.15.0 # Chromium 75.0.3765.0, Apr 26 2019
# - 1.9.0 # Chromium 71.0.3563.0, Oct 4, 2018
# - 1.6.2 # Chromium 69.0.3494.0, Aug 1, 2018
node:
- 10
- 12
- 14
os:
- ubuntu-latest
- macOS-latest
# - windows-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}

- name: 'Fix for: error [email protected]: The platform "linux" is incompatible with this module.'
run: npx json -I -f package.json -e 'this.resolutions={}'

- name: yarn install
uses: bahmutov/npm-install@v1

- name: yarn bootstrap
run: yarn bootstrap

- name: install puppeteer@${{ matrix.puppeteer_version }}
run: yarn lerna add --dev puppeteer@${{ matrix.puppeteer_version }}

- name: lerna link
run: yarn lerna link

- name: lerna build
run: yarn lerna run build --concurrency 1

- name: debug
run: |
yarn list --pattern "puppeteer|puppeteer-extra"
file node_modules/puppeteer-extra/dist/index.cjs.js
- name: test
uses: GabrielBB/[email protected]
env:
DISPLAY: ":99.0"
with:
run: yarn test-ci
1 change: 0 additions & 1 deletion .prettierrc

This file was deleted.

6 changes: 6 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
...require('prettier-config-standard'),

// override for Windows
endOfLine: 'lf',
}
9 changes: 9 additions & 0 deletions packages/puppeteer-extra-plugin-adblocker/ava.config-ts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export default {
compileEnhancements: false,
environmentVariables: {
TS_NODE_COMPILER_OPTIONS: '{"module":"commonjs"}'
},
files: ['src/**.test.ts'],
extensions: ['ts'],
require: ['ts-node/register']
}
3 changes: 3 additions & 0 deletions packages/puppeteer-extra-plugin-adblocker/ava.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default {
files: ['dist/*.test.js']
}
25 changes: 11 additions & 14 deletions packages/puppeteer-extra-plugin-adblocker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,20 @@
"author": "remusao",
"license": "MIT",
"scripts": {
"clean": "rm -rf dist/*",
"clean": "rimraf dist/*",
"tscheck": "tsc --pretty --noEmit",
"build": "yarn clean && tsc --module commonjs && rollup -c rollup.config.ts",
"docs": "exit 0",
"test": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' ava -v src/**.test.ts",
"test-ci": "yarn build && TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' ava --fail-fast -v dist/*.test.js"
"prebuild": "run-s clean",
"build": "run-s build:tsc build:rollup",
"build:tsc": "tsc --module commonjs",
"build:rollup": "rollup -c rollup.config.ts",
"docs": "node -e 0",
"test": "ava -v --config ava.config-ts.js",
"pretest-ci": "run-s build",
"test-ci": "ava --fail-fast -v"
},
"engines": {
"node": ">=8"
},
"ava": {
"compileEnhancements": false,
"extensions": [
"ts"
],
"require": [
"ts-node/register"
]
},
"prettier": {
"printWidth": 80,
"semi": false,
Expand All @@ -50,7 +45,9 @@
"@types/node-fetch": "^2.5.4",
"@types/puppeteer": "^2.0.0",
"ava": "^2.4.0",
"npm-run-all": "^4.1.5",
"puppeteer": "2.0.0",
"rimraf": "^3.0.0",
"ts-node": "^8.5.4",
"tslint": "^5.20.1",
"tslint-config-prettier": "^1.18.0",
Expand Down
9 changes: 6 additions & 3 deletions packages/puppeteer-extra-plugin-anonymize-ua/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
"author": "berstend",
"license": "MIT",
"scripts": {
"docs": "exit 0",
"test": "ava -v --serial --concurrency 1 --fail-fast && eslint --ext .js .",
"test-ci": "yarn test"
"docs": "node -e 0",
"lint": "eslint --ext .js .",
"test:js": "ava -v --serial --concurrency 1 --fail-fast",
"test": "run-p test:js lint",
"test-ci": "run-s test"
},
"engines": {
"node": ">=8"
Expand All @@ -26,6 +28,7 @@
],
"devDependencies": {
"ava": "2.4.0",
"npm-run-all": "^4.1.5",
"puppeteer": "^2.0.0",
"puppeteer-extra": "^3.1.12",
"puppeteer-extra-plugin-devtools": "^2.2.11"
Expand Down
9 changes: 6 additions & 3 deletions packages/puppeteer-extra-plugin-block-resources/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
"author": "berstend",
"license": "MIT",
"scripts": {
"docs": "exit 0",
"test": "ava -v && eslint --ext .js .",
"test-ci": "yarn test"
"docs": "node -e 0",
"lint": "eslint --ext .js .",
"test:js": "ava -v",
"test": "run-p test:js lint",
"test-ci": "run-s test"
},
"engines": {
"node": ">=8"
Expand All @@ -26,6 +28,7 @@
],
"devDependencies": {
"ava": "2.4.0",
"npm-run-all": "^4.1.5",
"puppeteer": "^2.0.0"
},
"dependencies": {
Expand Down
8 changes: 5 additions & 3 deletions packages/puppeteer-extra-plugin-click-and-wait/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
"author": "berstend",
"license": "MIT",
"scripts": {
"docs": "exit 0",
"test": "eslint --ext .js .",
"test-ci": "yarn test"
"docs": "node -e 0",
"lint": "eslint --ext .js .",
"test": "run-p lint",
"test-ci": "run-s test"
},
"engines": {
"node": ">=8"
Expand All @@ -25,6 +26,7 @@
],
"devDependencies": {
"ava": "2.4.0",
"npm-run-all": "^4.1.5",
"puppeteer": "^2.0.0"
},
"dependencies": {
Expand Down
10 changes: 6 additions & 4 deletions packages/puppeteer-extra-plugin-devtools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
"author": "berstend",
"license": "MIT",
"scripts": {
"docs": "exit 0",
"test": "eslint --ext .js .",
"test-old": "ava -v && eslint --ext .js .",
"test-ci-old": "yarn test"
"docs": "node -e 0",
"lint": "eslint --ext .js .",
"test-old": "ava --fail-fast -v",
"test": "run-p lint",
"test-ci": "run-s test"
},
"engines": {
"node": ">=8"
Expand All @@ -29,6 +30,7 @@
],
"devDependencies": {
"ava": "2.4.0",
"npm-run-all": "^4.1.5",
"puppeteer": "^2.0.0",
"puppeteer-extra": "^3.1.12"
},
Expand Down
8 changes: 5 additions & 3 deletions packages/puppeteer-extra-plugin-flash/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
"author": "berstend",
"license": "MIT",
"scripts": {
"docs": "exit 0",
"test": "eslint --ext .js .",
"test-ci": "yarn test"
"docs": "node -e 0",
"lint": "eslint --ext .js .",
"test": "run-p lint",
"test-ci": "run-s test"
},
"engines": {
"node": ">=8"
Expand All @@ -26,6 +27,7 @@
],
"devDependencies": {
"ava": "2.4.0",
"npm-run-all": "^4.1.5",
"puppeteer": "^2.0.0"
},
"dependencies": {
Expand Down
8 changes: 5 additions & 3 deletions packages/puppeteer-extra-plugin-font-size/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
"author": "berstend",
"license": "MIT",
"scripts": {
"docs": "exit 0",
"test": "eslint --ext .js .",
"test-ci": "yarn test"
"docs": "node -e 0",
"lint": "eslint --ext .js .",
"test": "run-p lint",
"test-ci": "run-s test"
},
"engines": {
"node": ">=8"
Expand All @@ -24,6 +25,7 @@
],
"devDependencies": {
"ava": "2.4.0",
"npm-run-all": "^4.1.5",
"puppeteer": "^2.0.0"
},
"dependencies": {
Expand Down
9 changes: 9 additions & 0 deletions packages/puppeteer-extra-plugin-recaptcha/ava.config-ts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export default {
compileEnhancements: false,
environmentVariables: {
TS_NODE_COMPILER_OPTIONS: '{"module":"commonjs"}'
},
files: ['src/**.test.ts'],
extensions: ['ts'],
require: ['ts-node/register']
}
3 changes: 3 additions & 0 deletions packages/puppeteer-extra-plugin-recaptcha/ava.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default {
files: ['dist/*.test.js']
}
32 changes: 15 additions & 17 deletions packages/puppeteer-extra-plugin-recaptcha/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,25 @@
"author": "berstend",
"license": "MIT",
"scripts": {
"clean": "rm -rf dist/*",
"clean": "rimraf dist/*",
"tscheck": "tsc --pretty --noEmit",
"build": "yarn clean && tsc --project tsconfig.json --module commonjs && rollup -c rollup.config.ts && yarn ambient-dts",
"docs": "exit 0",
"docs2": "rm -rf docs/* && typedoc --module commonjs --readme none --target ES6 --theme markdown --excludeNotExported --excludeExternals --excludePrivate --out docs --mode file src/index.ts",
"test": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' ava -v src/**.test.ts",
"test-ci": "echo pwd && yarn build && TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' ava --fail-fast -v dist/*.test.js",
"ambient-dts": "yarn ambient-dts-copy && yarn ambient-dts-fix-path",
"prebuild": "run-s clean",
"build": "run-s build:tsc build:rollup ambient-dts",
"build:tsc": "tsc --project tsconfig.json --module commonjs",
"build:rollup": "rollup -c rollup.config.ts",
"docs": "node -e 0",
"predocs2": "rimraf docs/*",
"docs2": "typedoc --module commonjs --readme none --target ES6 --theme markdown --excludeNotExported --excludeExternals --excludePrivate --out docs --mode file src/index.ts",
"test": "ava -v --config ava.config-ts.js",
"pretest-ci": "run-s build",
"test-ci": "ava --fail-fast -v",
"ambient-dts": "run-s ambient-dts-copy ambient-dts-fix-path",
"ambient-dts-copy": "copyfiles -u 1 \"src/**/*.d.ts\" dist",
"ambient-dts-fix-path": "replace-in-files --string='/// <reference path=\"../src/' --replacement='/// <reference path=\"../dist/' 'dist/**/*.d.ts'"
},
"engines": {
"node": ">=9.11.2"
},
"ava": {
"compileEnhancements": false,
"extensions": [
"ts"
],
"require": [
"ts-node/register"
]
},
"prettier": {
"printWidth": 80,
"semi": false,
Expand All @@ -55,9 +51,11 @@
"@types/puppeteer": "*",
"ava": "2.4.0",
"copyfiles": "^2.1.1",
"npm-run-all": "^4.1.5",
"puppeteer": "^2.0.0",
"puppeteer-extra": "^3.1.12",
"replace-in-files-cli": "^0.3.0",
"replace-in-files-cli": "^0.3.1",
"rimraf": "^3.0.0",
"ts-node": "^8.5.4",
"tslint": "^5.20.1",
"tslint-config-prettier": "^1.18.0",
Expand Down
8 changes: 5 additions & 3 deletions packages/puppeteer-extra-plugin-repl/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
"author": "nswbmw & berstend",
"license": "MIT",
"scripts": {
"docs": "exit 0",
"test": "eslint --ext .js .",
"test-ci": "yarn test"
"docs": "node -e 0",
"lint": "eslint --ext .js .",
"test": "run-p lint",
"test-ci": "run-s test"
},
"engines": {
"node": ">=8"
Expand All @@ -31,6 +32,7 @@
"devDependencies": {
"ava": "2.4.0",
"mock-stdin": "^0.3.1",
"npm-run-all": "^4.1.5",
"puppeteer": "^2.0.0"
},
"dependencies": {
Expand Down
Loading

0 comments on commit 006b553

Please sign in to comment.