Skip to content

Refactor CI/CD workflows and consolidate test execution - #156

Merged
sergioteula merged 1 commit into
masterfrom
claude/workflows-optimization-ukz2w9
Sep 4, 2026
Merged

Refactor CI/CD workflows and consolidate test execution#156
sergioteula merged 1 commit into
masterfrom
claude/workflows-optimization-ukz2w9

Conversation

@sergioteula

Copy link
Copy Markdown
Owner

Summary

This PR refactors the GitHub Actions workflows to improve efficiency, maintainability, and clarity. The main changes consolidate the check and changelog jobs, reorganize test execution to run once per Python version with credentials only where needed, and modernize tooling setup.

Key Changes

Workflow Structure (check.yml)

  • Consolidated jobs: Merged the separate changelog and check jobs into a single check job that runs all checks sequentially
  • Improved concurrency: Added workflow concurrency configuration to cancel superseded pull request runs
  • Updated permissions: Changed from pull-requests: read to contents: read for proper access control
  • Added timeout: Set 10-minute timeout for the check job

Test Execution (check.yml and test.yml)

  • Separated concerns: Moved test execution to a dedicated test job that runs independently across Python versions 3.9-3.14
  • Conditional credentials: Credentials are now only injected into the Python 3.13 test run (which includes coverage), avoiding unnecessary secret exposure
  • Coverage matrix: Added matrix configuration to run coverage only on Python 3.13, which is the only version with access to integration test credentials
  • Skip test hook: Added SKIP: test environment variable to the check job to avoid running tests twice

Tooling Updates

  • UV installation: Replaced manual curl installation with astral-sh/setup-uv action (v10.0.1) for both check and test jobs
  • Improved caching: Simplified UV caching configuration using the action's built-in enable-cache and cache-dependency-glob options
  • Python version-specific caching: Added cache-suffix to ensure each Python version has its own cache entry

Release Workflow (release.yml)

  • UV build: Replaced python -m build with uv build for faster, more efficient package building
  • Improved tag checking: Fixed tag existence check to use git rev-parse -q --verify "refs/tags/..." which correctly matches the actual tag name being created
  • Fetch depth: Added fetch-depth: 0 to checkout step to ensure tags are available for the tag existence check
  • Simplified setup: Removed Python setup step in favor of UV-based building
  • Added timeout: Set 10-minute timeout for the release job

Notable Implementation Details

  • The test job now has a 5-minute timeout (increased from 2 minutes) to accommodate the additional Python versions
  • Integration test credentials are only available to the Python 3.13 test run, which is the only one that can meet coverage thresholds
  • The changelog check is now conditional within the check job (if: github.event_name == 'pull_request') rather than at the job level
  • All workflow changes maintain backward compatibility while improving efficiency and clarity

https://claude.ai/code/session_01Qwt5Ey1txWtHnhN5bonYy5

The check job ran pre-commit with every hook, including the local test
hook, so the suite ran seven times per pull request: once under 3.13 with
coverage there and once more in each leg of the matrix. Nothing cancelled
superseded runs either, so three pushes to a branch kept 24 jobs alive.

- Skip the test hook in the check job and move the coverage run, with the
  credentials it needs for the integration tests, into the 3.13 leg of the
  matrix, which now owns testing
- Cancel superseded pull request runs, leaving master runs alone since
  they gate the release
- Fold the changelog job into check, which spent a whole runner on a grep
- Install uv with astral-sh/setup-uv, replacing the curl install and the
  explicit cache steps, and keep a cache per Python version
- Bound every job with timeout-minutes, they defaulted to six hours
- Narrow the workflow permissions to the contents read that checkout needs

The release workflow looked for a tag named v<version> while it creates
<version>, and its shallow checkout fetched no tags to look at, so the
guard against releasing an existing version never fired. It now checks
refs/tags/<version> with the full history, and builds with uv build
instead of installing build with pip under a separate Python.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Qwt5Ey1txWtHnhN5bonYy5
@sergioteula
sergioteula merged commit f91738b into master Sep 4, 2026
7 checks passed
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