-
Notifications
You must be signed in to change notification settings - Fork 3
300 lines (285 loc) · 11 KB
/
ci.yaml
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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
name: CI
on:
# We would like to trigger for CI for any pull request action -
# both from QuantCo's branches as well as forks.
pull_request:
types: [opened, labeled, unlabeled, synchronize]
# In addition to pull requests, we want to run CI for pushes
# to the main branches and tags.
push:
branches:
- 'main'
- 'pre-commit-autoupdate'
tags:
- 'v*'
jobs:
pre-commit-checks:
name: "pre-commit hooks - Python 3.8"
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v4
- name: Install Python 3.8
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Run pre-commit checks
uses: pre-commit/[email protected]
unit-tests:
name: "unit tests - Python ${{ matrix.PYTHON_VERSION }} - SA ${{ matrix.SA_VERSION }}"
runs-on: ubuntu-latest
env:
CI: True
strategy:
fail-fast: true
matrix:
PYTHON_VERSION: ['3.8', '3.9', '3.10']
SA_VERSION: ['<2.0', '>=2.0']
steps:
- name: Checkout branch
uses: actions/checkout@v4
- name: Set up micromamba
uses: mamba-org/setup-micromamba@e820223f89c8720d6c740ca154a7adf32fcd278a
with:
environment-file: environment.yml
cache-downloads: true
cache-environment: true
cache-environment-key: ${{ runner.os }}-${{ hashFiles('environment.yml') }}-${{ matrix.PYTHON_VERSION }}-${{ matrix.SA_VERSION }}
create-args: >-
python=${{ matrix.PYTHON_VERSION }}
sqlalchemy${{ matrix.SA_VERSION }}
- name: Run tests
uses: ./.github/actions/pytest
with:
args: "tests/unit"
mssql:
if: ${{ contains(github.event.pull_request.labels.*.name, 'sqlserver') || contains(github.event.pull_request.labels.*.name, 'ready') || github.ref == 'refs/heads/main' }}
name: "mssql - Python ${{ matrix.PYTHON_VERSION }} - SA ${{ matrix.SA_VERSION }}"
runs-on: ubuntu-20.04
env:
CI: True
strategy:
fail-fast: false
matrix:
PYTHON_VERSION: ['3.8', '3.9', '3.10']
SA_VERSION: ["<2.0", ">=2.0"]
services:
DB:
image: mcr.microsoft.com/mssql/server:2019-latest
env:
ACCEPT_EULA: Y
SA_PASSWORD: datajudge-123
ports:
- 1433:1433
steps:
- name: Checkout branch
uses: actions/checkout@v4
- name: Set up micromamba
uses: mamba-org/setup-micromamba@e820223f89c8720d6c740ca154a7adf32fcd278a
with:
environment-file: environment.yml
cache-downloads: true
cache-environment: true
cache-environment-key: ${{ runner.os }}-${{ hashFiles('environment.yml') }}-${{ matrix.PYTHON_VERSION }}-${{ matrix.SA_VERSION }}
create-args: >-
python=${{ matrix.PYTHON_VERSION }}
sqlalchemy${{ matrix.SA_VERSION }}
pyodbc
# TODO: Consider removing this manual installation since the docker image already comes with a msodbc driver.
- name: Install msodbcsql17 driver
shell: bash -l {0}
run: |
wget https://packages.microsoft.com/ubuntu/20.04/prod/pool/main/m/msodbcsql17/msodbcsql17_17.9.1.1-1_amd64.deb
ACCEPT_EULA=Y sudo apt install ./msodbcsql17_17.9.1.1-1_amd64.deb --allow-downgrades
- name: Wait for SQL Server
timeout-minutes: 1
run: until docker logs "${{ job.services.db.id }}" 2>&1 | grep -q "SQL Server is now ready"; do sleep 10; done
- name: Run tests
uses: ./.github/actions/pytest
with:
backend: mssql
args: tests/integration
postgres:
if: ${{ contains(github.event.pull_request.labels.*.name, 'postgres') || contains(github.event.pull_request.labels.*.name, 'ready') || github.ref == 'refs/heads/main' }}
name: "PostgreSQL ${{ matrix.POSTGRES_VERSION }} - Python ${{ matrix.PYTHON_VERSION }} - SA ${{ matrix.SA_VERSION }}"
runs-on: ubuntu-20.04
env:
CI: True
strategy:
fail-fast: false
matrix:
PYTHON_VERSION: [ '3.8', '3.9', '3.10' ]
POSTGRES_VERSION: [ '11', 'latest' ]
SA_VERSION: ["<2.0", ">=2.0"]
services:
DB:
image: postgres:${{ matrix.POSTGRES_VERSION }}
env:
POSTGRES_USER: datajudge
POSTGRES_PASSWORD: datajudge
POSTGRES_DB: datajudge
ports:
- 5432:5432
steps:
- name: Checkout branch
uses: actions/checkout@v4
- name: Set up micromamba
uses: mamba-org/setup-micromamba@e820223f89c8720d6c740ca154a7adf32fcd278a
with:
environment-file: environment.yml
cache-downloads: true
cache-environment: true
cache-environment-key: ${{ runner.os }}-${{ hashFiles('environment.yml') }}-${{ matrix.PYTHON_VERSION }}-${{ matrix.SA_VERSION }}
create-args: >-
python=${{ matrix.PYTHON_VERSION }}
sqlalchemy${{ matrix.SA_VERSION }}
psycopg2
- name: Run tests
uses: ./.github/actions/pytest
with:
backend: postgres
args: tests/integration
db2:
if: ${{ contains(github.event.pull_request.labels.*.name, 'db2') || contains(github.event.pull_request.labels.*.name, 'ready') || github.ref == 'refs/heads/main' }}
name: "DB2 - Python ${{ matrix.PYTHON_VERSION }} - SA ${{ matrix.SA_VERSION }}"
runs-on: ubuntu-20.04
env:
CI: True
strategy:
fail-fast: false
matrix:
PYTHON_VERSION: [ '3.8', '3.9', '3.10' ]
SA_VERSION: ["<2.0"]
services:
DB:
image: ibmcom/db2:11.5.5.1
env:
LICENSE: accept
DB2INSTANCE: db2inst1
DB2INST1_PASSWORD: password
DBNAME: testdb
UPDATEAVAIL: "NO"
options: --privileged
ports:
- 50000:50000
steps:
- name: Checkout branch
uses: actions/checkout@v4
- name: Set up micromamba
uses: mamba-org/setup-micromamba@e820223f89c8720d6c740ca154a7adf32fcd278a
with:
environment-file: environment.yml
cache-downloads: true
cache-environment: true
cache-environment-key: ${{ runner.os }}-${{ hashFiles('environment.yml') }}-${{ matrix.PYTHON_VERSION }}-${{ matrix.SA_VERSION }}
create-args: >-
python=${{ matrix.PYTHON_VERSION }}
sqlalchemy${{ matrix.SA_VERSION }}
ibm_db
ibm_db_sa
- name: Wait for db2 to load
timeout-minutes: 2
run: until docker logs "${{ job.services.db.id }}" 2>&1 | grep -q 'Setup has completed.'; do sleep 5; done
- name: Run tests
uses: ./.github/actions/pytest
with:
backend: db2
args: tests/integration
snowflake:
if: ${{ contains(github.event.pull_request.labels.*.name, 'snowflake') || contains(github.event.pull_request.labels.*.name, 'ready') || github.ref == 'refs/heads/main' }}
name: "Snowflake - Python ${{ matrix.PYTHON_VERSION }} - SA ${{ matrix.SA_VERSION }}"
runs-on: ubuntu-latest
env:
SNOWFLAKE_USER: DATAJUDGE
SNOWFLAKE_PASSWORD: ${{ secrets.SNOWFLAKE_PASSWORD }}
SNOWFLAKE_ACCOUNT: ${{ secrets.SNOWFLAKE_ACCOUNT }}
strategy:
fail-fast: false
matrix:
PYTHON_VERSION: [ '3.8' ]
SA_VERSION: ["<2.0"]
steps:
- name: Checkout branch
uses: actions/checkout@v4
- name: Set up micromamba
uses: mamba-org/setup-micromamba@e820223f89c8720d6c740ca154a7adf32fcd278a
with:
environment-file: environment.yml
cache-downloads: true
cache-environment: true
cache-environment-key: ${{ runner.os }}-${{ hashFiles('environment.yml') }}-${{ matrix.PYTHON_VERSION }}-${{ matrix.SA_VERSION }}
create-args: >-
python=${{ matrix.PYTHON_VERSION }}
sqlalchemy${{ matrix.SA_VERSION }}
snowflake-sqlalchemy
- name: Run tests
uses: ./.github/actions/pytest
with:
backend: snowflake
args: tests/integration
bigquery:
if: ${{ contains(github.event.pull_request.labels.*.name, 'bigquery') || contains(github.event.pull_request.labels.*.name, 'ready') || github.ref == 'refs/heads/main' }}
name: "BigQuery - Python ${{ matrix.PYTHON_VERSION }} - SA ${{ matrix.SA_VERSION }}"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
PYTHON_VERSION: [ '3.8' ]
SA_VERSION: ["<2.0"]
steps:
- name: Checkout branch
uses: actions/checkout@v4
- name: Set up micromamba
uses: mamba-org/setup-micromamba@e820223f89c8720d6c740ca154a7adf32fcd278a
with:
environment-file: environment.yml
cache-downloads: true
cache-environment: true
cache-environment-key: ${{ runner.os }}-${{ hashFiles('environment.yml') }}-${{ matrix.PYTHON_VERSION }}-${{ matrix.SA_VERSION }}
create-args: >-
python=${{ matrix.PYTHON_VERSION }}
sqlalchemy${{ matrix.SA_VERSION }}
sqlalchemy-bigquery
- id: 'auth'
name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@f6de81663f7788d05bd15bcce18f0e57f23f0846'
with:
credentials_json: '${{ secrets.GCP_KEY }}'
- name: Run tests
uses: ./.github/actions/pytest
with:
backend: bigquery
args: -n auto tests/integration
impala-column:
if: ${{ contains(github.event.pull_request.labels.*.name, 'impala') || contains(github.event.pull_request.labels.*.name, 'ready') || github.ref == 'refs/heads/main' }}
name: "Impala - Python ${{ matrix.PYTHON_VERSION }} - SA ${{ matrix.SA_VERSION }}"
runs-on: ubuntu-20.04
env:
CI: True
strategy:
fail-fast: false
matrix:
PYTHON_VERSION: [ '3.8' ]
SA_VERSION: ["<2.0"]
PYTEST_ARG: ["tests/integration/test_column_capitalization.py", "tests/integration/test_data_source.py", "tests/integration/test_integration.py -k row", "tests/integration/test_integration.py -k uniques", "tests/integration/test_integration.py -k date", "tests/integration/test_integration.py -k varchar", "tests/integration/test_integration.py -k numeric"]
steps:
- name: Checkout branch
uses: actions/checkout@v4
- name: Set up micromamba
uses: mamba-org/setup-micromamba@e820223f89c8720d6c740ca154a7adf32fcd278a
with:
environment-file: environment.yml
cache-downloads: true
cache-environment: true
cache-environment-key: ${{ runner.os }}-${{ hashFiles('environment.yml') }}-${{ matrix.PYTHON_VERSION }}-${{ matrix.SA_VERSION }}
create-args: >-
python=${{ matrix.PYTHON_VERSION }}
sqlalchemy${{ matrix.SA_VERSION }}
impyla
- name: Set up container
run: docker compose up --wait impala
- name: Run tests
uses: ./.github/actions/pytest
with:
backend: impala
args: ${{ matrix.PYTEST_ARG }}