Repository navigation
97 lines (87 loc) · 3.17 KB
/
Copy pathci.yml
File metadata and controls
97 lines (87 loc) · 3.17 KB
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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12"]
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: gate
POSTGRES_PASSWORD: gate
POSTGRES_DB: writegate
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U gate -d writegate"
--health-interval 10s
--health-timeout 5s
--health-retries 10
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: gate
MYSQL_DATABASE: writegate
MYSQL_USER: gate
MYSQL_PASSWORD: gate
ports:
- 3306:3306
options: >-
--health-cmd "mysqladmin ping -h 127.0.0.1 -uroot -pgate --silent"
--health-interval 10s
--health-timeout 5s
--health-retries 15
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Enable live DB integration (3.12 only)
if: matrix.python-version == '3.12'
run: |
echo "POSTGRES_URL=postgresql://gate:gate@localhost:5432/writegate" >> "$GITHUB_ENV"
echo "MYSQL_URL=mysql://gate:[email protected]:3306/writegate" >> "$GITHUB_ENV"
- name: Install (editable + extras)
run: |
python -m pip install -U pip
python -m venv .venv
.venv/bin/pip install -U pip
.venv/bin/pip install -e ".[dev,postgres,mysql]"
.venv/bin/pip install build
# keep system pip build for `python -m build` step
pip install build
- name: Unit + integration tests
run: make test
- name: Build wheel
if: matrix.python-version == '3.12'
run: python -m build
- name: Install wheel into clean venv and smoke
if: matrix.python-version == '3.12'
run: |
python -m venv /tmp/wheel-venv
/tmp/wheel-venv/bin/pip install -U pip
/tmp/wheel-venv/bin/pip install dist/*.whl
/tmp/wheel-venv/bin/pip install "pytest>=8" pyyaml "duckdb>=1.1" "sqlglot>=25,<31" "psycopg[binary]>=3.1" pymysql
/tmp/wheel-venv/bin/python -c "import write_gate; print('installed', write_gate.__version__)"
# Installed wheel has no checkout seed; init cwd policy/catalog. Clear service URLs so smoke uses DuckDB.
unset POSTGRES_URL MYSQL_URL DATABASE_URL || true
SMOKE_DIR=$(mktemp -d)
( cd "$SMOKE_DIR" && /tmp/wheel-venv/bin/sql-write-gate init --force \
&& /tmp/wheel-venv/bin/sql-write-gate check "DELETE FROM orders" || test $? -eq 2 )
# Key tests against installed wheel (do not put checkout src/ on path)
/tmp/wheel-venv/bin/pytest -q \
--override-ini="pythonpath=" \
tests/test_destructive.py \
tests/test_regression_r1_r6.py \
tests/test_v019.py \
tests/test_windows_support.py \
-p no:cacheprovider