This repository was archived by the owner on Aug 2, 2019. It is now read-only.
Repository navigation
Expand file tree
/
Copy path.travis.yml
More file actions
157 lines (115 loc) · 6.04 KB
/
Copy path.travis.yml
File metadata and controls
157 lines (115 loc) · 6.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# This builds multiple projects
# [1] the "one-app" of the Book Monkey2 - all components are tied togehter in one big app with explanations
# [2] single apps for each iteration/increment
language: node_js
node_js:
- 9.2.0
cache:
directories:
- node_modules
env:
global:
- GITHUB_ORG="https://GH_TOKEN@github.com/book-monkey2-build"
- GITHUB_NAME="The Buildbot"
- GITHUB_EMAIL="buildbot@angular2buch.de"
matrix:
# remember: each new app requires a new CNAME entry to book-monkey2-build.github.io
- NAME="one-app"
- NAME="iteration-1-components" BLUEPRINT="src/app/book-monkey/iteration-1/components"
- NAME="iteration-1-property-bindings" BLUEPRINT="src/app/book-monkey/iteration-1/property-bindings"
- NAME="iteration-1-event-bindings" BLUEPRINT="src/app/book-monkey/iteration-1/event-bindings"
- NAME="iteration-2-di" BLUEPRINT="src/app/book-monkey/iteration-2/di"
- NAME="iteration-2-navigation" BLUEPRINT="src/app/book-monkey/iteration-2/navigation"
- NAME="iteration-3-http" BLUEPRINT="src/app/book-monkey/iteration-3/http"
- NAME="iteration-3-rxjs" BLUEPRINT="src/app/book-monkey/iteration-3/rxjs"
- NAME="iteration-4-template-driven-forms" BLUEPRINT="src/app/book-monkey/iteration-4/template-driven-forms"
- NAME="iteration-4-reactive-forms" BLUEPRINT="src/app/book-monkey/iteration-4/reactive-forms"
- NAME="iteration-4-custom-validation" BLUEPRINT="src/app/book-monkey/iteration-4/custom-validation"
- NAME="iteration-5-pipes" BLUEPRINT="src/app/book-monkey/iteration-5/pipes"
- NAME="iteration-5-directives" BLUEPRINT="src/app/book-monkey/iteration-5/directives"
- NAME="iteration-6-modules" BLUEPRINT="src/app/book-monkey/iteration-6/modules"
- NAME="iteration-6-lazy-loading" BLUEPRINT="src/app/book-monkey/iteration-6/lazy-loading"
- NAME="iteration-6-guards" BLUEPRINT="src/app/book-monkey/iteration-6/guards"
- NAME="iteration-6-resolver" BLUEPRINT="src/app/book-monkey/iteration-6/resolver"
- NAME="iteration-7-i18n" BLUEPRINT="src/app/book-monkey/iteration-7/i18n"
install:
- npm i --silent --no-optional -g @angular/cli@1.5.4
- npm i --silent --no-optional -g angular-cli-ghpages@0.5.2
script:
- echo "*** BUILDING $NAME ***"
# [1] one-app:
# - fills /dist folder and adds CNAME file as well as 404 file for gh-pages
# - sends compiled version to gh-pages
- if [ "$NAME" == "one-app" ]; then
npm i --silent --no-optional;
ng build --prod --aot --no-vendor-chunk --progress=false --locale en --i18n-file src/messages.en.xtb --i18n-format xtb;
echo "book-monkey2.angular-buch.com" > dist/CNAME;
ngh --repo="$GITHUB_ORG/$NAME.git" --name="$GITHUB_NAME" --email="$GITHUB_EMAIL";
fi
# [2] single apps (mini monkeys)
# - creates multiple single apps by copying file content around
# - sends uncompiled version to master
- if [ "$NAME" != "one-app" ]; then
export NEW_BOOKMONKEY="$TRAVIS_BUILD_DIR/../TMP/BookMonkey";
cd ..;
mkdir TMP;
cd TMP || exit;
ng new BookMonkey --routing --prefix=bm --skip-install;
cd "$NEW_BOOKMONKEY" || exit;
rm -rf .git;
rm -rf src/app/*;
cp -f "$TRAVIS_BUILD_DIR/package.json" package.json;
cp -f "$TRAVIS_BUILD_DIR/package-lock.json" package-lock.json;
npm i --silent --no-optional;
cd "$TRAVIS_BUILD_DIR" || exit;
cp -f .angular-cli.json "$NEW_BOOKMONKEY/";
cp -rf e2e/. "$NEW_BOOKMONKEY/e2e/";
cp -f src/messages.* "$NEW_BOOKMONKEY/src/";
cp -f src/polyfills.ts "$NEW_BOOKMONKEY/src/";
cp -f src/tsconfig.json "$NEW_BOOKMONKEY/src/";
cp -rf "$TRAVIS_BUILD_DIR/$BLUEPRINT/." "$NEW_BOOKMONKEY/src/app/";
echo "body { margin:30px; }" > "$NEW_BOOKMONKEY/src/styles.css";
SEARCH=();
REPLACE=();
SEARCH[0]="import { CommonModule } from '@angular/common'";
REPLACE[0]="import { BrowserModule } from '@angular/platform-browser'";
SEARCH[1]="import { AppRoutingModule } from './app-routing.module.one-app'";
REPLACE[1]="import { AppRoutingModule } from './app-routing.module'";
SEARCH[2]="CommonModule";
REPLACE[2]="BrowserModule";
for i in "${!SEARCH[@]}";
do sed -i "s|${SEARCH[$i]}|${REPLACE[$i]}|g" "$NEW_BOOKMONKEY/src/app/app.module.ts";
done;
unset SEARCH; unset REPLACE;
rm -f "$NEW_BOOKMONKEY/src/app/app-routing.module.one-app.ts";
SEARCH[0]="app/book-monkey/iteration-6/lazy-loading/";
SEARCH[1]="app/book-monkey/iteration-6/guards/";
SEARCH[2]="app/book-monkey/iteration-6/resolver/";
SEARCH[3]="app/book-monkey/iteration-7/i18n/";
for i in "${!SEARCH[@]}";
do sed -i "s|${SEARCH[$i]}|app/|g" "$NEW_BOOKMONKEY/src/app/app-routing.module.ts";
done;
sed -i "s|export const routes|const routes|g" "$NEW_BOOKMONKEY/src/app/app-routing.module.ts";
find $NEW_BOOKMONKEY/src -name "*.snippet" -type f -delete;
echo "*** DIRECTORY LISTING OF $NEW_BOOKMONKEY ***";
ls -a "$NEW_BOOKMONKEY";
ngh --repo="$GITHUB_ORG/$NAME.git" --name="$GITHUB_NAME" --email="$GITHUB_EMAIL" --dir=../TMP/BookMonkey --branch=master;
fi
# [2] single apps:
# - compiles single apps
# - sends them to gh-pages
# OLD dev build: ng build -dev --progress=false;
- if [ "$NAME" != "one-app" ]; then
cd "$NEW_BOOKMONKEY/";
npm i --silent;
ng build --prod --aot --no-vendor-chunk --progress=false --locale en --i18n-file src/messages.en.xtb --i18n-format xtb;
echo "$NAME.angular-buch.com" > dist/CNAME;
ngh --repo="$GITHUB_ORG/$NAME.git" --name="$GITHUB_NAME" --email="$GITHUB_EMAIL";
fi
# a build will finish as soon as a job has failed
matrix:
fast_finish: true
#only building specific branches
branches:
only:
- master