2017-08-25 18:05:25 +00:00
|
|
|
# CircleCI automatically reads this file from our repo and uses it for
|
|
|
|
# configuration. Docs:
|
|
|
|
# https://circleci.com/docs/2.0/configuration-reference/
|
|
|
|
# https://circleci.com/docs/2.0/sample-config/
|
|
|
|
version: 2
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
docker:
|
|
|
|
# https://circleci.com/docs/2.0/google-container-engine/#selecting-a-base-image
|
|
|
|
- image: google/cloud-sdk
|
|
|
|
- image: python:2.7.12
|
|
|
|
|
|
|
|
environment:
|
|
|
|
- PYTHONPATH: /usr/lib/google-cloud-sdk/platform/google_appengine
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
|
|
|
|
- restore_cache:
|
|
|
|
key: venv-{{ .Branch }}-{{ checksum "requirements.freeze.txt" }}
|
|
|
|
|
|
|
|
- run:
|
2018-10-16 15:55:22 +00:00
|
|
|
name: Python 2 dependencies
|
2017-08-25 18:05:25 +00:00
|
|
|
command: |
|
|
|
|
apt-get install -y python-virtualenv google-cloud-sdk-app-engine-python-extras
|
|
|
|
virtualenv --python=python2 local
|
|
|
|
. local/bin/activate
|
|
|
|
pip install -r requirements.freeze.txt
|
|
|
|
|
|
|
|
# granary and oauth-dropins master at head. (see pip install -e 's below.)
|
|
|
|
cd /tmp; git clone https://github.com/snarfed/oauth-dropins.git
|
|
|
|
cd /tmp/oauth-dropins; git submodule sync; git submodule update --init
|
|
|
|
cd /tmp/oauth-dropins/oauth_dropins/webutil; git checkout master; git pull
|
|
|
|
pip install -e /tmp/oauth-dropins/
|
|
|
|
pip install -e git+https://github.com/snarfed/granary.git#egg=granary
|
|
|
|
|
|
|
|
ln -s $VIRTUAL_ENV local # we use app engine's vendor module to point here
|
|
|
|
pip install coverage coveralls # for https://coveralls.io/
|
|
|
|
|
2018-10-16 15:55:22 +00:00
|
|
|
- run:
|
|
|
|
name: Build and test
|
|
|
|
command: |
|
|
|
|
. local/bin/activate
|
fix flaky test failure from importing webutil.testutil_appengine
eg https://circleci.com/gh/snarfed/bridgy-fed/164
```
testutil_appengine (unittest.loader.ModuleImportFailure) ... ERROR
...
======================================================================
ERROR: testutil_appengine (unittest.loader.ModuleImportFailure)
----------------------------------------------------------------------
ImportError: Failed to import test module: testutil_appengine
Traceback (most recent call last):
File "/usr/lib/python2.7/unittest/loader.py", line 254, in _find_tests
module = self._get_module_from_name(name)
File "/usr/lib/python2.7/unittest/loader.py", line 232, in _get_module_from_name
__import__(name)
File "/tmp/oauth-dropins/oauth_dropins/webutil/testutil_appengine.py", line 4, in <module>
from google.appengine.datastore import datastore_stub_util
File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/datastore/datastore_stub_util.py", line 69, in <module>
from google.appengine.datastore import datastore_stub_index
File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/datastore/datastore_stub_index.py", line 45, in <module>
import yaml
ImportError: No module named yaml
```
2018-10-16 15:43:58 +00:00
|
|
|
python2 -m coverage run --source=. --omit=appengine_config.py,local/\*,oauth-dropins/\*,tests/\* -m unittest discover -v
|
2017-08-25 18:05:25 +00:00
|
|
|
python2 -m coverage html -d /tmp/coverage_html
|
|
|
|
|
|
|
|
# send coverage data to coveralls
|
|
|
|
if [ "$COVERALLS_REPO_TOKEN" != "" ]; then coveralls; fi
|
|
|
|
|
|
|
|
- save_cache:
|
|
|
|
key: venv-{{ .Branch }}-{{ checksum "requirements.freeze.txt" }}
|
|
|
|
paths:
|
|
|
|
- local
|
|
|
|
|
|
|
|
- store_artifacts:
|
|
|
|
path: /tmp/coverage_html
|