Skip to content

Commit a29b713

Browse files
committed
remove sauce connect addon from travis and replace with shell script
1 parent effef8d commit a29b713

File tree

2 files changed

+62
-3
lines changed

2 files changed

+62
-3
lines changed

Diff for: .travis.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@ env:
66
global:
77
- SAUCE_USERNAME=fullstack_ci
88
- SAUCE_ACCESS_KEY=1a527ca6-4aa5-4618-86ce-0278bf158cbf
9-
addons:
10-
sauce_connect: true
119
before_install:
10+
- ./scripts/sauce_connect_setup.sh
1211
- gem update --system
1312
- gem install sass --version "=3.3.7"
1413
- npm install -g bower grunt-cli
15-
services: mongodb
14+
services: mongodb

Diff for: scripts/sauce_connect_setup.sh

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/bin/bash
2+
3+
# Setup and start Sauce Connect for your TravisCI build
4+
# This script requires your .travis.yml to include the following two private env variables:
5+
# SAUCE_USERNAME
6+
# SAUCE_ACCESS_KEY
7+
# Follow the steps at https://saucelabs.com/opensource/travis to set that up.
8+
# https://gist.githubusercontent.com/santiycr/4683e262467c0a84d857/raw/1254ace59257e341ab200cbc8946e626756f079f/sauce-connect.sh
9+
10+
if [ -z "${SAUCE_USERNAME}" ] || [ -z "${SAUCE_ACCESS_KEY}" ]; then
11+
echo "This script can't run without your Sauce credentials"
12+
echo "Please set SAUCE_USERNAME and SAUCE_ACCESS_KEY env variables"
13+
echo "export SAUCE_USERNAME=ur-username"
14+
echo "export SAUCE_ACCESS_KEY=ur-access-key"
15+
exit 1
16+
fi
17+
18+
SAUCE_TMP_DIR="$(mktemp -d -t sc.XXXX)"
19+
echo "Using temp dir $SAUCE_TMP_DIR"
20+
pushd $SAUCE_TMP_DIR
21+
22+
SAUCE_CONNECT_PLATFORM=$(uname | sed -e 's/Darwin/osx/' -e 's/Linux/linux/')
23+
case "${SAUCE_CONNECT_PLATFORM}" in
24+
linux)
25+
SC_DISTRIBUTION_FMT=tar.gz;;
26+
*)
27+
SC_DISTRIBUTION_FMT=zip;;
28+
esac
29+
SC_DISTRIBUTION=sc-latest-${SAUCE_CONNECT_PLATFORM}.${SC_DISTRIBUTION_FMT}
30+
SC_READYFILE=sauce-connect-ready-$RANDOM
31+
SC_LOGFILE=$HOME/sauce-connect.log
32+
if [ ! -z "${TRAVIS_JOB_NUMBER}" ]; then
33+
SC_TUNNEL_ID="-i ${TRAVIS_JOB_NUMBER}"
34+
fi
35+
echo "Downloading Sauce Connect"
36+
wget https://saucelabs.com/downloads/${SC_DISTRIBUTION}
37+
SC_DIR=$(tar -ztf ${SC_DISTRIBUTION} | head -n1)
38+
39+
echo "Extracting Sauce Connect"
40+
case "${SC_DISTRIBUTION_FMT}" in
41+
tar.gz)
42+
tar zxf $SC_DISTRIBUTION;;
43+
zip)
44+
unzip $SC_DISTRIBUTION;;
45+
esac
46+
47+
echo "Starting Sauce Connect"
48+
${SC_DIR}/bin/sc \
49+
${SC_TUNNEL_ID} \
50+
-f ${SC_READYFILE} \
51+
-l ${SC_LOGFILE} &
52+
53+
echo "Waiting for Sauce Connect readyfile"
54+
while [ ! -f ${SC_READYFILE} ]; do
55+
sleep .5
56+
done
57+
58+
unset SAUCE_CONNECT_PLATFORM SAUCE_TMP_DIR SC_DIR SC_DISTRIBUTION SC_READYFILE SC_LOGFILE SC_TUNNEL_ID
59+
60+
popd

0 commit comments

Comments
 (0)