Skip to content
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

Add Appveyor CI #18

Merged
merged 2 commits into from
Aug 30, 2017
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
37 changes: 37 additions & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
clone_depth: 10

version: "{build}"

environment:
fast_finish: true
matrix:
- nodejs_version: "6"
platform: x86
# node 7 is skipped, as appveyor only allows 1 concurrent job
# and we want appveyor finishing ASAP. see #2382
# - nodejs_version: "7"
# platform: x86

build: off

install:
- ps: Install-Product node $env:nodejs_version $env:platform
- npm install yarn -g
- yarn

before_test:
- set "PATH=C:\MinGW\msys\1.0\bin;%PATH%"
- set "LIGHTHOUSE_CHROMIUM_PATH=%CD%\chrome-win32\chrome.exe"
- bash ./scripts/download-chrome.sh
- yarn build

test_script:
- node --version
- npm --version
- yarn --version
- which yarn
- yarn test

cache:
#- chrome-win32 -> appveyor.yml,package.json
- node_modules -> appveyor.yml,package.json,yarn.lock
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# Chrome Launcher [![NPM chrome-launcher package](https://img.shields.io/npm/v/chrome-launcher.svg)](https://npmjs.org/package/chrome-launcher)
# Chrome Launcher [![Linux Build Status](https://img.shields.io/travis/GoogleChrome/chrome-launcher/master.svg)](https://travis-ci.org/GoogleChrome/chrome-launcher) [![Windows Build Status](https://img.shields.io/appveyor/ci/paulirish/chrome-launcher/master.svg)](https://ci.appveyor.com/project/paulirish/chrome-launcher/branch/master) [![NPM chrome-launcher package](https://img.shields.io/npm/v/chrome-launcher.svg)](https://npmjs.org/package/chrome-launcher)


<img src="https://user-images.githubusercontent.com/39191/29847271-a7ba82f8-8ccf-11e7-8d54-eb88fdf0b6d0.png" align=right height=200>

Launch Google Chrome with ease from node.

* [Disables many Chrome services](https://github.com/GoogleChrome/lighthouse/blob/master/chrome-launcher/flags.ts) that add noise to automated scenarios
* [Disables many Chrome services](https://github.com/GoogleChrome/chrome-launcher/blob/master/flags.ts) that add noise to automated scenarios
* Opens up the browser's `remote-debugging-port` on an available port
* Automagically locates a Chrome binary to launch
* Uses a fresh Chrome profile for each launch, and cleans itself up on `kill()`
Expand Down Expand Up @@ -113,9 +114,9 @@ chromeLauncher.launch({

### Continuous Integration

In a CI environment like Travis, Chrome may not be installed. If you want to use `chrome-launcher`, you can install Chrome using Lighthouse's `download-chrome.sh` script:
In a CI environment like Travis, Chrome may not be installed. If you want to use `chrome-launcher`, you can install Chrome using the `download-chrome.sh` script:

`curl -L https://raw.githubusercontent.com/GoogleChrome/lighthouse/v2.1.0/lighthouse-core/scripts/download-chrome.sh | bash`
`curl -L https://raw.githubusercontent.com/GoogleChrome/chrome-launcher/master/scripts/download-chrome.sh | bash`

Then in `.travis.yml`, use it like so:

Expand All @@ -127,5 +128,5 @@ before_script:
- export DISPLAY=:99.0
- export CHROME_PATH="$(pwd)/chrome-linux/chrome"
- sh -e /etc/init.d/xvfb start
- curl -L https://raw.githubusercontent.com/GoogleChrome/lighthouse/v2.1.0/lighthouse-core/scripts/download-chrome.sh | bash
- curl -L https://raw.githubusercontent.com/GoogleChrome/chrome-launcher/master/scripts/download-chrome.sh | bash
```
26 changes: 26 additions & 0 deletions scripts/download-chrome.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash

##
# @license Copyright 2017 Google Inc. All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
##

# Download chrome inside of our CI env.

if [ "$APPVEYOR" == "True" ]; then
url="https://download-chromium.appspot.com/dl/Win?type=snapshots"
else
url="https://download-chromium.appspot.com/dl/Linux_x64?type=snapshots"
fi

if [ x"$LIGHTHOUSE_CHROMIUM_PATH" == x ]; then
echo "Error: Environment variable LIGHTHOUSE_CHROMIUM_PATH not set"
exit 1
fi

if [ -e "$LIGHTHOUSE_CHROMIUM_PATH" ]; then
echo "cached chrome found"
else
wget "$url" --no-check-certificate -q -O chrome.zip && unzip chrome.zip
fi