forked from oppia/oppia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
155 lines (143 loc) · 8.01 KB
/
.travis.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
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
sudo: required
# In order to install Chrome stable we need trusty distribution.
dist: trusty
language: python
python:
- 2.7
addons:
browserstack:
username: $USERNAME
access_key: $ACCESS_KEY
branches:
only:
- master
- develop
- /^release-\d+\.\d+\.\d+$/
- /^release-\d+\.\d+\.\d+-hotfix-\d+$/
env:
matrix:
- RUN_LINT=true
- RUN_FRONTEND_TESTS=true
- RUN_BACKEND_TESTS=true REPORT_BACKEND_COVERAGE=false EXCLUDE_LOAD_TESTS=true
# TODO(sll): Reinstate this when we can get it to run in reasonable time.
# - RUN_BACKEND_TESTS=true REPORT_BACKEND_COVERAGE=true
# TODO(sll): Reinstate this when the load tests are more reliable.
# - RUN_BACKEND_TESTS=true REPORT_BACKEND_COVERAGE=true EXCLUDE_LOAD_TESTS=false
- RUN_E2E_TESTS_ACCESSIBILITY=true
- RUN_E2E_TESTS_ADDITIONAL_EDITOR_AND_PLAYER_FEATURES=true
- RUN_E2E_TESTS_COLLECTIONS=true
- RUN_E2E_TESTS_CORE_EDITOR_AND_PLAYER_FEATURES=true
- RUN_E2E_TESTS_EMBEDDING=true
- RUN_E2E_TESTS_EXPLORATION_FEEDBACK_TAB=true
- RUN_E2E_TESTS_EXPLORATION_HISTORY_TAB=true
- RUN_E2E_TESTS_EXPLORATION_STATISTICS_TAB=true
- RUN_E2E_TESTS_EXPLORATION_TRANSLATION_TAB=true
- RUN_E2E_TESTS_EXTENSIONS=true
- RUN_E2E_TESTS_LEARNER_DASHBOARD=true
- RUN_E2E_TESTS_LEARNER=true
- RUN_E2E_TESTS_LIBRARY=true
- RUN_E2E_TESTS_NAVIGATION=true
- RUN_E2E_TESTS_PREFERENCES=true
- RUN_E2E_TESTS_PROFILE_MENU=true
- RUN_E2E_TESTS_PUBLICATION=true
- RUN_E2E_TESTS_SUBSCRIPTIONS=true
- RUN_E2E_TESTS_TOPICS_AND_SKILLS_DASHBOARD=true
- RUN_E2E_TESTS_USERS=true
matrix:
allow_failures: []
fast_finish: true
jobs:
include:
# The mobile end-to-end tests are run only for the develop branch as the
# BrowserStack credentials are stored as encrypted Travis environment
# variables and are therefore not available for forks of the repository.
# For more details, refer to https://docs.travis-ci.com/user/environment-variables#encrypting-environment-variables
if: branch = develop AND type = push
env: RUN_E2E_TESTS_MOBILE=true
notifications:
email:
recipients:
on_success: change
on_failure: change
irc:
channels:
- chat.freenode.net#oppia
on_success: never
on_failure: always
webhooks:
urls:
# This URL can be obtained by going to the Gitter chat room
# and clicking Settings > Integrations.
- https://webhooks.gitter.im/e/f8f782497ec1ffcea2e7
on_success: always
on_failure: always
before_install:
# For the rationale behind the next two lines, see:
# https://github.com/travis-ci/travis-ci/issues/6928#issuecomment-264227708
- source /opt/jdk_switcher/jdk_switcher.sh
- jdk_switcher use oraclejdk8
- pip install codecov
- pip install pyyaml
- export CHROME_BIN=/usr/bin/google-chrome-stable
- export DISPLAY=:99.0
- bash -e /etc/init.d/xvfb start
install:
- pushd $TRAVIS_BUILD_DIR
- source scripts/setup.sh || exit 1
- source scripts/setup_gae.sh || exit 1
script:
- if [ "$RUN_LINT" == 'true' ]; then bash scripts/install_third_party.sh; python scripts/third_party_size_check.py; python scripts/pre_commit_linter.py --path=.; fi
# Travis aborts test run if nothing is printed back to STDOUT for some time.
# -x is used to avoid that.
- if [ "$RUN_FRONTEND_TESTS" == 'true' ]; then travis_retry bash -x scripts/run_frontend_tests.sh --run-minified-tests=true; fi
- if [ "$RUN_BACKEND_TESTS" == 'true' ] && [ "$REPORT_BACKEND_COVERAGE" == 'true' ] && [ "$EXCLUDE_LOAD_TESTS" == 'true' ]; then bash scripts/run_backend_tests.sh --generate_coverage_report --exclude_load_tests; fi
- if [ "$RUN_BACKEND_TESTS" == 'true' ] && [ "$REPORT_BACKEND_COVERAGE" == 'false' ] && [ "$EXCLUDE_LOAD_TESTS" == 'true' ]; then bash scripts/run_backend_tests.sh --exclude_load_tests; fi
- if [ "$RUN_BACKEND_TESTS" == 'true' ] && [ "$REPORT_BACKEND_COVERAGE" == 'true' ] && [ "$EXCLUDE_LOAD_TESTS" == 'false' ]; then bash scripts/run_backend_tests.sh --generate_coverage_report; fi
- if [ "$RUN_BACKEND_TESTS" == 'true' ] && [ "$REPORT_BACKEND_COVERAGE" == 'false' ] && [ "$EXCLUDE_LOAD_TESTS" == 'false' ]; then bash scripts/run_backend_tests.sh; fi
# Run e2e tests in production mode.
- if [ "$RUN_E2E_TESTS_ACCESSIBILITY" == 'true' ]; then travis_retry bash scripts/run_e2e_tests.sh --suite="accessibility" --prod_env; fi
- if [ "$RUN_E2E_TESTS_ADDITIONAL_EDITOR_AND_PLAYER_FEATURES" == 'true' ]; then travis_retry bash scripts/run_e2e_tests.sh --suite="additionalEditorAndPlayerFeatures" --prod_env; fi
- if [ "$RUN_E2E_TESTS_COLLECTIONS" == 'true' ]; then travis_retry bash scripts/run_e2e_tests.sh --suite="collections" --prod_env; fi
- if [ "$RUN_E2E_TESTS_CORE_EDITOR_AND_PLAYER_FEATURES" == 'true' ]; then travis_retry bash scripts/run_e2e_tests.sh --suite="coreEditorAndPlayerFeatures" --prod_env; fi
- if [ "$RUN_E2E_TESTS_EMBEDDING" == 'true' ]; then travis_retry bash scripts/run_e2e_tests.sh --suite="embedding" --prod_env; fi
- if [ "$RUN_E2E_TESTS_EXPLORATION_FEEDBACK_TAB" == 'true' ]; then travis_retry bash scripts/run_e2e_tests.sh --suite="explorationFeedbackTab" --prod_env; fi
- if [ "$RUN_E2E_TESTS_EXPLORATION_HISTORY_TAB" == 'true' ]; then travis_retry bash scripts/run_e2e_tests.sh --suite="explorationHistoryTab" --prod_env; fi
- if [ "$RUN_E2E_TESTS_EXPLORATION_STATISTICS_TAB" == 'true' ]; then travis_retry bash scripts/run_e2e_tests.sh --suite="explorationStatisticsTab" --prod_env; fi
- if [ "$RUN_E2E_TESTS_EXPLORATION_TRANSLATION_TAB" == 'true' ]; then travis_retry bash scripts/run_e2e_tests.sh --suite="explorationTranslationTab" --prod_env; fi
- if [ "$RUN_E2E_TESTS_EXTENSIONS" == 'true' ]; then travis_retry bash scripts/run_e2e_tests.sh --suite="extensions" --prod_env; fi
- if [ "$RUN_E2E_TESTS_LEARNER_DASHBOARD" == 'true' ]; then travis_retry bash scripts/run_e2e_tests.sh --suite="learnerDashboard" --prod_env; fi
- if [ "$RUN_E2E_TESTS_LEARNER" == 'true' ]; then travis_retry bash scripts/run_e2e_tests.sh --suite="learner" --prod_env; fi
- if [ "$RUN_E2E_TESTS_LIBRARY" == 'true' ]; then travis_retry bash scripts/run_e2e_tests.sh --suite="library" --prod_env; fi
- if [ "$RUN_E2E_TESTS_NAVIGATION" == 'true' ]; then travis_retry bash scripts/run_e2e_tests.sh --suite="navigation" --prod_env; fi
- if [ "$RUN_E2E_TESTS_PREFERENCES" == 'true' ]; then travis_retry bash scripts/run_e2e_tests.sh --suite="preferences" --prod_env; fi
- if [ "$RUN_E2E_TESTS_PROFILE_MENU" == 'true' ]; then travis_retry bash scripts/run_e2e_tests.sh --suite="profileMenu" --prod_env; fi
- if [ "$RUN_E2E_TESTS_PUBLICATION" == 'true' ]; then travis_retry bash scripts/run_e2e_tests.sh --suite="publication" --prod_env; fi
- if [ "$RUN_E2E_TESTS_SUBSCRIPTIONS" == 'true' ]; then travis_retry bash scripts/run_e2e_tests.sh --suite="subscriptions" --prod_env; fi
- if [ "$RUN_E2E_TESTS_TOPICS_AND_SKILLS_DASHBOARD" == 'true' ]; then travis_retry bash scripts/run_e2e_tests.sh --suite="topicsAndSkillsDashboard" --prod_env; fi
- if [ "$RUN_E2E_TESTS_USERS" == 'true' ]; then travis_retry bash scripts/run_e2e_tests.sh --suite="users" --prod_env; fi
# Run e2e tests for mobile in dev mode since the demo explorations and collections are only available in the dev mode and not in production mode.
- if [ "$RUN_E2E_TESTS_MOBILE" == 'true' ]; then travis_retry bash scripts/run_e2e_tests.sh --browserstack; fi
after_success:
- if [ "$RUN_BACKEND_TESTS" == 'true' ] && [ "$REPORT_BACKEND_COVERAGE" == 'true' ]; then codecov; fi
- if [ "$RUN_FRONTEND_TESTS" == 'true' ]; then codecov --file ../karma_coverage_reports/coverage-final.json; fi
cache:
# Cache Oppia's dependencies.
directories:
- ../node_modules/
- ../oppia_tools/
- third_party/
- $HOME/.cache/pip
- $HOME/.cache/TravisChrome/
- backend_prod_files/templates/head/
- build/templates/head/
- backend_prod_files/extensions/
- build/extensions/
before_cache:
# Delete python bytecode to prevent cache rebuild.
- find third_party -name "*.pyc" -print -delete
- find backend_prod_files/extensions/ -name "*.pyc" -print -delete