Skip to content

Commit

Permalink
update CI to handle google cloud, other misc
Browse files Browse the repository at this point in the history
* run datastore emulator
* run flake8 to detect aliased test names
* pin typing-extensions to <4.6 for compatibility with multiformats
* use anonymous creds in ndb client

hashberg-io/typing-validation#1
  • Loading branch information
snarfed committed Jul 26, 2023
1 parent 1af1dc7 commit 248f61d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
21 changes: 19 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,38 @@ jobs:
keys:
- venv-1-{{ .Branch }}

- run:
name: Base dependencies
command: |
# google-cloud-sdk: https://cloud.google.com/sdk/docs/install#deb
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates gnupg google-cloud-sdk google-cloud-sdk-datastore-emulator default-jre
git clone --depth=1 https://github.com/bluesky-social/atproto.git ../atproto
- run:
name: Python dependencies
command: |
pip install -U pip
pip -V
pip install -U .[datastore,tests]
pip install coverage coveralls
pip install -U .[datastore,tests] 'typing-extensions<4.6.0'
pip install coverage coveralls flake8
- run:
name: Python tests
command: |
CLOUDSDK_CORE_PROJECT=bridgy-federated gcloud beta emulators datastore start --no-store-on-disk --use-firestore-in-datastore-mode --host-port=localhost:8089 < /dev/null >& /dev/null &
sleep 2s
python -m coverage run --source=. --omit=test_\* -m unittest discover -v
python -m coverage html -d /tmp/coverage_html
if [ "$COVERALLS_REPO_TOKEN" != "" ]; then python -m coveralls || true; fi
# check for unintentionally overridden test methods
# https://flake8.pycqa.org/en/latest/user/error-codes.html#error-codes
# https://flake8.pycqa.org/en/latest/user/options.html#cmdoption-flake8-select
flake8 --select=F811 tests/test_*.py
- save_cache:
key: venv-1-{{ .Branch }}
paths:
Expand Down
3 changes: 2 additions & 1 deletion arroba/tests/test_datastore_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@

from arroba.datastore_storage import AtpNode, DatastoreStorage, WriteOnceBlobProperty
from arroba.storage import BlockMap
from google.auth.credentials import AnonymousCredentials

from .testutil import TestCase

os.environ.setdefault('DATASTORE_EMULATOR_HOST', 'localhost:8089')


class DatastoreStorageTest(TestCase):
ndb_client = ndb.Client()
ndb_client = ndb.Client(project='app', credentials=AnonymousCredentials())

def setUp(self):
super().setUp()
Expand Down
3 changes: 0 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,3 @@ datastore = [
[project.urls]
'Homepage' = 'https://github.com/snarfed/arroba'
'Documentation' = 'https://arroba.readthedocs.io/'

# TODO:
# extras deps: google-cloud-ndb~=2.0

0 comments on commit 248f61d

Please sign in to comment.