Skip to content
This repository was archived by the owner on Mar 29, 2023. It is now read-only.

Commit 95e066f

Browse files
authored
Setup GitHub Actions to run system tests (#1)
* test: setup GitHub Actions to run system tests This should allow the system-tests.yml workflow to run when the `run-ci` label is attached to the PR. * update README (#1) * add deps * remove artifacts
1 parent 77461e4 commit 95e066f

26 files changed

+231
-19
lines changed

.github/workflows/system-tests.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: System Tests
2+
3+
on:
4+
pull_request_target:
5+
types: [ labeled ]
6+
7+
jobs:
8+
build:
9+
name: System Tests
10+
# Since this has access to secrets, only run if the PR has manually been
11+
# deemed 'safe' to run by a maintainer.
12+
# https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
13+
if: ${{ github.event.label.name == 'run-ci' }}
14+
runs-on: ubuntu-latest
15+
env:
16+
BACKENDS: "bigquery"
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
python_version: ["3.7", "3.9"]
21+
steps:
22+
- name: checkout
23+
uses: actions/checkout@v2
24+
with:
25+
ref: ${{ github.event.pull_request.head.sha }}
26+
27+
- name: set up python ${{ matrix.python-version }}
28+
uses: actions/setup-python@v2
29+
with:
30+
python-version: ${{ matrix.python-version }}
31+
32+
- name: checkout ibis
33+
uses: actions/checkout@v2
34+
with:
35+
repository: ibis-project/ibis
36+
path: ibis
37+
38+
- name: install dependencies
39+
run: |
40+
python -m pip install --upgrade pip
41+
python -m pip install ./ibis
42+
python -m pip install .
43+
python -m pip install pytest
44+
45+
- name: set up bigquery credentials
46+
run: ./ci/decrypt_secret.sh
47+
env:
48+
GCLOUD_KEY_PASSPHRASE: ${{ secrets.GCLOUD_KEY_PASSPHRASE }}
49+
50+
- name: run tests
51+
run: GOOGLE_BIGQUERY_PROJECT_ID="ibis-gbq" GOOGLE_APPLICATION_CREDENTIALS="$HOME/secrets/gcloud-service-key.json" python -m pytest tests

.gitignore

Lines changed: 139 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,139 @@
1-
*.pyc
2-
__pycache__
1+
# https://github.com/github/gitignore/blob/master/Python.gitignore
2+
# Byte-compiled / optimized / DLL files
3+
__pycache__/
4+
*.py[cod]
5+
*$py.class
6+
7+
# C extensions
8+
*.so
9+
10+
# Distribution / packaging
11+
.Python
12+
build/
13+
develop-eggs/
14+
dist/
15+
downloads/
16+
eggs/
17+
.eggs/
18+
lib/
19+
lib64/
20+
parts/
21+
sdist/
22+
var/
23+
wheels/
24+
share/python-wheels/
25+
*.egg-info/
26+
.installed.cfg
27+
*.egg
28+
MANIFEST
29+
30+
# PyInstaller
31+
# Usually these files are written by a python script from a template
32+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
33+
*.manifest
34+
*.spec
35+
36+
# Installer logs
37+
pip-log.txt
38+
pip-delete-this-directory.txt
39+
40+
# Unit test / coverage reports
41+
htmlcov/
42+
.tox/
43+
.nox/
44+
.coverage
45+
.coverage.*
46+
.cache
47+
nosetests.xml
48+
coverage.xml
49+
*.cover
50+
*.py,cover
51+
.hypothesis/
52+
.pytest_cache/
53+
cover/
54+
55+
# Translations
56+
*.mo
57+
*.pot
58+
59+
# Django stuff:
60+
*.log
61+
local_settings.py
62+
db.sqlite3
63+
db.sqlite3-journal
64+
65+
# Flask stuff:
66+
instance/
67+
.webassets-cache
68+
69+
# Scrapy stuff:
70+
.scrapy
71+
72+
# Sphinx documentation
73+
docs/_build/
74+
75+
# PyBuilder
76+
.pybuilder/
77+
target/
78+
79+
# Jupyter Notebook
80+
.ipynb_checkpoints
81+
82+
# IPython
83+
profile_default/
84+
ipython_config.py
85+
86+
# pyenv
87+
# For a library or package, you might want to ignore these files since the code is
88+
# intended to run in multiple environments; otherwise, check them in:
89+
# .python-version
90+
91+
# pipenv
92+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
93+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
94+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
95+
# install all needed dependencies.
96+
#Pipfile.lock
97+
98+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
99+
__pypackages__/
100+
101+
# Celery stuff
102+
celerybeat-schedule
103+
celerybeat.pid
104+
105+
# SageMath parsed files
106+
*.sage.py
107+
108+
# Environments
109+
.env
110+
.venv
111+
env/
112+
venv/
113+
ENV/
114+
env.bak/
115+
venv.bak/
116+
117+
# Spyder project settings
118+
.spyderproject
119+
.spyproject
120+
121+
# Rope project settings
122+
.ropeproject
123+
124+
# mkdocs documentation
125+
/site
126+
127+
# mypy
128+
.mypy_cache/
129+
.dmypy.json
130+
dmypy.json
131+
132+
# Pyre type checker
133+
.pyre/
134+
135+
# pytype static type analyzer
136+
.pytype/
137+
138+
# Cython debug symbols
139+
cython_debug/

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
# Ibis BigQuery backend
2+
3+
ibis-bigquery package

ci/decrypt_secret.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
4+
5+
# Decrypt the file
6+
# https://docs.github.com/en/actions/reference/encrypted-secrets#limits-for-secrets
7+
mkdir $HOME/secrets
8+
# --batch to prevent interactive command
9+
# --yes to assume "yes" for questions
10+
gpg --quiet --batch --yes --decrypt --passphrase="$GCLOUD_KEY_PASSPHRASE" \
11+
--output "$HOME/secrets/gcloud-service-key.json" \
12+
"$DIR/gcloud-service-key.json.gpg"

ci/gcloud-service-key.json.gpg

1.68 KB
Binary file not shown.

docs/bigquery.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ method of :class:`ibis.bigquery.client.BigQueryClient` objects:
5353

5454
API
5555
---
56-
.. currentmodule:: ibis.backends.bigquery
56+
.. currentmodule:: ibis_bigquery
5757

5858
The BigQuery client is accessible through the ``ibis.bigquery`` namespace.
5959
See :ref:`backends.bigquery` for a tutorial on using this backend.

environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ dependencies:
55

66
# core
77
- ibis-framework # TODO: require Ibis 2.0 when it's released
8-
- google-cloud-bigquery-core >=1.12.0,<1.24.0dev
8+
- google-cloud-bigquery-core >=1.12.0,<3.0.0dev
99
- pydata-google-auth
1010

1111
# dev
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ def __init__(
405405
self.dataset,
406406
) = parse_project_and_dataset(project_id, dataset_id)
407407
self.client = bq.Client(
408-
project=self.data_project,
408+
project=self.billing_project,
409409
credentials=credentials,
410410
client_info=_create_client_info(application_name),
411411
)
@@ -505,7 +505,9 @@ def exists_database(self, name):
505505

506506
def list_databases(self, like=None):
507507
results = [
508-
dataset.dataset_id for dataset in self.client.list_datasets()
508+
dataset.dataset_id for dataset in self.client.list_datasets(
509+
project=self.data_project
510+
)
509511
]
510512
if like:
511513
results = [

0 commit comments

Comments
 (0)