forked from xolvio/Letterpress
-
Notifications
You must be signed in to change notification settings - Fork 0
/
circle.yml
108 lines (87 loc) · 4.6 KB
/
circle.yml
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
machine:
java:
version: oraclejdk8
environment:
# Enable this to debug builds
#VELOCITY_DEBUG: true
SETTINGS_FILE: "../environments/build/settings.json"
STRIPE_SECRET_KEY: $TEST_STRIPE_SECRET_KEY
dependencies:
cache_directories:
- "~/.meteor"
- "~/.npm"
- "~/_opt"
override:
# -- CACHE CHROME --
# ...remove default ChromeDriver for safety
- sudo rm -rf /usr/local/bin/chromedriver*
# ...update to the latest chrome if the version is v38x (TODO need a better grep)
- sudo rm /tmp/update-chrome || true
- /opt/google/chrome/chrome --version | grep '38' &> /dev/null; if [ $? == 0 ]; then echo UPDATE_CHROME > /tmp/update-chrome; fi
# ...check if we already have a tarred version and untar that
- if [ -e /tmp/update-chrome ] && [ -e ~/_opt/google-chrome.tar ]; then sudo tar -xvf ~/_opt/google-chrome.tar -C /; fi
# ...otherwise download chrome and tar it
- if [ -e /tmp/update-chrome ] && [ ! -e ~/_opt/google-chrome.tar ]; then wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -; fi
- if [ -e /tmp/update-chrome ] && [ ! -e ~/_opt/google-chrome.tar ]; then sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'; fi
- if [ -e /tmp/update-chrome ] && [ ! -e ~/_opt/google-chrome.tar ]; then sudo apt-get update; fi
- if [ -e /tmp/update-chrome ] && [ ! -e ~/_opt/google-chrome.tar ]; then sudo apt-get install google-chrome-stable; fi
- if [ -e /tmp/update-chrome ] && [ ! -e ~/_opt/google-chrome.tar ]; then mkdir ~/_opt; tar -cvf ~/_opt/google-chrome.tar /opt/google/chrome/; fi
# -- CACHE METEOR --
# Restore the meteor symlink
- if [ -d ~/.meteor ]; then sudo ln -s ~/.meteor/meteor /usr/local/bin/meteor; fi
# Install Meteor if the cache didn't restore it
- if [ ! -e ~/.meteor/meteor ]; then curl https://install.meteor.com | sh; fi
# -- CACHE CUCUMBER NPM MODULES --
# Install Meteor related dependencies
- node ../environments/build/velocity.js:
pwd: app
environment:
INSTALL_DEPENDENCIES: true
# -- UPDATE NPM --
- cd $HOME/.meteor/packages/meteor-tool/1.1.4/mt-*/dev_bundle/lib && ../bin/npm install npm
- cd $HOME/.meteor/packages/velocity_meteor-tool/1.1.4_2/mt-*/dev_bundle/lib && ../bin/npm install npm
# -- CACHE CUCUMBER NPM MODULES --
# Install package dependencies for Cucumber support files
- npm install --production:
pwd: app/tests/cucumber
# -- CACHE METEOR UP --
- npm install -g mupx
test:
override:
# Package testing using velocity-cli
# - velocity test-package login --ci --settings settings.development.json
# Test the app with Chrome and ensure all artifacts can be traced back to the chrome run
- node ../environments/build/velocity.js:
pwd: app
environment:
CUCUMBER_SCREENSHOTS_DIR: "$CIRCLE_ARTIFACTS/screenshots/chrome"
CUCUMBER_JSON_OUTPUT: "$CIRCLE_TEST_REPORTS/chrome.cucumber"
SELENIUM_BROWSER: chrome
- mkdir -p $CIRCLE_ARTIFACTS/chrome
- cp app/.meteor/local/log/*.log $CIRCLE_ARTIFACTS/chrome
# Test the app with Firefox and ensure all artifacts can be traced back to the firefox run
- node ../environments/build/velocity.js:
pwd: app
environment:
# no need to run server integration tests again since browser choice has no impact
JASMINE_SERVER_INTEGRATION: 0
CUCUMBER_SCREENSHOTS_DIR: "$CIRCLE_ARTIFACTS/screenshots/firefox"
CUCUMBER_JSON_OUTPUT: "$CIRCLE_TEST_REPORTS/firefox.cucumber"
SELENIUM_BROWSER: firefox
- mkdir -p $CIRCLE_ARTIFACTS/firefox
- cp app/.meteor/local/log/*.log $CIRCLE_ARTIFACTS/firefox
deployment:
production:
branch: 'master'
commands:
# Put our secret environment variables into the mup.json env vars section
- sed -i.bak s^%MAIL_URL%^$LIVE_MAIL_URL^g environments/production/mup.json
- sed -i.bak s^%SIMIAN_ACCESS_TOKEN%^$SIMIAN_ACCESS_TOKEN^g environments/production/mup.json
- sed -i.bak s^%MONGO_URL%^$LIVE_MONGO_URL^g environments/production/mup.json
- sed -i.bak s^%MONGO_OPLOG_URL%^$LIVE_MONGO_OPLOG_URL^g environments/production/mup.json
- sed -i.bak s^%STRIPE_SECRET_KEY%^$TEST_STRIPE_SECRET_KEY^g environments/production/mup.json
# Copy the CloudFront pem file into the private dir of the app
- cp /home/ubuntu/.ssh/id_e63a7fbbf2c423eb3271dcfe03a6fec2 app/private/pk-APKAI6S56DROMMGID6BA.pem
# Run Meteor-up deployment using file with secure vars
- mupx deploy:
pwd: environments/production