ci(aio): deploy from CI to staging

This commit is contained in:
Georgios Kalpakas 2017-01-25 19:39:01 +02:00 committed by Igor Minar
parent c37af2af5a
commit 4165fddfc4
20 changed files with 864 additions and 85 deletions

1
.gitignore vendored
View File

@ -3,6 +3,7 @@
/dist/
node_modules
bower_components
angular.io/dist
# Include when developing application packages.
pubspec.lock

View File

@ -17,15 +17,21 @@ branches:
- g3_v2_0
cache:
yarn: true
directories:
- ./node_modules
- ./.chrome/chromium
- ./angular.io/node_modules
env:
global:
# GITHUB_TOKEN_ANGULAR
# This is needed for the e2e Travis matrix task to publish packages to github for continuous packages delivery.
- secure: "fq/U7VDMWO8O8SnAQkdbkoSe2X92PVqg4d044HmRYVmcf6YbO48+xeGJ8yOk0pCBwl3ISO4Q2ot0x546kxfiYBuHkZetlngZxZCtQiFT9kyId8ZKcYdXaIW9OVdw3Gh3tQyUwDucfkVhqcs52D6NZjyE2aWZ4/d1V4kWRO/LMgo="
# FIREBASE_TOKEN
# This is needed for publishing builds to the "aio-staging" firebase site.
# TODO(i): the token was generated using the iminar@google account, we should switch to a shared/role-base account.
- secure: "MPx3UM77o5IlhT75PKHL0FXoB5tSXDc3vnCXCd1sRy4XUTZ9vjcV6nNuyqEf+SOw659bGbC1FI4mACGx1Q+z7MQDR85b1mcA9uSgHDkh+IR82CnCVdaX9d1RXafdJIArahxfmorbiiPPLyPIKggo7ituRm+2c+iraoCkE/pXxYg="
matrix:
# Order: a slower build first, so that we don't occupy an idle travis worker waiting for others to complete.
- CI_MODE=e2e EXPERIMENTAL_ES2015_DISTRO=1
@ -35,6 +41,7 @@ env:
- CI_MODE=saucelabs_optional
- CI_MODE=browserstack_optional
- CI_MODE=docs_test
- CI_MODE=aio
matrix:
fast_finish: true
@ -48,5 +55,8 @@ install:
script:
- ./scripts/ci-lite/build.sh && ./scripts/ci-lite/test.sh
after_success:
- ./scripts/ci-lite/deploy_aio_staging.sh
after_script:
- ./scripts/ci-lite/cleanup.sh

5
angular.io/.firebaserc Normal file
View File

@ -0,0 +1,5 @@
{
"projects": {
"staging": "aio-staging"
}
}

View File

@ -11,7 +11,7 @@ Run `ng generate component component-name` to generate a new component. You can
## Build
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `-prod` flag for a production build.
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.
## Running unit tests

View File

@ -9,6 +9,6 @@ describe('site App', function() {
it('should display message saying app works', () => {
page.navigateTo();
expect(page.getParagraphText()).toEqual('app works!');
expect(page.getParagraphText()).toEqual('home-page works!');
});
});

View File

@ -6,6 +6,6 @@ export class SitePage {
}
getParagraphText() {
return element(by.css('app-root h1')).getText();
return element(by.css('app-home-page p')).getText();
}
}

View File

@ -1,8 +0,0 @@
<html>
<head>
<title>Placeholder for angular.io</title>
</head>
<body>
This page is just a placeholder for angular.io.
</body>
</html>

View File

@ -1,6 +1,5 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/0.13/config/configuration-file.html
console.log('karama!!!')
module.exports = function (config) {
config.set({
basePath: '',

View File

@ -1,15 +1,22 @@
{
"name": "angular.io",
"version": "0.0.0",
"main": "index.js",
"repository": "git@github.com:angular/angular.git",
"author": "Angular",
"license": "MIT",
"angular-cli": {},
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"lint": "tslint \"src/**/*.ts\" --project src/tsconfig.json --type-check && tslint \"e2e/**/*.ts\" --project e2e/tsconfig.json --type-check",
"test": "ng test",
"pree2e": "webdriver-manager update --standalone false --gecko false",
"e2e": "protractor"
"e2e": "protractor",
"deploy-staging": "firebase use staging --token \"$FIREBASE_TOKEN\" && yarn run ~~deploy",
"pre~~deploy": "ng build --prod",
"~~deploy": "firebase deploy --message \"Commit: $TRAVIS_COMMIT\" --non-interactive --token \"$FIREBASE_TOKEN\""
},
"private": true,
"dependencies": {
@ -33,6 +40,7 @@
"@types/node": "^6.0.42",
"angular-cli": "1.0.0-beta.26",
"codelyzer": "~2.0.0-beta.1",
"firebase-tools": "^3.2.1",
"jasmine-core": "2.5.2",
"jasmine-spec-reporter": "2.5.0",
"karma": "1.2.0",

View File

@ -13,9 +13,9 @@ describe('AppComponent', () => {
// TestBed.compileComponents();
// });
it('should work', () => {
expect(true).toBe(true)
})
})
expect(true).toBe(true);
});
});
// it('should create the app', async(() => {
// const fixture = TestBed.createComponent(AppComponent);

View File

@ -1,7 +1,7 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'ngio-docs-app',
selector: 'app-ngio-docs',
templateUrl: './docs-app.component.html',
styleUrls: ['./docs-app.component.css']
})

View File

@ -1,7 +1,7 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { DocsAppComponent } from './docs-app.component'
import { RouterModule } from '@angular/router'
import { DocsAppComponent } from './docs-app.component';
import { RouterModule } from '@angular/router';
@NgModule({
imports: [

View File

@ -1,7 +1,7 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { HomePageComponent } from './home-page.component';
import { RouterModule } from '@angular/router'
import { RouterModule } from '@angular/router';
@NgModule({
imports: [

File diff suppressed because it is too large Load Diff

View File

@ -19,4 +19,15 @@ node dist/tools/@angular/tsc-wrapped/src/main -p modules/@angular/platform-brows
node dist/tools/@angular/tsc-wrapped/src/main -p modules/@angular/router/tsconfig-build.json
node dist/tools/@angular/tsc-wrapped/src/main -p modules/@angular/forms/tsconfig-build.json
if [[ ${CI_MODE} == "aio" ]]; then
echo 'travis_fold:start:BUILD.aio'
# Build angular.io
cd "`dirname $0`/../../angular.io"
yarn run build
cd -
echo 'travis_fold:end:BUILD.aio'
fi
echo 'travis_fold:end:BUILD'

View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
set -ex -o pipefail
# Only deploy if this Travis job is for the upstream master branch
if [[ ! ${TRAVIS} || ${CI_MODE} != "aio" || ${TRAVIS_PULL_REQUEST} || ${TRAVIS_BRANCH} != "master" ]]; then
echo 0;
fi
echo 'travis_fold:start:aio.deploy'
# Setup environment
cd `dirname $0`
source ./env.sh
cd ../..
echo 'travis_fold:start:aio.deploy.staging'
# Deploy angular.io to staging
cd "`dirname $0`/../../angular.io"
yarn run deploy-staging
cd -
echo 'travis_fold:end:aio.deploy.staging'
echo 'travis_fold:end:aio.deploy'

View File

@ -2,9 +2,11 @@
set -e -o pipefail
echo 'travis_fold:start:ENV'
NODE_VERSION=5.4.1
NPM_VERSION=3.5.3
YARN_VERSION=0.19.1
CHROMIUM_VERSION=403382 # Chrome 53 linux stable, see https://www.chromium.org/developers/calendar
SAUCE_CONNECT_VERSION=4.3.11
@ -45,6 +47,9 @@ fi
# GLOBALS
# Prepend `~/.yarn/bin` to the PATH
export PATH=$HOME/.yarn/bin:$PATH
# Append dist/all to the NODE_PATH so that cjs module resolver finds find the packages that use
# absolute module ids (e.g. @angular/core)
export NODE_PATH=${NODE_PATH}:$(pwd)/../../dist/all:$(pwd)/../../dist/tools
@ -74,3 +79,4 @@ if [[ ${TRAVIS} ]]; then
export CHROME_BIN=${HOME}/.chrome/chromium/chrome-linux/chrome
fi
echo 'travis_fold:end:ENV'

View File

@ -23,7 +23,7 @@ mkdir -p ${LOGS_DIR}
# Install version of npm that we are locked against
echo 'travis_fold:start:install.npm'
npm install -g npm@${NPM_VERSION}
echo 'travis_fold:end:install-npm'
echo 'travis_fold:end:install.npm'
# Install all npm dependencies according to shrinkwrap.json
@ -32,12 +32,31 @@ node tools/npm/check-node-modules --purge || npm install
echo 'travis_fold:end:install.node_modules'
if [[ ${TRAVIS} && ${CI_MODE} == "aio" ]]; then
# angular.io: Install version of yarn that we are locked against
echo 'travis_fold:start:install.aio.yarn'
curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version "${YARN_VERSION}"
echo 'travis_fold:end:install.aio.yarn'
# angular.io: Install all yarn dependencies according to angular.io/yarn.lock
echo 'travis_fold:start:install.aio.node_modules'
cd "`dirname $0`/../../angular.io"
yarn install
cd -
echo 'travis_fold:end:install.aio.node_modules'
fi
# Install Chromium
echo 'travis_fold:start:install.chromium'
if [[ ${CI_MODE} == "js" || ${CI_MODE} == "e2e" ]]; then
if [[ ${CI_MODE} == "js" || ${CI_MODE} == "e2e" || ${CI_MODE} == "aio" ]]; then
./scripts/ci/install_chromium.sh
fi
echo 'travis_fold:end:install-chromium'
echo 'travis_fold:end:install.chromium'
# Install Sauce Connect
echo 'travis_fold:start:install.sauceConnect'

View File

@ -14,7 +14,6 @@ cd ../..
./scripts/ci-lite/test_saucelabs.sh
./scripts/ci-lite/test_browserstack.sh
./scripts/ci-lite/test_docs.sh
echo 'travis_fold:end:test-browser'
./scripts/ci-lite/test_aio.sh
echo 'travis_fold:end:TEST'

62
scripts/ci-lite/test_aio.sh Executable file
View File

@ -0,0 +1,62 @@
#!/usr/bin/env bash
set -ex -o pipefail
if [[ ${TRAVIS} && ${CI_MODE} != "aio" ]]; then
exit 0;
fi
echo 'travis_fold:start:test.aio'
# Setup environment
cd `dirname $0`
source ./env.sh
cd ../..
echo 'travis_fold:start:test.aio.lint'
# Lint the code
cd "`dirname $0`/../../angular.io"
yarn run lint
cd -
echo 'travis_fold:end:test.aio.lint'
echo 'travis_fold:start:test.aio.localChromeSetup'
# Start local Chrome
if [[ ${TRAVIS} ]]; then
sh -e /etc/init.d/xvfb start
fi
echo 'travis_fold:end:test.aio.localChromeSetup'
echo 'travis_fold:start:test.aio.unit'
# Run unit tests
cd "`dirname $0`/../../angular.io"
yarn test -- --single-run
cd -
echo 'travis_fold:end:test.aio.unit'
# TODO: Chrome crashes with the following error:
# E/launcher - unknown error: Chrome failed to start: crashed
# (Driver info: chromedriver=2.26.436382 (70eb799287ce4c2208441fc057053a5b07ceabac),platform=Linux 4.8.12-040812-generic x86_64)
# echo 'travis_fold:start:test.aio.e2e'
#
# # Run e2e tests
# cd "`dirname $0`/../../angular.io"
# yarn start &
# yarn run e2e
# cd -
#
# echo 'travis_fold:end:test.aio.e2e'
echo 'travis_fold:end:test.aio'