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:
|
2020-03-03 15:45:00 +00:00
|
|
|
# https://circleci.com/docs/2.0/google-auth/#installing-the-google-cloud-sdk
|
2017-08-25 18:05:25 +00:00
|
|
|
- image: google/cloud-sdk
|
|
|
|
|
|
|
|
environment:
|
2019-12-26 06:20:57 +00:00
|
|
|
# https://github.com/GoogleCloudPlatform/google-cloud-datastore/issues/168#issuecomment-294418422
|
|
|
|
- APPLICATION_ID: dev~bridgy-federated
|
2017-08-25 18:05:25 +00:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
|
|
|
|
- restore_cache:
|
2019-12-26 06:20:57 +00:00
|
|
|
key: venv-{{ .Branch }}-{{ checksum "requirements.txt" }}
|
2017-08-25 18:05:25 +00:00
|
|
|
|
|
|
|
- run:
|
2020-03-03 15:45:00 +00:00
|
|
|
name: Dependencies
|
2017-08-25 18:05:25 +00:00
|
|
|
command: |
|
2019-12-26 06:20:57 +00:00
|
|
|
apt-get update
|
2020-03-03 15:45:00 +00:00
|
|
|
apt-get install -y python3.7 python3.7-venv python3.7-dev
|
|
|
|
python3.7 -m venv local3
|
2019-12-26 06:20:57 +00:00
|
|
|
. local3/bin/activate
|
circle: fix pip install grpcio breakage
example failure: https://app.circleci.com/pipelines/github/snarfed/oauth-dropins/90/workflows/2fb906b4-78f4-45d7-ad4d-46ed9d28b878/jobs/516
full error log:
```
Running setup.py install for grpcio ... error
Complete output from command /root/project/local3/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-2x6fpemn/grpcio/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-tmyhem3j/install-record.txt --single-version-externally-managed --compile --install-headers /root/project/local3/include/site/python3.7/grpcio:
Cython-generated files are missing...
We could not find Cython. Setup may take 10-20 minutes.
WARNING: The wheel package is not available.
...
Traceback (most recent call last):
File "/tmp/pip-install-mlr1xc5w/grpcio/src/python/grpcio/commands.py", line 264, in build_extensions
build_ext.build_ext.build_extensions(self)
File "/usr/lib/python3.7/distutils/command/build_ext.py", line 449, in build_extensions
self._build_extensions_serial()
File "/usr/lib/python3.7/distutils/command/build_ext.py", line 474, in _build_extensions_serial
self.build_extension(ext)
File "/root/project/local3/lib/python3.7/site-packages/setuptools/command/build_ext.py", line 200, in build_extension
if ext._needs_stub:
AttributeError: 'Extension' object has no attribute '_needs_stub'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-mlr1xc5w/grpcio/setup.py", line 465, in <module>
cmdclass=COMMAND_CLASS,
File "/root/project/local3/lib/python3.7/site-packages/setuptools/__init__.py", line 145, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python3.7/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib/python3.7/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/usr/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/root/project/local3/lib/python3.7/site-packages/setuptools/command/install.py", line 61, in run
return orig.install.run(self)
File "/usr/lib/python3.7/distutils/command/install.py", line 589, in run
self.run_command('build')
File "/usr/lib/python3.7/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/usr/lib/python3.7/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/usr/lib/python3.7/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/root/project/local3/lib/python3.7/site-packages/setuptools/command/build_ext.py", line 78, in run
_build_ext.run(self)
File "/usr/lib/python3.7/distutils/command/build_ext.py", line 340, in run
self.build_extensions()
File "/tmp/pip-install-mlr1xc5w/grpcio/src/python/grpcio/commands.py", line 267, in build_extensions
support.diagnose_build_ext_error(self, error, formatted_exception)
File "/tmp/pip-install-mlr1xc5w/grpcio/src/python/grpcio/support.py", line 118, in diagnose_build_ext_error
diagnostic(build_ext, error)
File "/tmp/pip-install-mlr1xc5w/grpcio/src/python/grpcio/support.py", line 98, in diagnose_attribute_error
"We expect a missing `_needs_stub` attribute from older versions of "
commands.CommandError: We expect a missing `_needs_stub` attribute from older versions of setuptools. Consider upgrading setuptools.
----------------------------------------
Command "/root/project/local3/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-mlr1xc5w/grpcio/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-grvcioh0/install-record.txt --single-version-externally-managed --compile --install-headers /root/project/local3/include/site/python3.7/grpcio" failed with error code 1 in /tmp/pip-install-mlr1xc5w/grpcio/
```
2020-10-15 02:43:55 +00:00
|
|
|
pip install cython # avoids grpcio install bug (search _needs_stub)
|
2019-12-26 06:20:57 +00:00
|
|
|
pip install -U -r requirements.txt
|
|
|
|
pip install mox3
|
|
|
|
pip install coverage coveralls
|
2017-08-25 18:05:25 +00:00
|
|
|
|
2019-12-26 06:20:57 +00:00
|
|
|
- run:
|
|
|
|
name: Build and test
|
|
|
|
command: |
|
|
|
|
. local3/bin/activate
|
|
|
|
CLOUDSDK_CORE_PROJECT=bridgy-federated gcloud beta emulators datastore start --no-store-on-disk --consistency=1.0 --host-port=localhost:8089 < /dev/null >& /dev/null &
|
|
|
|
sleep 5s
|
|
|
|
python -m coverage run --source=. --omit=appengine_config.py,local3/\*,logs.py,tests/\* -m unittest discover -v
|
|
|
|
python -m coverage html -d /tmp/coverage_html
|
2019-08-13 14:14:53 +00:00
|
|
|
if [ "$COVERALLS_REPO_TOKEN" != "" ]; then coveralls || true; fi
|
2017-08-25 18:05:25 +00:00
|
|
|
|
|
|
|
- save_cache:
|
2019-12-26 06:20:57 +00:00
|
|
|
key: venv-{{ .Branch }}-{{ checksum "requirements.txt" }}
|
2017-08-25 18:05:25 +00:00
|
|
|
paths:
|
|
|
|
- local
|
|
|
|
|
|
|
|
- store_artifacts:
|
|
|
|
path: /tmp/coverage_html
|