Skip to content

Commit 321eda8

Browse files
committed
Trying out a basic port of ci-lite.
1 parent 8b07cf3 commit 321eda8

6 files changed

Lines changed: 36 additions & 7 deletions

File tree

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ env:
1212
- SAUCE_ACCESS_KEY=72e4f85f-4e6b-4971-b8c5-f6707308f63e
1313
- SAUCE_USERNAME="mgiambalvo"
1414
- SAUCE_CONNECT_VERSION="4.4.0"
15+
- LOGS_DIR="/tmp/logs"
1516
matrix:
1617
- CI_MODE=local
1718
- CI_MODE=saucelabs
@@ -23,11 +24,10 @@ cache:
2324
install:
2425
- cd tour-of-heroes
2526
- npm install
27+
- cd ..
2628

2729
before_script:
2830
- ./scripts/travis_setup.sh
2931

3032
script:
31-
- npm run lint
32-
- npm run test -- --watch=false
33-
- npm run travis
33+
- ./scripts/travis_test.sh

scripts/env.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export SAUCE_ACCESS_KEY="72e4f85f-4e6b-4971-b8c5-f6707308f63e"
2+
export SAUCE_USERNAME="mgiambalvo"
3+
export SAUCE_CONNECT_VERSION="4.4.0"
4+
export LOGS_DIR="/tmp/logs"

scripts/travis_setup.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
# Sets up the test environment on Travis.
22

3+
set -ex -o pipefail
4+
cd `dirname $0`
5+
source ./env.sh
6+
37
# Start Xvfb when running locally.
48
if [[ ${TRAVIS} && (${CI_MODE} == "local") ]]; then
59
/etc/init.d/xvfb start
610
fi
711

812
# Start SauceConnect when running on SauceLabs.
913
if [[ ${TRAVIS} && (${CI_MODE} == "saucelabs") ]]; then
10-
./scripts/sauce_connect_setup.sh
14+
./sauce_connect_setup.sh
1115
fi

scripts/travis_test.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
11
# Runs the Travis CI
22

3+
set -ex -o pipefail
4+
cd `dirname $0`
5+
source ./env.sh
6+
cd ../tour-of-heroes
37

8+
ng build
9+
npm run lint
10+
npm run test -- --watch=false
11+
12+
# When using saucelabs, use a different config.
13+
if [[ ${TRAVIS} && (${CI_MODE} == "saucelabs") ]]; then
14+
PROTRACTOR_CONFIG="protractor-saucelabs.conf.js"
15+
fi
16+
17+
concurrently --success first --kill-others \"lite-server\" \"protractor $PROTRACTOR_CONFIG\"

tour-of-heroes/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88
"lint": "tslint \"src/**/*.ts\"",
99
"test": "ng test",
1010
"pree2e": "webdriver-manager update",
11-
"e2e": "protractor",
12-
"pretravis": "ng build",
13-
"travis": "concurrently --success first --kill-others \"lite-server\" \"npm run e2e\""
11+
"e2e": "protractor"
1412
},
1513
"private": true,
1614
"dependencies": {
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
var defaultConfig = require('./protractor.conf.js').config;
2+
3+
var ciConfig = {
4+
sauceUser: process.env.SAUCE_USERNAME,
5+
sauceKey: process.env.SAUCE_ACCESS_KEY
6+
};
7+
8+
exports.config = Object.assign(defaultConfig, ciConfig);
9+
console.log(exports.config);

0 commit comments

Comments
 (0)