Skip to content

Commit

Permalink
Merge pull request #1636 from fearphage/fix-headless-chrome-in-circle
Browse files Browse the repository at this point in the history
Fix headless chrome in CircleCI
  • Loading branch information
fatso83 authored Dec 25, 2017
2 parents 78a8986 + 39186f4 commit ca9e2fa
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 13 deletions.
40 changes: 28 additions & 12 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,46 +12,62 @@ jobs:
- checkout
- restore_cache:
keys:
- v1-npm-{{ .Branch }}-{{ checksum "package.json" }}
- v1-npm-master-{{ checksum "package.json" }}
- v3-npm-{{ .Branch }}-{{ checksum "package.json" }}
- v3-npm-master-{{ checksum "package.json" }}
- run:
name: Install dependencies
command: |
npm config set strict-ssl false
# Avoid downloading chromium unnecessarily
npm config set ignore-scripts true
npm install
npm config set ignore-scripts false
# puppeteer install script throws syntax errors for Node v4
# https://github.com/GoogleChrome/puppeteer/blob/f19e2ade0d4859435422131905e932abe3db199c/install.js#L66
if node --version | grep -q '^v4'; then
npm config set ignore-scripts true
npm install
npm config set ignore-scripts false
else
npm install
fi
# install latest chrome unstable version
if node --version | grep -q '^v6'; then
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list
apt-get update
apt-get install -y --no-install-recommends google-chrome-unstable
fi
- run:
name: Pre-Test
# ESLint only supports Node >=4
command: |
NODE_VERSION=$(node --version)
if [[ ${NODE_VERSION:0:3} == "v6." ]]; then
if node --version | grep -q '^v6'; then
npm run lint;
npm run test-headless -- --chrome $(which google-chrome-unstable) --allow-chrome-as-root;
npm run test-webworker -- --chrome $(which google-chrome-unstable) --allow-chrome-as-root;
fi
- run:
name: Test
command: npm run test-node
- save_cache:
key: v1-npm-{{ .Branch }}-{{ checksum "package.json" }}
key: v3-npm-{{ .Branch }}-{{ checksum "package.json" }}
paths:
- node_modules

node-4:
<<: *common-build
docker:
- image: node:4
- image: node:4-alpine

node-6:
<<: *common-build
docker:
- image: node:6-alpine
- image: node:6

node-8:
<<: *common-build
docker:
- image: node:8
- image: node:8-alpine
environment:
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true

workflows:
version: 2
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"lint-staged": "^4.0.0",
"markdownlint-cli": "^0.4.0",
"mocha": "^4.0.0",
"mochify": "^5.0.0",
"mochify": "^5.1.0",
"mochify-istanbul": "^2.4.1",
"native-promise-only": "^0.8.1",
"npm-run-all": "^4.0.2",
Expand Down

0 comments on commit ca9e2fa

Please sign in to comment.