Skip to content

Commit

Permalink
bring in download-chrome.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
paulirish committed Aug 30, 2017
1 parent e792730 commit 1334bf5
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ install:
before_test:
- set "PATH=C:\MinGW\msys\1.0\bin;%PATH%"
- set "LIGHTHOUSE_CHROMIUM_PATH=%CD%\chrome-win32\chrome.exe"
- bash ./lighthouse-core/scripts/download-chrome.sh
- bash ./scripts/download-chrome.sh
- yarn build

test_script:
Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# 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)


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 @@ -111,9 +112,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 @@ -125,5 +126,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

0 comments on commit 1334bf5

Please sign in to comment.