Skip to content

Optimize matrix testing in CI by using hatch testing instead of a full matrix of runners - #517

Merged
joanise merged 4 commits into
mainfrom
dev.ej/hatch-neural-ci
Nov 6, 2026
Merged

joanise merged 4 commits into
mainfrom
dev.ej/hatch-neural-ci

Conversation

@joanise

@joanise joanise commented Nov 3, 2026

Copy link
Copy Markdown
Member

PR Goal?

Lately, MacOS runners are hard to get a hold of, and our matrix tests constantly fail because some of the MacOS jobs time out before they get picked up.

Solution: use hatch test -a to cover the different versions of Python

So:

  • configure hatch testing, including configuring neural to skip Python 3.15
  • change matrix-test.yml to use hatch to drive the different versions of python

Also, hatch testing hightlights that some of our redundant tests end up being slow, with test_studio, test_langs and test_cli all running over all data in tests/public/data. When running with hatch, let's down sample some more to keep test times more reasonable.

Fixes?

Recent flakiness of our matrix testing

Feedback sought?

sanity checking

Priority?

medium-high

Tests added?

nothing but!

How to test?

Locally: uvx hatch test -a
or uvx hatch test -a -- --durations=10 to see which tests are slow.
In CI look at the matrix test workflows I ran.

Confidence?

high

Version change?

no

Lately, MacOS runners are oversolicited and jobs frequently
time out. Use hatch test -a to run all tests in one MacOS job.

Squashes all the following commits:
- ci: use hatch to run matrix testing
- ci: set SETUPTOOLS_SCM_PRETEND_VERSION before running hatch
- ci: cache the uv cache in gh-actions
- ci: let astral-sh/setup-uv handle caching the uv cache
- ci: use uvx to run hatch instead of having a separate install
When testing using `hatch test -a`:
 - test_studio: take a 1% sample instead of a 10% sample
 - test_convert: take a 10% sample instead of testing all

When testing just with pytest, reduce test_studio to a 5% sample but
keep test_convert as it was before.
@joanise
joanise requested a review from roedoejet November 3, 2026 22:31
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor
CLI load time: 0:00.05
Pull Request HEAD: 4060778cd8d3da0bdd09eac42ce61e915f51a97d
Imports that take more than 0.1 s:
import time: self [us] | cumulative | imported package

@codecov

codecov Bot commented Nov 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@roedoejet roedoejet left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! thanks @joanise hope this will be easier to manage

@joanise
joanise merged commit ada7700 into main Nov 6, 2026
7 checks passed
@joanise
joanise deleted the dev.ej/hatch-neural-ci branch November 6, 2026 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants