Skip to content

Commit e9890a9

Browse files
authored
Tune CI for efficiency (#16631)
1 parent b1810d9 commit e9890a9

File tree

6 files changed

+48
-125
lines changed

6 files changed

+48
-125
lines changed

.github/workflows/benchmarks.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,7 @@ concurrency:
2727
jobs:
2828
run-benchmarks:
2929
name: Benchmark
30-
# Runs with ephemeral API and SQLite database right now
31-
32-
runs-on:
33-
group: oss-larger-runners
30+
runs-on: ubuntu-latest
3431
timeout-minutes: 20
3532

3633
steps:

.github/workflows/codspeed-benchmarks.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,7 @@ concurrency:
2828
jobs:
2929
run-benchmarks:
3030
name: Benchmark
31-
# Runs with ephemeral API and SQLite database right now
32-
33-
runs-on:
34-
group: oss-larger-runners
31+
runs-on: ubuntu-latest
3532
timeout-minutes: 20
3633

3734
steps:

.github/workflows/markdown-tests.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ concurrency:
5252

5353
jobs:
5454
run-markdown-tests:
55-
runs-on:
56-
group: oss-larger-runners
55+
runs-on: ubuntu-latest
5756
name: markdown:${{ matrix.python-version }}, ${{ matrix.database }}
5857
strategy:
5958
matrix:

.github/workflows/python-tests.yaml

Lines changed: 33 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,30 @@ concurrency:
4949

5050
jobs:
5151
run-tests:
52-
runs-on:
53-
group: oss-larger-runners
52+
runs-on: ubuntu-latest
5453
name: ${{ matrix.test-type.name }} - python:${{ matrix.python-version }}, ${{ matrix.database }}
5554
strategy:
55+
fail-fast: false
5656
matrix:
5757
test-type:
5858
- name: Server Tests
59-
modules: tests/server/ tests/events/server
59+
modules: tests/server/ tests/events/server --ignore=tests/server/database/ --ignore=tests/server/orchestration/
60+
- name: Database and Orchestration Tests
61+
modules: tests/server/database/ tests/server/orchestration/
6062
- name: Client Tests
61-
modules: tests/ --ignore=tests/typesafety --ignore=tests/server/ --ignore=tests/events/server --ignore=tests/test_task_runners.py --ignore=tests/runner --ignore=tests/workers
62-
- name: Runner and Worker Tests
63-
modules: tests/test_task_runners.py tests/runner tests/workers
63+
modules: >-
64+
tests/
65+
--ignore=tests/typesafety
66+
--ignore=tests/server/
67+
--ignore=tests/events/server
68+
--ignore=tests/test_task_runners.py
69+
--ignore=tests/runner
70+
--ignore=tests/workers
71+
--ignore=tests/cli/
72+
--ignore=tests/test_settings.py
73+
--ignore=tests/input/
74+
- name: Runner, Worker, Settings, Input, and CLI Tests
75+
modules: tests/test_task_runners.py tests/runner tests/workers tests/cli/ tests/test_settings.py tests/input/
6476
database:
6577
- "postgres:14"
6678
- "sqlite"
@@ -73,13 +85,21 @@ jobs:
7385
- database: "sqlite"
7486
test-type:
7587
name: Client Tests
76-
modules: tests/ --ignore=tests/typesafety --ignore=tests/server/ --ignore=tests/events/server --ignore=tests/test_task_runners.py --ignore=tests/runner --ignore=tests/workers
88+
modules: >-
89+
tests/
90+
--ignore=tests/typesafety
91+
--ignore=tests/server/
92+
--ignore=tests/events/server
93+
--ignore=tests/test_task_runners.py
94+
--ignore=tests/runner
95+
--ignore=tests/workers
96+
--ignore=tests/cli/
97+
--ignore=tests/test_settings.py
98+
--ignore=tests/input/
7799
- database: "sqlite"
78100
test-type:
79-
name: Runner and Worker Tests
80-
modules: tests/test_task_runners.py tests/runner tests/workers
81-
82-
fail-fast: true
101+
name: Runner, Worker, Settings, Input, and CLI Tests
102+
modules: tests/test_task_runners.py tests/runner tests/workers tests/cli/ tests/test_settings.py tests/input/
83103

84104
timeout-minutes: 15
85105

@@ -148,26 +168,8 @@ jobs:
148168
--publish 6379:6379
149169
redis:latest
150170
151-
- name: Set coverage file and artifact name
152-
id: set_coverage_and_artifact_name
153-
run: |
154-
sanitized_test_type="${{ matrix.test-type.name }}"
155-
sanitized_test_type="${sanitized_test_type// /_}"
156-
sanitized_database="${{ matrix.database }}"
157-
sanitized_database="${sanitized_database//:/\-}"
158-
sanitized_python_version="${{ matrix.python-version }}"
159-
export COVERAGE_FILE=".coverage.${sanitized_test_type}.${sanitized_python_version}.${sanitized_database}"
160-
echo "COVERAGE_FILE=${COVERAGE_FILE}" >> $GITHUB_ENV
161-
echo "artifact_name=coverage-data-${sanitized_test_type}-${{ matrix.python-version }}-${sanitized_database}" >> $GITHUB_OUTPUT
162-
163-
- name: Set coverage core
164-
if: ${{ matrix.python-version == '3.12' }}
165-
run: |
166-
echo "COVERAGE_CORE=sysmon" >> $GITHUB_ENV
167-
168171
- name: Run tests
169172
run: |
170-
echo "Using COVERAGE_FILE=$COVERAGE_FILE"
171173
pytest ${{ matrix.test-type.modules }} \
172174
--numprocesses auto \
173175
--maxprocesses 6 \
@@ -176,17 +178,6 @@ jobs:
176178
--exclude-service kubernetes \
177179
--exclude-service docker \
178180
--durations 26 \
179-
--cov=prefect \
180-
--cov-config=setup.cfg \
181-
--cov-report=''
182-
183-
- name: Upload coverage data
184-
uses: actions/upload-artifact@v4
185-
with:
186-
name: ${{ steps.set_coverage_and_artifact_name.outputs.artifact_name }}
187-
path: ${{ env.COVERAGE_FILE }}
188-
include-hidden-files: true
189-
retention-days: 1
190181
191182
- name: Create and Upload failure flag
192183
if: ${{ failure() }}
@@ -213,8 +204,7 @@ jobs:
213204
|| echo "Ignoring bad exit code"
214205
215206
run-docker-tests:
216-
runs-on:
217-
group: oss-larger-runners
207+
runs-on: ubuntu-latest
218208
name: docker, python:${{ matrix.python-version }}
219209
strategy:
220210
matrix:
@@ -226,7 +216,7 @@ jobs:
226216
- "3.11"
227217
- "3.12"
228218

229-
fail-fast: true
219+
fail-fast: false
230220

231221
timeout-minutes: 45
232222

@@ -346,21 +336,6 @@ jobs:
346336
--publish 6379:6379
347337
redis:latest
348338
349-
- name: Set coverage file and artifact name
350-
id: set_coverage_and_artifact_name
351-
run: |
352-
sanitized_database="${{ matrix.database }}"
353-
sanitized_database="${sanitized_database//:/\-}"
354-
sanitized_python_version="${{ matrix.python-version }}"
355-
export COVERAGE_FILE=".coverage.${sanitized_python_version}.${sanitized_database}"
356-
echo "COVERAGE_FILE=${COVERAGE_FILE}" >> $GITHUB_ENV
357-
echo "artifact_name=coverage-data-docker-${{ matrix.python-version }}-${sanitized_database}" >> $GITHUB_OUTPUT
358-
359-
- name: Set coverage core
360-
if: ${{ matrix.python-version == '3.12' }}
361-
run: |
362-
echo "COVERAGE_CORE=sysmon" >> $GITHUB_ENV
363-
364339
- name: Run tests
365340
run: |
366341
echo "Using COVERAGE_FILE=$COVERAGE_FILE"
@@ -371,17 +346,6 @@ jobs:
371346
--disable-docker-image-builds \
372347
--only-service docker \
373348
--durations 26 \
374-
--cov=prefect \
375-
--cov-config=setup.cfg \
376-
--cov-report=''
377-
378-
- name: Upload coverage data
379-
uses: actions/upload-artifact@v4
380-
with:
381-
name: ${{ steps.set_coverage_and_artifact_name.outputs.artifact_name }}
382-
path: ${{ env.COVERAGE_FILE }}
383-
include-hidden-files: true
384-
retention-days: 1
385349
386350
- name: Create and Upload failure flag
387351
if: ${{ failure() }}
@@ -407,49 +371,6 @@ jobs:
407371
&& docker container logs postgres \
408372
|| echo "Ignoring bad exit code"
409373
410-
combine-coverage:
411-
runs-on: ubuntu-latest
412-
needs:
413-
- run-tests
414-
- run-docker-tests
415-
steps:
416-
- uses: actions/checkout@v4
417-
with:
418-
persist-credentials: false
419-
420-
- name: Set up Python 3.12
421-
uses: actions/setup-python@v5
422-
id: setup_python
423-
with:
424-
python-version: "3.12"
425-
426-
- name: Download coverage data artifacts
427-
uses: actions/download-artifact@v4
428-
with:
429-
pattern: coverage-data-*
430-
merge-multiple: true
431-
432-
- name: Install coverage
433-
run: pip install coverage
434-
435-
- name: Combine coverage data
436-
run: coverage combine
437-
438-
- name: Generate HTML coverage report
439-
run: coverage html
440-
441-
- name: Upload combined coverage report
442-
uses: actions/upload-artifact@v4
443-
with:
444-
name: combined-coverage-report
445-
path: htmlcov/
446-
447-
- name: Publish coverage markdown report
448-
run: |
449-
echo "## Coverage Report" >> $GITHUB_STEP_SUMMARY
450-
echo "[Detailed Report](${{ steps.upload_combined_coverage_report.outputs.artifact_url }})" >> $GITHUB_STEP_SUMMARY
451-
coverage report --format=markdown >> $GITHUB_STEP_SUMMARY
452-
453374
run-typesafety-test:
454375
name: typesafety
455376
runs-on: ubuntu-latest

tests/cli/test_prompts.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ async def test_find_all_flows_in_dir_tree(self, project_dir: Path):
8383
)
8484

8585
async def test_find_all_flows_works_on_large_directory_structures(self):
86-
flows = await search_for_flow_functions(str(prefect.__development_base_path__))
86+
flows = await search_for_flow_functions(
87+
str(prefect.__development_base_path__ / "tests")
88+
)
8789
assert len(flows) > 500
8890

8991
async def test_find_flow_functions_in_file_returns_empty_list_on_file_error(

tests/telemetry/test_instrumentation.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,16 @@ def test_meter_provider(telemetry_account_id: UUID, telemetry_workspace_id: UUID
122122
_, meter_provider, _ = setup_telemetry()
123123
assert isinstance(meter_provider, MeterProvider)
124124

125-
metric_reader = list(meter_provider._all_metric_readers)[0]
126-
exporter = metric_reader._exporter
125+
metric_reader = next(
126+
(
127+
reader
128+
for reader in meter_provider._all_metric_readers
129+
if isinstance(reader, PeriodicExportingMetricReader)
130+
),
131+
None,
132+
)
127133
assert isinstance(metric_reader, PeriodicExportingMetricReader)
134+
exporter = metric_reader._exporter
128135
assert isinstance(exporter, OTLPMetricExporter)
129136

130137
resource_attributes = {

0 commit comments

Comments
 (0)