Skip to content

Commit

Permalink
chore: set up samples testing (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
anguillanneuf committed Oct 8, 2020
1 parent 860c443 commit 0d6f0f4
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
11 changes: 9 additions & 2 deletions cloudbuild.yaml
Expand Up @@ -15,11 +15,18 @@
timeout: 1800s # 30 minutes
steps:
- name: gcr.io/cloud-devrel-public-resources/python-multi
id: library
entrypoint: /bin/bash
args:
- '-c'
- |
- '-c'
- |
python3.6 -m pip uninstall --yes --quiet nox-automation && python3.6 -m pip install --upgrade --quiet nox && python3.6 -m nox
- name: gcr.io/cloud-devrel-public-resources/python-multi
id: samples
entrypoint: /bin/bash
args: ['./samples-test-script.sh']
waitFor:
- library

images:
- gcr.io/cloud-devrel-public-resources/python-multi
10 changes: 10 additions & 0 deletions samples-test-script.sh
@@ -0,0 +1,10 @@
export GOOGLE_CLOUD_PROJECT="tz-playground-bigdata"
export GOOGLE_CLOUD_PROJECT_NUMBER=502009289245
export INSTALL_LIBRARY_FROM_SOURCE=True

cd ./samples/snippets

python3.6 -m pip install --quiet nox-automation
python3.6 -m pip install --upgrade --quiet nox
python3.6 -m pip install -r requirements-test.txt
python3.6 -m nox
5 changes: 2 additions & 3 deletions samples/snippets/noxfile.py
Expand Up @@ -85,8 +85,7 @@ def get_pytest_env_vars():

TESTED_VERSIONS = sorted([v for v in ALL_VERSIONS if v not in IGNORED_VERSIONS])

# TODO: change the default to False when this repo is public.
INSTALL_LIBRARY_FROM_SOURCE = bool(os.environ.get("INSTALL_LIBRARY_FROM_SOURCE", True))
INSTALL_LIBRARY_FROM_SOURCE = bool(os.environ.get("INSTALL_LIBRARY_FROM_SOURCE", False))
#
# Style Checks
#
Expand Down Expand Up @@ -198,7 +197,7 @@ def _get_repo_root():
for i in range(10):
if p is None:
break
if Path(p / ".git").exists():
if Path(p / ".github").exists():
return str(p)
p = p.parent
raise Exception("Unable to detect repository root.")
Expand Down
2 changes: 2 additions & 0 deletions samples/snippets/requirements-test.txt
@@ -0,0 +1,2 @@
backoff==1.10.0
pytest==5.3.2

0 comments on commit 0d6f0f4

Please sign in to comment.