Skip to content
This repository was archived by the owner on Apr 4, 2025. It is now read-only.

Commit 8ad69fe

Browse files
authored
chore: enable travis testing and deployment
- add a job for testing - add a job that deploys after test success when on master - refactor protractor config into local and travis - update build.js to account for Travis environment NOTE: pushing to dist branch on Github is currently not enabled on Travis Closes #222
1 parent 568e2f1 commit 8ad69fe

9 files changed

+106
-23
lines changed

.firebaserc

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"projects": {
3+
"default": "google.com:angular-sites"
4+
}
5+
}

.travis.yml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
language: node_js
2+
sudo: false
3+
node_js:
4+
- '6'
5+
6+
cache:
7+
yarn: true
8+
9+
jobs:
10+
include:
11+
- stage: test
12+
addons:
13+
sauce_connect:
14+
username: angular-ci
15+
jwt:
16+
secure: "NJ6eWX3YarBTf2LOjOXFhGfRQ90WQ4ZrukAHUxTyUc1o3AXURb3WRi1HzXFh4fnlliBuaCY85/B5oSctvVg+evAOfnqOPm0WN/AP4/PIY6Xicc3jJDmyaeHtfvq2hb6QwxOciM/Ht7WxPsmlIR0wLz98CwqrOPxltjj25E9pPK4="
17+
script:
18+
- mkdir build
19+
- travis_retry yarn run build copy test
20+
- stage: deploy
21+
# https://docs.travis-ci.com/user/conditional-builds-stages-jobs#Specifying-conditions
22+
if: type != pull_request AND branch = master
23+
script:
24+
- mkdir build
25+
# - "yarn run build copy dist" # dist adds the build to the dist folder
26+
- "yarn run build copy"
27+
deploy:
28+
- provider: Firebase
29+
# the upload folder for firebase is configured in /firebase.json
30+
skip_cleanup: true
31+
message: "Commit: $TRAVIS_COMMIT"
32+
token:
33+
# token generated by [email protected] on 2017/10/13
34+
secure: "GRRRA+vodB/NvBW7BM4UJ9huwcE29pEHMSn6SJWIZtFjeoOpIUVocqQcOxYEDzJqwBxQmpAqejRxHzsNaPLVs+cdC7m0Tg+QH3pktyob3/kqwyOc0wm0WrinswXZ4CcOlFUZ2AGakQYO1QFZWRfoXIfW8WwNApTj/1p9Rc/xLvY="
35+
on:
36+
repo: angular/angularjs.org
37+
branch:
38+
- master

DEPLOYMENT.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Setting up Firebase
2+
3+
- run `yarn add -g firebase-tools`
4+
5+
# Manually deploying the contents of the build folder
6+
7+
(You need to be logged in and have access to the project)
8+
9+
- run `yarn run build`
10+
- run `firebase deploy --only=hosting`
11+
12+
# Generating a new Token for Travis
13+
See https://docs.travis-ci.com/user/deployment/firebase/

README.md

+1-8
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,4 @@ and browse to http://localhost:8080
1717
The site relies upon accessing numerous additional resources from all over the web.
1818

1919
Hint: to access the AngularJS docs application rather than this site, which is only the homepage,
20-
clone the main project and build the docs yourself...
21-
22-
git clone https://github.com/angular/angular.js.git
23-
cd angular.js
24-
npm install
25-
grunt package webserver
26-
27-
Then browse to http://localhost:8000/build/docs/api
20+
clone the main project and build the docs yourself. See https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md

firebase.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"hosting": {
3+
"public": "build",
4+
"ignore": [
5+
"/scss/",
6+
"/*.php",
7+
"/propagateClusterUpdate.js"
8+
]
9+
}
10+
}

protractorConfLocal.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
var config = require('./protractorConfShared').config;
2+
3+
config.capabilities = {
4+
'browserName': 'chrome'
5+
};
6+
7+
config.directConnect = true;
8+
9+
exports.config = config;
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
exports.config = {
22
baseUrl: process.env.ANGULAR_HOME_HOST || 'http://angularjs.org',
3-
capabilities: {
4-
'browserName': 'chrome'
5-
},
6-
directConnect: true,
73
specs: [
84
'test/angularjs.org.spec.js',
95
]
10-
};
6+
};

protractorConfTravis.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
var config = require('./protractorConfShared').config;
2+
3+
config.sauceUser = process.env.SAUCE_USERNAME;
4+
config.sauceKey = process.env.SAUCE_ACCESS_KEY;
5+
6+
config.capabilities = {
7+
'browserName': 'chrome',
8+
'build': process.env.TRAVIS_BUILD_NUMBER,
9+
'elementScrollBehavior': 1,
10+
'name': 'AngularJS.org E2E',
11+
'tunnel-identifier': process.env.TRAVIS_JOB_NUMBER
12+
};
13+
14+
exports.config = config;

scripts/build.js

+15-10
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const SRC_DIR = 'src';
1515
const CDN_VERSIONS = ['1.2', '1.6'];
1616
const CDN_REPLACE_FILES = ['index.html', 'js/download-data.js'];
1717
const GIT_BRANCH_DIST = 'dist';
18-
const PTOR_CONF = 'protractorConf.js';
18+
const PTOR_CONF = process.env.TRAVIS ? 'protractorConfTravis.js' : 'protractorConfLocal.js';
1919
const PTOR_PORT = '8100';
2020
const PTOR_ENV = {
2121
ANGULAR_HOME_HOST: `http://localhost:${PTOR_PORT}`,
@@ -133,20 +133,25 @@ function replaceCdnVersionsInFiles(cdnVersions) {
133133
function testBuild() {
134134
announce(`Testing the current build (ENV: ${JSON.stringify(PTOR_ENV, null, 2)})...`);
135135

136-
const installCmd = `${utils.getExecutable('yarn', true)} install`;
137-
const wdrManagerCmd = `${utils.getExecutable('webdriver-manager')} update`;
138-
const httpServerCmd = `${utils.getExecutable('http-server')} -p ${PTOR_PORT} ${DST_DIR}`;
139-
const protractorCmd = `${utils.getExecutable('protractor')} ${PTOR_CONF}`;
140-
141136
const protractorOptions = {
142137
env: Object.assign(process.env, PTOR_ENV),
143138
stdio: 'inherit'
144139
};
145140

146-
const installPromise = chain(Promise.resolve(), installCmd);
147-
const wdrManagerPromise = chain(installPromise, wdrManagerCmd);
148-
const httpServerPromise = chain(wdrManagerPromise, httpServerCmd);
149-
const protractorPromise = chain(wdrManagerPromise, protractorCmd, protractorOptions);
141+
const installCmd = `${utils.getExecutable('yarn', true)} install`;
142+
const httpServerCmd = `${utils.getExecutable('http-server')} -p ${PTOR_PORT} ${DST_DIR}`;
143+
const wdrManagerCmd = `${utils.getExecutable('webdriver-manager')} update`;
144+
const protractorCmd = `${utils.getExecutable('protractor')} ${PTOR_CONF}`;
145+
146+
let setupPromise = Promise.resolve();
147+
148+
if (!process.env.TRAVIS) {
149+
setupPromise = chain(setupPromise, installCmd);
150+
setupPromise = chain(setupPromise, wdrManagerCmd);
151+
}
152+
153+
const httpServerPromise = chain(setupPromise, httpServerCmd);
154+
const protractorPromise = chain(setupPromise, protractorCmd, protractorOptions);
150155

151156
const killHttpServer = () => httpServerPromise.$$killProcess();
152157

0 commit comments

Comments
 (0)