Repository navigation
137 lines (113 loc) · 4.45 KB
/
Copy pathpython-sdk.yml
File metadata and controls
137 lines (113 loc) · 4.45 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
130
131
132
133
134
135
136
137
name: Python SDK
on:
push:
branches: [main]
paths:
- 'sdk/python/**'
- 'Makefile'
- '.github/workflows/python-sdk.yml'
pull_request:
paths:
- 'sdk/python/**'
- 'Makefile'
- '.github/workflows/python-sdk.yml'
concurrency:
group: python-sdk-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
with:
# setuptools-scm derives the version from tags, so the editable install
# needs the full history and all tags.
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: pip-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('sdk/python/pyproject.toml') }}
- name: Install dependencies
run: make sdk-install
- name: Lint
run: make sdk-lint
- name: Typecheck
run: make sdk-typecheck
- name: Test
run: make sdk-test
- name: Upload coverage
if: matrix.python-version == '3.12'
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: sdk/python/htmlcov/
retention-days: 14
test-min-deps:
name: Test (minimum dependencies)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
# setuptools-scm derives the version from tags, so the editable install
# needs the full history and all tags.
fetch-depth: 0
persist-credentials: false
# Oldest supported Python: the pinned pyarrow/pandas have no wheels for newer ones.
- name: Set up Python 3.11
id: setup-python
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
with:
python-version: "3.11"
- name: Cache pip
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.cache/pip
key: pip-min-${{ runner.os }}-3.11-${{ hashFiles('sdk/python/pyproject.toml', 'sdk/python/constraints-min.txt') }}
- name: Test
env:
SDK_MIN_PYTHON: ${{ steps.setup-python.outputs.python-path }}
run: make sdk-test-min
package:
name: Package (${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
with:
# A shallow clone has no tags and a commit distance of 1, so
# setuptools-scm would build a version that is never published.
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install package tools
run: python -m pip install --upgrade -r sdk/python/requirements.txt build twine
- name: Build and validate distribution
run: make sdk-package-check VIRTUAL_ENV=1
- name: Install and smoke-test core wheel
run: |
python -m venv .sdk-core-wheel-venv
source .sdk-core-wheel-venv/bin/activate
wheel="$(realpath sdk/python/dist/*.whl)"
python -m pip install "$wheel"
python -c "import data_connect_hub; from importlib.metadata import version; assert data_connect_hub.__version__ == version('data-connect-hub'); print(f'Installed SDK version: {data_connect_hub.__version__}'); client = data_connect_hub.DataConnectClient('example.com'); client.close()"
- name: Install and smoke-test Flight wheel
run: |
python -m venv .sdk-flight-wheel-venv
source .sdk-flight-wheel-venv/bin/activate
wheel="$(realpath sdk/python/dist/*.whl)"
python -m pip install "${wheel}[flight]"
python -c "import data_connect_hub; from importlib.metadata import version; assert data_connect_hub.__version__ == version('data-connect-hub'); print(f'Installed SDK version: {data_connect_hub.__version__}'); client = data_connect_hub.DataConnectClient('example.com'); client._require_flight(); client.close()"