-
Notifications
You must be signed in to change notification settings - Fork 2
147 lines (125 loc) · 5.5 KB
/
Copy pathci.yml
File metadata and controls
147 lines (125 loc) · 5.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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
name: CI
on:
pull_request:
branches: [main]
types: [opened, synchronize, reopened]
push:
branches: [main]
# Superseded runs are cancelled: force-pushing to a PR branch should not leave the previous
# run burning minutes on a result nobody will read.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
test:
name: Unit tests (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
# Report every failing interpreter, not just the first.
fail-fast: false
matrix:
# requires-python is ">=3.10"; test the whole range that claim covers.
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
# setuptools-scm derives the version from tags, so it needs full history.
# Without this the build fails or produces a 0.1.dev1 placeholder.
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: pyproject.toml
- name: Install package and dependencies
# The [analysis] extra is required, not optional, for a meaningful test run: the
# query-conversion tests skip themselves when pandas/numpy are absent, so a run
# without it would pass while silently testing nothing.
run: |
python -m pip install --upgrade pip
pip install -e ".[analysis,dev]"
- name: Run unit tests
# Integration tests need a live MLDP ecosystem on localhost:50051-50053 and are
# deselected by marker. They self-skip without a backend, but deselecting them
# outright means a missing backend can never be mistaken for a passing run.
run: pytest tests/unit -v -m "not integration"
quality:
name: Lint, type-check, and docs
runs-on: ubuntu-latest
# These checks are interpreter-independent, so they run once rather than on all four
# matrix legs -- no added signal, 4x the runtime.
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: "3.12"
cache: pip
cache-dependency-path: pyproject.toml
- name: Install package and dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[analysis,dev]"
- name: Ruff lint
run: ruff check --output-format=github .
- name: Ruff format check
run: ruff format --check .
- name: Type check
# Config under [tool.mypy] in pyproject.toml. The generated gRPC package is excluded
# until it ships typed stubs (osprey-dcs/dp-grpc#158); everything hand-written is checked.
run: mypy src/
- name: Check cookbook snippets
# Type-checks every Python example in doc/cookbook against this package, so a recipe
# referencing a renamed attribute or method fails here rather than in a user's hands.
run: python .dev/tools/check-cookbook-snippets.py
- name: Check release notes
# Each doc/release-notes/rel-X.Y.Z.md is published verbatim as its release body, so it
# must carry a verification section whose signing identity names its own tag. Checked
# here so a mistake fails the notes PR, not the tag push. doc/release-notes/NEXT.md, the
# version-less draft renamed at the cut, is checked the other way round: it must carry none
# of those tag-bearing parts, since any it has guesses a version not yet decided.
run: python .dev/tools/check-release-notes.py
build:
name: Build distributions
runs-on: ubuntu-latest
# Catches packaging breakage (bad metadata, missing files, an sdist that will not build)
# at PR time rather than at tag time, when the tag is already public.
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: "3.12"
- name: Build wheel and sdist
run: |
python -m pip install --upgrade pip build twine
python -m build
- name: Verify distribution metadata
run: twine check --strict dist/*
- name: Verify the wheel installs and imports cleanly
# A wheel that builds but does not import is a release-day surprise; a fresh venv
# with no dev dependencies present is the honest test of that.
run: |
python -m venv /tmp/wheel-check
/tmp/wheel-check/bin/pip install dist/*.whl
/tmp/wheel-check/bin/python -c "
from dp_python_lib.client import MldpClient, QueryParams
from importlib.metadata import version
print('installed version:', version('dp-python-lib'))
"
- name: Upload distributions
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: dist-${{ github.sha }}
path: dist/
retention-days: 7