-
Notifications
You must be signed in to change notification settings - Fork 49
176 lines (167 loc) · 5.85 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
name: CI
on:
workflow_dispatch:
push:
branches: ['main', 'dev-*']
pull_request:
release:
types: [published]
jobs:
checks:
name: "Checks"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
# unset doctests for earlier versions of python.
pytest_flags: ["-v -o addopts='' -m 'not bigquery and not snowflake'"]
requirements: [""]
include:
# historical requirements
- name: "2021-mid dependencies"
python-version: 3.8
requirements: numpy~=1.19.1 pandas~=1.2.0 SQLAlchemy~=1.4.13 psycopg2~=2.8.5 PyMySQL==1.0.2
pytest_flags: "-o addopts='' -m 'not bigquery and not snowflake'"
- name: "2022-early dependencies"
python-version: 3.8
requirements: numpy~=1.22.0 pandas~=1.3.5 SQLAlchemy~=1.4.29 psycopg2-binary~=2.9.3 PyMySQL==1.0.2
- name: "2022-early dependencies"
python-version: "3.10"
requirements: numpy~=1.22.0 pandas~=1.3.5 SQLAlchemy~=1.4.29 psycopg2-binary~=2.9.3 PyMySQL==1.0.2
latest: true
steps:
- uses: actions/checkout@v2
- name: Run docker-compose
run: |
docker-compose up --build -d
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -n "$REQUIREMENTS" ]; then
python -m pip install $REQUIREMENTS '.[test,docs]'
else
python -m pip install '.[test,docs]'
fi
# step to test duckdb
# TODO: move these requirements into the test matrix
pip install duckdb_engine
env:
REQUIREMENTS: ${{ matrix.requirements }}
- name: Test with pytest
run: |
make test-travis
env:
SB_TEST_PGPORT: 5433
PYTEST_FLAGS: ${{ matrix.pytest_flags }}
test-bigquery:
name: "Test BigQuery"
runs-on: ubuntu-latest
if: ${{ contains('bigquery', github.ref) || !github.event.pull_request.draft }}
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.8"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
python -m pip install -r requirements-test.txt
python -m pip install pytest-parallel
python -m pip install sqlalchemy-bigquery==1.4 pandas-gbq==0.17
python -m pip install .
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v0
with:
project_id: siuba-tests
service_account_key: ${{ secrets.GCP_SA_KEY }}
export_default_credentials: true
- name: Test with pytest
run: |
# tests are mostly waiting on http requests to bigquery api
# note that test backends can cache data, so more processes
# is not always faster
pytest siuba -m bigquery --workers 2 --tests-per-worker 20
env:
SB_TEST_BQDATABASE: "ci_github"
test-snowflake:
name: "Test snowflake"
runs-on: ubuntu-latest
if: ${{ contains('snowflake', github.ref) || !github.event.pull_request.draft }}
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.8"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
python -m pip install -r requirements-test.txt
python -m pip install pytest-parallel
python -m pip install snowflake-sqlalchemy
python -m pip install .
- name: Test with pytest
run: |
pytest siuba -m snowflake --workers 2 --tests-per-worker 20
env:
SB_TEST_SNOWFLAKEPASSWORD: ${{ secrets.SB_TEST_SNOWFLAKEPASSWORD }}
SB_TEST_SNOWFLAKEHOST: ${{ secrets.SB_TEST_SNOWFLAKEHOST }}
build-docs:
name: "Build Documentation"
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' || github.ref == 'refs/heads/main' || contains(github.ref, 'docs')
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements-dev.txt
python -m pip install .
- uses: r-lib/actions/setup-pandoc@v1
with:
pandoc-version: '2.17.0.1'
- name: Make docs
run: |
make docs-build
deploy:
name: "Deploy to PyPI"
runs-on: ubuntu-latest
if: github.event_name == 'release'
needs: [checks, test-bigquery, test-snowflake]
steps:
- uses: actions/checkout@v2
- name: "Set up Python 3.8"
uses: actions/setup-python@v2
with:
python-version: "3.8"
- name: "Build Package"
run: |
pip install wheel
python setup.py build sdist bdist_wheel
# test deploy ----
- name: "Test Deploy to PyPI"
uses: pypa/gh-action-pypi-publish@release/v1
if: startsWith(github.event.release.name, 'TEST')
with:
user: __token__
password: ${{ secrets.PYPI_TEST_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
# prod deploy ----
- name: "Deploy to PyPI"
uses: pypa/gh-action-pypi-publish@master
if: "!startsWith(github.event.release.name, 'TEST')"
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}