geckodriver: Build using OSX on travis (#125)
authorjgraham <james@hoppipolla.co.uk>
Thu, 30 Jun 2016 16:35:14 +0100
changeset 359527 d6bd699db2640eb77439be42762ae8ae63ef0078
parent 359526 3c1d24f0259ffff539c2adcd83475de607b6bdb7
child 359528 1d61e25c67012c7b131eae235557653026e02faf
push id31854
push userarchaeopteryx@coole-files.de
push dateSat, 20 May 2017 16:46:00 +0000
treeherdermozilla-central@51736db67723 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
geckodriver: Build using OSX on travis (#125) Source-Repo: https://github.com/mozilla/geckodriver Source-Revision: 567e2f5b160fbe85e185f50b4ea7b3a5e9fe23e7 committer: GitHub <noreply@github.com>
testing/geckodriver/.travis.yml
testing/geckodriver/ci.sh
--- a/testing/geckodriver/.travis.yml
+++ b/testing/geckodriver/.travis.yml
@@ -1,36 +1,41 @@
 language: generic
 
 matrix:
   include:
-    - env: TARGET=armv7-unknown-linux-gnueabihf
+    - os: linux
+      env: TARGET=armv7-unknown-linux-gnueabihf
       addons:
         apt:
           packages: &armhf
           - gcc-arm-linux-gnueabihf
           - libc6-armhf-cross
           - libc6-dev-armhf-cross
-    - env: TARGET=x86_64-unknown-linux-musl
+    - os: linux
+      env: TARGET=x86_64-unknown-linux-musl
       dist: trusty
       sudo: required
       addons:
         apt:
           packages:
           - musl-tools
           - libbz2-dev
-    - env: TARGET=x86_64-pc-windows-gnu
+    - os: linux
+      env: TARGET=x86_64-pc-windows-gnu
       dist: trusty
       addons:
         apt:
           packages:
           - gcc-mingw-w64
           - gcc-mingw-w64-x86-64
           - binutils-mingw-w64-x86-64
           - libbz2-dev
+    - os: osx
+      env: TARGET=x86_64-apple-darwin
 
 install:
   - export PATH="$PATH:$HOME/.cargo/bin"
   - curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain=stable
   - rustc -V
   - cargo -V
 
 script:
@@ -43,14 +48,15 @@ branches:
 deploy:
   provider: releases
   api_key:
     secure:
       OY6y0xRhlGSBH+3+7+7K6s4pp0Tf3BA61NAubEK4gpO23AKfyJUK+vqqCbdo06Z0E4QO4O1ke6fot7Gq9EdxJmsl/Kk5LDd9Rv3BXSYdjPupzs7coYuD8wv10NfAX6ETd9ITyPim2Zq6bq8nx1S2ESTpos/js1HCtVW3nrlCV58=
   skip_cleanup: true
   file:
     - "geckodriver-$TRAVIS_TAG.tar.gz"
-    - "geckodriver-$TRAVIS_TAG-arm7hf.zip"
+    - "geckodriver-$TRAVIS_TAG-arm7hf.tar.gz"
+    - "geckodriver-$TRAVIS_TAG-linux64.tar.gz"
+    - "geckodriver-$TRAVIS_TAG-mac.tar.gz"
     - "geckodriver-$TRAVIS_TAG-win64.zip"
-    - "geckodriver-$TRAVIS_TAG-linux64.tar.gz"
   on:
     tags: true
     repo: mozilla/geckodriver
--- a/testing/geckodriver/ci.sh
+++ b/testing/geckodriver/ci.sh
@@ -1,140 +1,143 @@
 set -ex
 
 # Add provided target to current Rust toolchain if it is not already
 # the default or installed.
 rustup_target_add() {
-	if ! rustup target list | grep -E "$1 \((default|installed)\)"
-	then
-		rustup target add $1
-	fi
+    if ! rustup target list | grep -E "$1 \((default|installed)\)"
+    then
+        rustup target add $1
+    fi
 }
 
 # Configure rustc target for cross compilation.  Provided with a build
 # target, this will determine which linker to use for cross compilation.
 cargo_config() {
-	local prefix
+    local prefix
 
-	case "$TARGET" in
-	aarch64-unknown-linux-gnu)
-		prefix=aarch64-linux-gnu
-		;;
-	arm*-unknown-linux-gnueabihf)
-		prefix=arm-linux-gnueabihf
-		;;
-	arm-unknown-linux-gnueabi)
-		prefix=arm-linux-gnueabi
-		;;
-	mipsel-unknown-linux-musl)
-		prefix=mipsel-openwrt-linux
-		;;
-	x86_64-pc-windows-gnu)
-		prefix=x86_64-w64-mingw32
-		;;
-	*)
-		return
-		;;
-	esac
+    case "$TARGET" in
+    aarch64-unknown-linux-gnu)
+        prefix=aarch64-linux-gnu
+        ;;
+    arm*-unknown-linux-gnueabihf)
+        prefix=arm-linux-gnueabihf
+        ;;
+    arm-unknown-linux-gnueabi)
+        prefix=arm-linux-gnueabi
+        ;;
+    mipsel-unknown-linux-musl)
+        prefix=mipsel-openwrt-linux
+        ;;
+    x86_64-pc-windows-gnu)
+        prefix=x86_64-w64-mingw32
+        ;;
+    *)
+        return
+        ;;
+    esac
 
-	mkdir -p ~/.cargo
-	cat >>~/.cargo/config <<EOF
+    mkdir -p ~/.cargo
+    cat >>~/.cargo/config <<EOF
 [target.$TARGET]
 linker = "$prefix-gcc"
 EOF
 }
 
 # Build current crate for given target and print file type information.
 # If the second argument is set, a release build will be made.
 cargo_build() {
-	local mode
-	if [ -z "$2" ]
-	then
-		mode=debug
-	else
-		mode=release
-	fi
+    local mode
+    if [ -z "$2" ]
+    then
+        mode=debug
+    else
+        mode=release
+    fi
 
-	local modeflag
-	if [ "$mode" == "release" ]
-	then
-		modeflag=--release
-	fi
-	
-	cargo build --target $1 $modeflag
+    local modeflag
+    if [ "$mode" == "release" ]
+    then
+        modeflag=--release
+    fi
 
-	file $(get_binary $1 $mode)
+    cargo build --target $1 $modeflag
+
+    file $(get_binary $1 $mode)
 }
 
 # Run current crate's tests if the current system supports it.
 cargo_test() {
-	if echo "$1" | grep -E "(i686|x86_64)-unknown-linux-(gnu|musl)"
-	then
-		cargo test --target $1
-	fi
+    if echo "$1" | grep -E "(i686|x86_64)-unknown-linux-(gnu|musl)|darwin"
+    then
+        cargo test --target $1
+    fi
 }
 
 # Returns relative path to binary
 # based on build target and type ("release"/"debug").
 get_binary() {
-	local ext
-	if [[ "$1" =~ "windows" ]]
-	then
-		ext=".exe"
-	fi
-	echo "target/$1/$2/geckodriver$ext"
+    local ext
+    if [[ "$1" =~ "windows" ]]
+    then
+        ext=".exe"
+    fi
+    echo "target/$1/$2/geckodriver$ext"
 }
 
 # Create a compressed archive of the binary
 # for the given given git tag, build target, and build type.
 package_binary() {
-	local target
-	case "$2" in
-	armv7-unknown-linux-gnueabihf)
-		target=arm7hf
-		;;
-	x86_64-pc-windows-gnu)
-		target=win64
-		;;
-	x86_64-unknown-linux-musl)
-		target=linux64
-		;;
-	esac
+    local target
+    case "$2" in
+    armv7-unknown-linux-gnueabihf)
+        target=arm7hf
+        ;;
+    x86_64-pc-windows-gnu)
+        target=win64
+        ;;
+    x86_64-unknown-linux-musl)
+        target=linux64
+        ;;
+    x86_64-apple-darwin)
+        target=mac
+        ;;
+    esac
 
-	local bin
-	bin=$(get_binary $2 $3)
-	cp $bin .
+    local bin
+    bin=$(get_binary $2 $3)
+    cp $bin .
 
-	if [[ "$2" =~ "windows" ]]
-	then
-		zip geckodriver-$1-$target.zip geckodriver.exe
-		file geckodriver-$1-$target.zip
-	else
-		tar zcvf geckodriver-$1-$target.tar.gz geckodriver
-		file geckodriver-$1-$target.tar.gz
-	fi
+    if [[ "$2" =~ "windows" ]]
+    then
+        zip geckodriver-$1-$target.zip geckodriver.exe
+        file geckodriver-$1-$target.zip
+    else
+        tar zcvf geckodriver-$1-$target.tar.gz geckodriver
+        file geckodriver-$1-$target.tar.gz
+    fi
 }
 
 # Create a compressed archive of the source code
 # for the given git tag.
 package_source() {
-	git archive --format=tar --prefix="geckodriver-$1/" $1 | \
-		gzip >geckodriver-$1.tar.gz
+    git archive --format=tar --prefix="geckodriver-$1/" $1 | \
+        gzip >geckodriver-$1.tar.gz
 }
 
 main() {
-	rustup_target_add $TARGET
+    rustup_target_add $TARGET
 
-	cargo_config $TARGET
-	cargo_build $TARGET
-	cargo_test $TARGET
+    cargo_config $TARGET
+    cargo_build $TARGET
+    cargo_test $TARGET
 
-	# when something is tagged,
-	# also create a release build and package it
-	if [ ! -z "$TRAVIS_TAG" ]
-	then
-		cargo_build $TARGET 1
-		package_binary $TRAVIS_TAG $TARGET "release"
-		package_source $TRAVIS_TAG
-	fi
+    # when something is tagged,
+    # also create a release build and package it
+    if [ ! -z "$TRAVIS_TAG" ]
+    then
+        cargo_build $TARGET 1
+        package_binary $TRAVIS_TAG $TARGET "release"
+        package_source $TRAVIS_TAG
+    fi
 }
 
 main