Repository navigation
203 lines (165 loc) · 6.24 KB
/
Copy pathci.yml
File metadata and controls
203 lines (165 loc) · 6.24 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
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
name: Run CI
on:
push:
branches: [main]
paths-ignore:
- "**.md" # Do not need to run CI for markdown changes.
pull_request:
branches: [main]
paths-ignore:
- "**.md"
jobs:
linux:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@v4
- name: Set up uv
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
with:
python-version: ${{ matrix.python-version }}
- uses: ./.github/actions/build
- uses: ./.github/actions/build-docs
- name: Run tests
run: make test
- name: Verify typehints
run: make lint
- name: install contract test dependencies
run: make install-contract-tests-deps
- name: start SSE contract test service
run: make start-contract-test-service-bg
- name: run SSE contract tests
uses: launchdarkly/gh-actions/actions/contract-tests@contract-tests-v1
with:
repo: sse-contract-tests
branch: main
version: v2
test_service_port: 8000
enable_persistence_tests: "false"
debug_logging: "true"
token: ${{ secrets.GITHUB_TOKEN }}
- name: start async SSE contract test service
run: make start-async-contract-test-service-bg
- name: run async SSE contract tests
uses: launchdarkly/gh-actions/actions/contract-tests@contract-tests-v1
with:
repo: sse-contract-tests
branch: main
version: v2
test_service_port: 8001
enable_persistence_tests: "false"
debug_logging: "true"
token: ${{ secrets.GITHUB_TOKEN }}
# Proves the sdist is complete and functional, since the sdist file list is an
# allowlist and an omission there is otherwise invisible. The test-count check
# is what makes this meaningful: without it, an sdist missing half its tests
# would still pass the tests it did ship.
sdist:
name: sdist (functional)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up uv
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
with:
python-version: "3.13"
- name: Count the tests in the checkout
run: |
uv sync --all-extras
count=$(uv run pytest --collect-only -q | grep -oE '[0-9]+ tests? collected' | grep -oE '^[0-9]+')
echo "The checkout collects $count tests."
echo "checkout_tests=$count" >> "$GITHUB_ENV"
- name: Build and unpack the sdist
run: |
uv build --sdist --out-dir dist
mkdir -p "$RUNNER_TEMP/sdist"
tar -xzf dist/*.tar.gz -C "$RUNNER_TEMP/sdist" --strip-components=1
- name: Check that the sdist ships every test
working-directory: ${{ runner.temp }}/sdist
run: |
uv sync --all-extras
count=$(uv run pytest --collect-only -q | grep -oE '[0-9]+ tests? collected' | grep -oE '^[0-9]+')
echo "The sdist collects $count tests; the checkout collected $checkout_tests."
if [ "$count" -lt "$checkout_tests" ]; then
echo "::error::The sdist is missing tests. Add the missing paths to the include list in [tool.hatch.build.targets.sdist]."
exit 1
fi
- name: Run the tests from the sdist
working-directory: ${{ runner.temp }}/sdist
run: make test
- name: Verify typehints from the sdist
working-directory: ${{ runner.temp }}/sdist
run: make lint
# start-contract-test-service depends on install-contract-tests-deps, and
# the -bg target backgrounds the whole chain. Without a blocking install
# first, the dependency sync races the harness connecting to the service.
- name: Install the contract test dependencies from the sdist
working-directory: ${{ runner.temp }}/sdist
run: make install-contract-tests-deps
- name: Start the SSE contract test service from the sdist
working-directory: ${{ runner.temp }}/sdist
run: make start-contract-test-service-bg
- name: Run SSE contract tests against the sdist
uses: launchdarkly/gh-actions/actions/contract-tests@contract-tests-v1
with:
repo: sse-contract-tests
branch: main
version: v2
test_service_port: 8000
enable_persistence_tests: "false"
debug_logging: "true"
token: ${{ secrets.GITHUB_TOKEN }}
- name: Start the async SSE contract test service from the sdist
working-directory: ${{ runner.temp }}/sdist
run: make start-async-contract-test-service-bg
- name: Run async SSE contract tests against the sdist
uses: launchdarkly/gh-actions/actions/contract-tests@contract-tests-v1
with:
repo: sse-contract-tests
branch: main
version: v2
test_service_port: 8001
enable_persistence_tests: "false"
debug_logging: "true"
token: ${{ secrets.GITHUB_TOKEN }}
windows:
runs-on: windows-latest
defaults:
run:
shell: powershell
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@v4
- name: Set up uv
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
with:
python-version: ${{ matrix.python-version }}
- name: Install requirements
run: uv sync --all-extras
- uses: ./.github/actions/build
- uses: ./.github/actions/build-docs
- name: Run tests
run: make test
# Guards the minimum declared dependency versions, since the regular jobs
# run against the locked/latest versions.
floor:
name: floor (lowest-direct deps)
env:
UV_RESOLUTION: lowest-direct
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up uv
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
with:
python-version: "3.10"
- name: Run tests
run: make test