-
Notifications
You must be signed in to change notification settings - Fork 48
213 lines (174 loc) · 7 KB
/
Copy pathci.yml
File metadata and controls
213 lines (174 loc) · 7 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
204
205
206
207
208
209
210
211
212
213
name: Quality control checks
on:
push:
branches: [main, "feat/**"]
paths-ignore:
- "**.md" # Do not need to run CI for markdown changes.
pull_request:
branches: [main, "feat/**"]
paths-ignore:
- "**.md"
jobs:
linux:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up uv
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
with:
python-version: ${{ matrix.python-version }}
- uses: launchdarkly/gh-actions/actions/persistent-stores@persistent-stores-v0
with:
redis: true
consul: true
dynamodb: true
- uses: ./.github/actions/build
- uses: ./.github/actions/build-docs
- name: Run tests
run: make test-all
env:
LD_SKIP_FLAKY_TESTS: true
- name: Verify typehints
run: make lint
#
# SDK contract tests
#
- name: install contract test dependencies
run: make install-contract-tests-deps
- name: start contract test service
run: make start-contract-test-service-bg
- name: Run contract tests v2
uses: launchdarkly/gh-actions/actions/contract-tests@contract-tests-v1
with:
test_service_port: 9000
token: ${{ secrets.GITHUB_TOKEN }}
stop_service: "false"
enable_persistence_tests: "true"
- name: Run contract tests v3
uses: launchdarkly/gh-actions/actions/contract-tests@contract-tests-v1
with:
test_service_port: 9000
token: ${{ secrets.GITHUB_TOKEN }}
version: v3
enable_persistence_tests: "true"
#
# Async SDK contract tests
#
- name: start async contract test service
run: make start-async-contract-test-service-bg
- name: Run async contract tests v2
uses: launchdarkly/gh-actions/actions/contract-tests@contract-tests-v1
with:
test_service_port: 9001
token: ${{ secrets.GITHUB_TOKEN }}
stop_service: "false"
enable_persistence_tests: "true"
- name: Run async contract tests v3
uses: launchdarkly/gh-actions/actions/contract-tests@contract-tests-v1
with:
test_service_port: 9001
token: ${{ secrets.GITHUB_TOKEN }}
version: v3
enable_persistence_tests: "true"
# 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. The contract-test steps cover the
# other half, since a missing contract-tests directory changes no test count.
sdist:
name: sdist (functional)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up uv
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.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
env:
# The file-data-source modules skip themselves on this variable
# because they flake in CI. The linux and windows jobs set it, and
# this job must too, or it fails for reasons that say nothing about
# whether the sdist is complete. The tests still get collected, so
# the count check above is unaffected.
LD_SKIP_FLAKY_TESTS: true
- 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 contract test service from the sdist
working-directory: ${{ runner.temp }}/sdist
run: make start-contract-test-service-bg
- name: Run contract tests against the sdist
uses: launchdarkly/gh-actions/actions/contract-tests@contract-tests-v1
with:
test_service_port: 9000
enable_persistence_tests: "false"
token: ${{ secrets.GITHUB_TOKEN }}
- name: Start the async contract test service from the sdist
working-directory: ${{ runner.temp }}/sdist
run: make start-async-contract-test-service-bg
- name: Run async contract tests against the sdist
uses: launchdarkly/gh-actions/actions/contract-tests@contract-tests-v1
with:
test_service_port: 9001
enable_persistence_tests: "false"
token: ${{ secrets.GITHUB_TOKEN }}
windows:
runs-on: windows-latest
defaults:
run:
shell: powershell
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up uv
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
with:
python-version: ${{ matrix.python-version }}
- uses: launchdarkly/gh-actions/actions/persistent-stores@persistent-stores-v0
with:
redis: true
consul: true
dynamodb: true
- name: Install requirements
run: uv sync --all-extras
- name: Run tests
run: make test-all
env:
LD_SKIP_FLAKY_TESTS: true