-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #482 from edx-solutions/feanil/circle_ci
Feanil/circle ci
- Loading branch information
Showing
5 changed files
with
367 additions
and
194 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
machine: | ||
python: | ||
version: 2.7.3 | ||
|
||
general: | ||
artifacts: | ||
- "reports" | ||
- "test_root/log" | ||
|
||
dependencies: | ||
override: | ||
- npm install | ||
- bundle install | ||
|
||
- pip install setuptools | ||
- pip install -r requirements/edx/paver.txt | ||
|
||
# Mirror what paver install_prereqs does. | ||
# After a successful build, CircleCI will | ||
# cache the virtualenv at that state, so that | ||
# the next build will not need to install them | ||
# from scratch again. | ||
- pip install -r requirements/edx/pre.txt | ||
- pip install -r requirements/edx/github.txt | ||
- pip install -r requirements/edx/local.txt | ||
|
||
# HACK: within base.txt stevedore had a | ||
# dependency on a version range of pbr. | ||
# Install a version which falls within that range. | ||
- pip install pbr==0.9.0 | ||
- pip install -r requirements/edx/base.txt | ||
- if [ -e requirements/edx/post.txt ]; then pip install -r requirements/edx/post.txt ; fi | ||
|
||
- pip install coveralls | ||
|
||
test: | ||
override: | ||
# Run tests for the system. | ||
# all-tests.sh is the entry point for determining | ||
# which tests to run. | ||
# See the circleCI documentation regarding parallelism | ||
# to understand how multiple containers can be used to | ||
# run subsets of tests in parallel. | ||
- ./scripts/all-tests.sh: | ||
parallel: true | ||
|
||
post: | ||
- mkdir -p $CIRCLE_TEST_REPORTS/junit | ||
# Copy the junit results up to be consumed by circleci, | ||
# but only do this if there actually are results. | ||
# Note that the greater than zero comparison is doing a | ||
# string compare, but that should be fine for our purposes here. | ||
# Do this on each of the containers that were used in | ||
# the build so that all results are consolidated. | ||
- "if [ $(find reports -type f | wc -l) -gt 0 ] ; then cp -r reports/. $CIRCLE_TEST_REPORTS/junit ; fi": | ||
parallel: true | ||
|
||
# If you have enabled coveralls for your repo, configure your COVERALLS_REPO_TOKEN | ||
# as an Environment Variable in the Project Settings on CircleCI, and coverage | ||
# data will automatically be sent to coveralls. See https://coveralls.io/ | ||
# If you have not set up set up coveralls then the following statement will | ||
# print a message but not affect the pass/fail status of the build. | ||
- if [ -z $COVERALLS_REPO_TOKEN ]; then echo "Coveralls token not defined."; else coveralls; fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
#!/usr/bin/env bash | ||
############################################################################### | ||
# | ||
# circle-ci-tests.sh | ||
# | ||
# Execute tests for edx-platform on circleci.com | ||
# | ||
# Forks should configure parallelism, and use this script | ||
# to define which tests to run in each of the containers. | ||
# | ||
############################################################################### | ||
|
||
# From the sh(1) man page of FreeBSD: | ||
# Exit immediately if any untested command fails. in non-interactive | ||
# mode. The exit status of a command is considered to be explicitly | ||
# tested if the command is part of the list used to control an if, | ||
# elif, while, or until; if the command is the left hand operand of | ||
# an “&&” or “||” operator; or if the command is a pipeline preceded | ||
# by the ! operator. If a shell function is executed and its exit | ||
# status is explicitly tested, all commands of the function are con‐ | ||
# sidered to be tested as well. | ||
set -e | ||
|
||
# Return status is that of the last command to fail in a | ||
# piped command, or a zero if they all succeed. | ||
set -o pipefail | ||
|
||
# There is no need to install the prereqs, as this was already | ||
# just done via the dependencies override section of circle.yml. | ||
export NO_PREREQ_INSTALL='true' | ||
|
||
EXIT=0 | ||
|
||
case $CIRCLE_NODE_INDEX in | ||
0) # run the quality metrics | ||
echo "Finding fixme's and storing report..." | ||
paver find_fixme > fixme.log || { cat fixme.log; EXIT=1; } | ||
|
||
echo "Finding pep8 violations and storing report..." | ||
paver run_pep8 > pep8.log || { cat pep8.log; EXIT=1; } | ||
|
||
echo "Finding pylint violations and storing in report..." | ||
# HACK: we need to print something to the console, otherwise circleci | ||
# fails and aborts the job because nothing is displayed for > 10 minutes. | ||
paver run_pylint -l $PYLINT_THRESHOLD | tee pylint.log || EXIT=1 | ||
|
||
# Run quality task. Pass in the 'fail-under' percentage to diff-quality | ||
paver run_quality -p 100 || EXIT=1 | ||
|
||
mkdir -p reports | ||
echo "Finding jshint violations and storing report..." | ||
PATH=$PATH:node_modules/.bin | ||
paver run_jshint -l $JSHINT_THRESHOLD > jshint.log || { cat jshint.log; EXIT=1; } | ||
echo "Running code complexity report (python)." | ||
paver run_complexity > reports/code_complexity.log || echo "Unable to calculate code complexity. Ignoring error." | ||
|
||
exit $EXIT | ||
;; | ||
|
||
1) # run all of the lms unit tests | ||
paver test_system -s lms --extra_args="--with-flaky" --cov_args="-p" | ||
;; | ||
|
||
2) # run all of the cms unit tests | ||
paver test_system -s cms --extra_args="--with-flaky" --cov_args="-p" | ||
;; | ||
|
||
3) # run the commonlib unit tests | ||
paver test_lib --extra_args="--with-flaky" --cov_args="-p" | ||
;; | ||
|
||
*) | ||
echo "No tests were executed in this container." | ||
echo "Please adjust scripts/circle-ci-tests.sh to match your parallelism." | ||
exit 1 | ||
;; | ||
esac |
Oops, something went wrong.