Repository navigation
129 lines (108 loc) · 3.5 KB
/
Copy pathci.yml
File metadata and controls
129 lines (108 loc) · 3.5 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
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
name: CI
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
workflow_call:
permissions:
contents: read
env:
# internacia-db release the SDK is tested against. Bump both together.
TESTED_DB_VERSION: "3.0.0"
TESTED_DB_SHA256: "02c33d6822432ef60bce19b81e33b180221f6d6504c3e163f0e14f866254e01d"
# Lower bound of the duckdb requirement in pyproject.toml.
DUCKDB_MIN: "1.5.4"
jobs:
test:
name: py${{ matrix.python-version }} / duckdb ${{ matrix.duckdb }} / ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.11", "3.12", "3.13"]
duckdb: [min, max]
include:
- os: macos-latest
python-version: "3.13"
duckdb: max
- os: windows-latest
python-version: "3.13"
duckdb: max
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
if [ "${{ matrix.duckdb }}" = "min" ]; then
pip install "duckdb==${DUCKDB_MIN}"
fi
python -c "import duckdb; print('duckdb', duckdb.__version__)"
- name: Cache test database
uses: actions/cache@v4
with:
path: .test-data
key: internacia-db-${{ env.TESTED_DB_VERSION }}-${{ env.TESTED_DB_SHA256 }}
- name: Fetch internacia-db ${{ env.TESTED_DB_VERSION }}
run: >-
python scripts/fetch_test_db.py
--version "$TESTED_DB_VERSION"
--sha256 "$TESTED_DB_SHA256"
--output .test-data/internacia.duckdb
- name: Run unit and integration tests
env:
INTERNACIA_TEST_DB_PATH: ${{ github.workspace }}/.test-data/internacia.duckdb
INTERNACIA_TEST_DB_VERSION: ${{ env.TESTED_DB_VERSION }}
run: pytest -v --cov=internacia --cov-report=xml --cov-report=term
- name: Upload coverage to Codecov
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11' && matrix.duckdb == 'max'
uses: codecov/codecov-action@v5
with:
files: ./coverage.xml
flags: unittests
name: codecov-umbrella
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
- name: Run black (check only)
run: black --check internacia/ tests/ examples/ scripts/
- name: Run ruff
run: ruff check internacia/ tests/ examples/ scripts/
- name: Run mypy
run: mypy internacia/
security:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools
pip install -e ".[dev]"
- name: Run pip-audit
run: |
pip install pip-audit
pip-audit --desc