Skip to content

Commit 6470434

Browse files
committed
Merge branch 'master' into center-wifi-text
* master: (34 commits) reduce newlines in Card indent the cache- config keys more to make it clearer that they're aliases apply eslint-ignore to the appropriate lines prettify and fix eslint fix forgetting to make functions async prevent iOS / Android from printing messages unless a dependency changed remove pointless `export` notations remove Test stage from travis and rework config inheritance for the remaining jobs add CircleCI config add dependencies for new danger tasks flesh out runAndroid flesh out runiOS import remaining tools and utility functions invoke gradle / xcodeproj rules from js-general analyze the pbxproj file for various ailments flesh out danger rules for Gradle / Android analysis add danger rule to check for XML entities in the Info.plist flesh out danger task: jest flesh out danger task: flow flesh out danger task: eslint ...
2 parents 6fe0421 + bd758b3 commit 6470434

File tree

11 files changed

+1383
-305
lines changed

11 files changed

+1383
-305
lines changed

.circleci/config.yml

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
version: 2
2+
3+
x-config:
4+
- &restore-cache-yarn
5+
keys:
6+
- 'v2-dependencies-{{ checksum "yarn.lock" }}'
7+
- 'v2-dependencies-'
8+
- &save-cache-yarn
9+
paths: [~/.cache/yarn]
10+
key: 'v2-dependencies-{{ checksum "yarn.lock" }}'
11+
12+
workflows:
13+
version: 2
14+
analyze:
15+
jobs:
16+
- danger
17+
- flow
18+
- jest
19+
- prettier
20+
- eslint
21+
- data
22+
23+
jobs:
24+
danger:
25+
docker: [{image: 'circleci/node:8'}]
26+
environment: {task: JS-general}
27+
steps:
28+
- checkout
29+
- restore_cache: *restore-cache-yarn
30+
- run: yarn install
31+
- save_cache: *save-cache-yarn
32+
- run: yarn run danger --id $task
33+
34+
flow:
35+
docker: [{image: 'circleci/node:8'}]
36+
environment: {task: JS-flow}
37+
steps:
38+
- checkout
39+
- restore_cache: *restore-cache-yarn
40+
- run: yarn install
41+
- save_cache: *save-cache-yarn
42+
- run: mkdir -p logs/
43+
- run: yarn run bundle-data
44+
- run: yarn run --silent flow check --quiet | tee logs/flow
45+
- run: yarn run danger --id $task
46+
47+
jest:
48+
docker: [{image: 'circleci/node:8'}]
49+
environment: {task: JS-jest}
50+
steps:
51+
- checkout
52+
- restore_cache: *restore-cache-yarn
53+
- run: yarn install
54+
- save_cache: *save-cache-yarn
55+
- run: mkdir -p logs/
56+
- run: yarn run bundle-data
57+
- run: yarn run --silent test --coverage 2>&1 | tee logs/jest
58+
- run: yarn run danger --id $task
59+
- run: yarn global add coveralls
60+
- run:
61+
name: coveralls
62+
command: |
63+
export PATH=$PATH:$(yarn global bin)
64+
export COVERALLS_SERVICE_NAME=CircleCI
65+
export COVERALLS_SERVICE_JOB_ID=$CIRCLE_BUILD_NUM
66+
coveralls < ./coverage/lcov.info
67+
68+
prettier:
69+
docker: [{image: 'circleci/node:8'}]
70+
environment: {task: JS-prettier}
71+
steps:
72+
- checkout
73+
- restore_cache: *restore-cache-yarn
74+
- run: yarn install
75+
- save_cache: *save-cache-yarn
76+
- run: mkdir -p logs/
77+
- run: yarn run prettier
78+
- run:
79+
name: git diff
80+
command: |
81+
touch logs/prettier # to ensure that the file exists
82+
if ! git diff --quiet *.js source/ scripts/; then
83+
git diff *.js source/ scripts/ | tee logs/prettier
84+
fi
85+
- run: yarn run danger --id $task
86+
87+
eslint:
88+
docker: [{image: 'circleci/node:8'}]
89+
environment: {task: JS-lint}
90+
steps:
91+
- checkout
92+
- restore_cache: *restore-cache-yarn
93+
- run: yarn install
94+
- save_cache: *save-cache-yarn
95+
- run: mkdir -p logs/
96+
- run: yarn run bundle-data
97+
- run: yarn run --silent lint | tee logs/eslint
98+
- run: yarn run danger --id $task
99+
100+
data:
101+
docker: [{image: 'circleci/node:8'}]
102+
environment: {task: JS-data}
103+
steps:
104+
- checkout
105+
- restore_cache: *restore-cache-yarn
106+
- run: yarn install
107+
- save_cache: *save-cache-yarn
108+
- run: mkdir -p logs/
109+
- run: yarn run --silent validate-data --quiet | tee logs/validate-data
110+
- run: yarn run --silent validate-bus-data | tee logs/validate-bus-data
111+
- run: yarn run danger --id $task

.travis.yml

Lines changed: 82 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -30,92 +30,107 @@ branches:
3030
stages:
3131
- name: Greenkeeper
3232
if: branch =~ ^greenkeeper\/
33-
- name: Test
3433
- name: Deploy Data
3534
if: branch = master AND type != pull_request
3635
- name: Build + Deploy App
3736

3837

38+
#
39+
# Definitions of dictionaries that are used by the machines below
40+
#
41+
42+
x-definitions:
43+
- &base
44+
before_install:
45+
# print some travis debugging info
46+
- echo "Now testing on $TRAVIS_OS_NAME"
47+
- echo "Travis branch is $TRAVIS_BRANCH"
48+
- echo "Travis is in pull request $TRAVIS_PULL_REQUEST"
49+
- echo "Build triggered by $TRAVIS_EVENT_TYPE"
50+
51+
# force the ruby we want
52+
- echo "Using ruby $TRAVIS_RUBY_VERSION (ruby -v says $(ruby -v))"
53+
- rvm use $TRAVIS_RUBY_VERSION --install --binary --create
54+
- echo "ruby -v is now $(ruby -v)"
55+
- gem install bundler
56+
57+
# force a consistent node version
58+
- echo "Using node $TRAVIS_NODE_VERSION (node -v says $(node -v))"
59+
- nvm install "$TRAVIS_NODE_VERSION"
60+
- nvm use "$TRAVIS_NODE_VERSION"
61+
- echo "node -v is now $(node -v)"
62+
63+
# travis doesn't install yarn automatically on osx
64+
- if [[ $TRAVIS_OS_NAME == "osx" ]]; then brew install yarn --without-node; fi
65+
66+
install:
67+
# install packages (if the first fails, try once more)
68+
- yarn || yarn
69+
70+
# install fastlane (if at first you don't succeed, try once more)
71+
- bundle install || bundle install
72+
73+
before_script:
74+
# ensure the env file exists and fill it out
75+
- touch .env.js
76+
- echo "export const GOOGLE_CALENDAR_API_KEY = '$GCAL_KEY'" >> .env.js
77+
- echo "export const GOOGLE_MAPS_API_KEY = '$GMAPS_KEY'" >> .env.js
78+
79+
# disable npm wrapper for npm scripts
80+
- npm config set loglevel=silent
81+
- mkdir -p logs/
82+
83+
after_script:
84+
- npm config set loglevel=notice
85+
- npm run danger -- --id $task
86+
87+
before_cache:
88+
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
89+
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
90+
91+
- &simplejs
92+
os: linux
93+
sudo: false
94+
distro: trusty
95+
language: node_js
96+
node_js: $TRAVIS_NODE_VERSION
97+
98+
3999
jobs:
40100
# We define default before_install, install, and before_script steps.
41101
# To skip the default step, use `step_name: skip`.
42102
include:
43103
# Run greenkeeper stuff
44-
- stage: Greenkeeper
45-
os: linux
46-
sudo: false
47-
language: node_js
48-
node_js: node # install the latest node
49-
env: [GREENKEEPER=yes]
50-
before_install: skip
104+
- <<: *simplejs
105+
stage: Greenkeeper
106+
env: [task=GREENKEEPER]
51107
install: npm install -g greenkeeper-lockfile@1
52-
before_script: skip
53108
script: greenkeeper-lockfile-update
54109
after_script: greenkeeper-lockfile-upload
55110

56-
# Do node "tests"
57-
- stage: Test
58-
os: linux
59-
sudo: false
60-
distro: trusty
61-
language: node_js
62-
node_js: $TRAVIS_NODE_VERSION
63-
env: [JS=yes]
64-
before_install:
65-
- npm install -g coveralls
66-
install:
67-
- yarn || yarn
68-
before_script:
69-
- echo "loglevel=silent" >> .npmrc
70-
- mkdir -p logs/
111+
# Deploy the gh-pages data
112+
- <<: *simplejs
113+
stage: Deploy Data
114+
env: [task=GH_PAGES]
115+
install: yarn || yarn
71116
script:
72-
# Ensure failing status in the pipes
73-
- set -o pipefail
74-
# Ensure prettiness
75-
- npm run prettier
76-
- if ! git diff --quiet ./*.js source/; then
77-
git diff ./*.js source/ > logs/prettier;
78-
fi
79-
# Lint
80-
- npm run lint | tee logs/eslint
81-
# Validate data
82-
- npm run validate-data -- --quiet | tee logs/validate-data
83-
- npm run validate-bus-data | tee logs/validate-bus-data
117+
- npm run validate-bus-data
118+
- npm run validate-data
84119
- npm run bundle-data
85-
# Type check and run tests
86-
- npm run flow -- check --quiet | tee logs/flow
87-
- npm run test -- --coverage 2>&1 | tee logs/jest
88-
after_script:
89-
- npm run danger
90-
after_success:
91-
- coveralls < ./coverage/lcov.info
92-
93-
# Deploy the gh-pages data
94-
- stage: Deploy Data
95-
os: linux
96-
sudo: false
97-
distro: trusty
98-
language: node_js
99-
node_js: $TRAVIS_NODE_VERSION
100-
env: [GH_PAGES=yes]
101-
before_install: skip
102-
install:
103-
- yarn || yarn
104-
before_script: skip
105-
script: npm run bundle-data
106120
deploy:
107121
provider: pages
108122
skip_cleanup: true
109123
github_token: $GITHUB_PAGES_TOKEN
110124
local_dir: docs/
111125

112126
# Build/deploy the Android binary
113-
- stage: Build + Deploy
127+
- <<: *base
128+
stage: Build + Deploy
114129
os: linux
115130
sudo: required
116131
distro: trusty
117132
language: android
118-
env: [ANDROID=yes]
133+
env: [task=ANDROID]
119134
android:
120135
components:
121136
- tools
@@ -133,69 +148,22 @@ jobs:
133148
- extra-android-m2repository
134149
- extra-google-m2repository
135150
script:
136-
- bundle exec fastlane android ci-run
151+
- bundle exec fastlane android ci-run | tee ./logs/build
137152

138153
# Build/deploy the iOS binary
139-
- stage: Build + Deploy
154+
- <<: *base
155+
stage: Build + Deploy
140156
os: osx
141157
language: objective-c
142-
osx_image: xcode9
143-
env: [IOS=yes]
158+
osx_image: xcode9.2
159+
env: [task=IOS]
144160
script:
145-
- bundle exec fastlane ios ci-run
146-
147-
#
148-
# All of the keys down here are used in each build stage, unless they're overridden.
149-
#
150-
151-
before_install:
152-
# print some travis debugging info
153-
- echo "Now testing on $TRAVIS_OS_NAME"
154-
- echo "Travis branch is $TRAVIS_BRANCH"
155-
- echo "Travis is in pull request $TRAVIS_PULL_REQUEST"
156-
- echo "Build triggered by $TRAVIS_EVENT_TYPE"
157-
158-
# force the ruby we want
159-
- echo "Using ruby $TRAVIS_RUBY_VERSION (ruby -v says $(ruby -v))"
160-
- rvm use $TRAVIS_RUBY_VERSION --install --binary --create
161-
- echo "ruby -v is now $(ruby -v)"
162-
- gem install bundler
163-
164-
# force a consistent node version
165-
- echo "Using node $TRAVIS_NODE_VERSION (node -v says $(node -v))"
166-
- nvm install "$TRAVIS_NODE_VERSION"
167-
- nvm use "$TRAVIS_NODE_VERSION"
168-
- echo "node -v is now $(node -v)"
169-
170-
# travis doesn't install yarn automatically on osx
171-
- if [[ $TRAVIS_OS_NAME == "osx" ]]; then brew install yarn --without-node; fi
172-
173-
174-
install:
175-
# install packages (if the first fails, try once more)
176-
- yarn || yarn
177-
178-
# install fastlane (if at first you don't succeed, try once more)
179-
- bundle install || bundle install
180-
181-
182-
before_script:
183-
# ensure the env file exists and fill it out
184-
- touch .env.js
185-
- echo "export const GOOGLE_CALENDAR_API_KEY = '$GCAL_KEY'" >> .env.js
186-
- echo "export const GOOGLE_MAPS_API_KEY = '$GMAPS_KEY'" >> .env.js
187-
188-
# disable npm wrapper for npm scripts
189-
- echo "loglevel=silent" >> .npmrc
190-
191-
192-
before_cache:
193-
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
194-
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
195-
- rm -rf $TMPDIR/jest_preprocess_cache
161+
- bundle exec fastlane ios ci-run | tee ./logs/build
162+
- python2 ./scripts/analyze-gym.py -s 20 < ./logs/build | tee ./logs/analysis || true
196163

197164
cache:
198165
bundler: true
166+
yarn: true
199167
directories:
200168
- $HOME/.gradle
201169
- $HOME/.gradle/wrapper/

0 commit comments

Comments
 (0)