Skip to content

ci: simplify workflows with uv - #291

Open
jakob1379 wants to merge 3 commits into
Maxteabag:mainfrom
jakob1379:ci/uv-simplify
Open

ci: simplify workflows with uv#291
jakob1379 wants to merge 3 commits into
Maxteabag:mainfrom
jakob1379:ci/uv-simplify

Conversation

@jakob1379

Copy link
Copy Markdown

Reimplementation of the CI half of #157, which you closed as "several separate ideas bundled together". Split into focused commits so each can land on its own.

ci.yml drops from 607 to 486 lines with no change in what CI covers. Job names are unchanged, so required status checks keep matching.

Commits

ci: drive CI entirely through uv

setup-uv supplies the interpreter, so actions/setup-python is redundant. uv run syncs on demand, so the standalone uv sync step is too. Every job goes from 4 or 5 setup steps to 2:

- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v7
- name: Run PostgreSQL integration tests
  env: { ... }
  run: uv run --extra postgres pytest tests/test_postgresql.py --timeout=120

Also uv build in place of pip install build && python -m build, and UV_LOCKED at workflow level so CI fails on a stale uv.lock.

ci(release): build the package with uv build

The same swap in release.yml. Nothing else in that workflow is touched. Publish and AUR are left alone on purpose, since churn there buys nothing. Same build backend and same PEP 625 artifact names, so the AUR job's dist/sqlit_tui-${VERSION}.tar.gz lookup is unaffected.

ci: cut redundant workflow config

Four deletions:

  • setup-uv v5 to v7, which defaults enable-cache to auto and removes 15 explicit lines. v7 is the newest moving major tag that actually exists; v8 and v9 are published only as full version tags. That is the same class of mistake you caught with the AUR action in ci: simplify uv-based CI and release workflows #157, so I checked git ls-remote this time.
  • UV_PYTHON at workflow level, overridden per matrix job, replacing 15 copies of setup-uv's python-version input.
  • -v dropped from every pytest call, since pyproject.toml already sets addopts = "-v".
  • The trailing docker stop/rm cleanup steps in test-ssh and test-turso. Runners are ephemeral, and the four other docker run jobs never had them.

Why not the approach in #157

Its deduplication relied on YAML anchors (&checkout-step / *checkout-step). GitHub Actions does not expand aliases, so that could never have worked. This PR gets the same effect from workflow-level env and action defaults instead.

One behaviour note worth knowing

The old jobs ran uv sync --group test --no-dev and then a bare uv run, which re-syncs the default (dev) group. So --no-dev never actually took effect, and CI has always installed dev. This PR preserves that.

An earlier draft of mine "fixed" it with UV_NO_DEV=1 and silently skipped the 11 tests/performance tests, because Faker lives in dev and the file skipifs itself away when it is missing. Making --no-dev real would need Faker and pytest-benchmark moved into the test group, which is a pyproject.toml change and not bundled here.

Verification

actionlint clean on both files. Locally, with UV_LOCKED=1:

uv build                             -> sqlit_tui-<ver>.tar.gz + .whl
uv run --no-dev python -c "..."      -> CLI import OK
uv run pytest tests/test_sqlite.py   -> 25 passed, 6 skipped
uv run --extra duckdb ...test_duckdb -> 29 passed, 5 skipped
uv run pytest tests/ <12 ignores>    -> 1756 passed, 420 skipped, 1 failed
uv lock --check                      -> in sync, so UV_LOCKED is safe

The single failure, test_detect_strategy_pip_user_fallback, is pre-existing and environment-dependent. The probe reads real interpreter state, and my machine reports externally-managed where the test expects pip-user. It fails identically on unmodified main.

I also could not get a clean local reading on tests/performance, which asserts wall-clock thresholds. Those tests passed standalone, then failed inside a full run while my machine was busy with other test invocations. Not caused by this PR, since they already run in the current unit job, but they look like a latent flake worth a separate look.

Deliberately left out

Happy to open any of these separately if you want them:

  • The 13 near-identical DB jobs. A matrix would work, since services: accepts matrix expressions, but four jobs use raw docker run, mssql needs a wait step, mariadb needs apt, and firebird has no healthcheck. The resulting include: block is harder to read than 13 explicit jobs.
  • build builds the same py3-none-any wheel four times. It could collapse to one job, with test-unit widened to all four versions instead. That is fewer jobs and more real coverage, at roughly double the unit-job wall time.
  • The 12-line --ignore list. tests/integration/ already exists and pytest.mark.integration is already declared in pyproject.toml, but the DB test files use neither. Marking or moving them turns that list into -m "not integration".
  • softprops/action-gh-release@v1 in release.yml. actionlint flags it as too old to run on GitHub Actions (node16). Pre-existing, one character to fix, own PR.

setup-uv provides the interpreter, so actions/setup-python is redundant;
uv run syncs the environment on demand, so the separate uv sync step is too.
Every job drops from 4-5 setup steps to 2.

- drop actions/setup-python (setup-uv's python-version replaces it)
- fold "Install dependencies" into the test step via uv run --extra
- uv build instead of pip install build && python -m build
- UV_LOCKED at workflow level: CI now fails if uv.lock is stale
- enable-cache on setup-uv

Behaviour is unchanged: the old jobs ran `uv sync --group test --no-dev`
and then a bare `uv run`, which re-synced the default (dev) group anyway,
so dev is what CI has always installed. The build job keeps --no-dev since
it only ever installed runtime deps.
Drops actions/setup-python and the pip install build bootstrap. Same
backend, same PEP 625 artifact names, so the AUR job's
dist/sqlit_tui-${VERSION}.tar.gz lookup is unaffected.
Four deletions, no behaviour change:

- setup-uv v5 -> v7, which defaults enable-cache to "auto" (on for
  GitHub-hosted runners), so 15 explicit enable-cache lines go away.
  v7 is the newest moving major tag that actually exists; v8/v9 are
  published only as full version tags.
- UV_PYTHON at workflow level, overridden per matrix job, replaces 15
  copies of setup-uv's python-version input. uv provisions the
  interpreter either way.
- Drop -v from every pytest call; pyproject already sets addopts = "-v".
- Drop the trailing "docker stop/rm" Cleanup steps from test-ssh and
  test-turso. Runners are ephemeral, and the four other docker-run jobs
  never had them.
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.

1 participant