Skip to content

Modifying pytest workflow to adapt it to other repositories#114

Merged
joselsegura merged 1 commit into
RedHatInsights:masterfrom
joselsegura:refactor-pytest-workflow
Apr 27, 2026
Merged

Modifying pytest workflow to adapt it to other repositories#114
joselsegura merged 1 commit into
RedHatInsights:masterfrom
joselsegura:refactor-pytest-workflow

Conversation

@joselsegura
Copy link
Copy Markdown
Contributor

@joselsegura joselsegura commented Apr 27, 2026

Description

Refactoring of the reusable workflow in order to make it compatible with all Python repositories

Fixes #CCXDEV-15353

Type of change

  • Configuration update

Testing steps

Tested with act and in a repository

@joselsegura joselsegura requested review from a team and InsightsDroid as code owners April 27, 2026 11:42
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 27, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: 70a4497b-0e27-4168-9e9b-d83dca846435

📥 Commits

Reviewing files that changed from the base of the PR and between 8c2dc9a and e93e58d.

📒 Files selected for processing (2)
  • .github/workflows/pytests.yaml
  • workflows_examples/pytests.yaml
🚧 Files skipped from review as they are similar to previous changes (2)
  • workflows_examples/pytests.yaml
  • .github/workflows/pytests.yaml

Summary by CodeRabbit

  • Chores
    • Standardized CI test workflow to run a consistent Python matrix (3.11 and 3.12) and invoke a shared test workflow.
    • Simplified test setup to always prepare test dependencies, upgrade tooling, and run tests directly.
    • Restricted coverage upload to Python 3.11 runs.
    • Added an example workflow for CI configuration reference.

Walkthrough

Replaced install_package and requirements_file inputs with a python_version input in the reusable pytests workflow; test setup now unconditionally upgrades pip, installs pytest/pytest-cov and the package test extras, runs pytest directly, and restricts Codecov upload to Python 3.11. Added an example workflow invoking the reusable workflow.

Changes

Cohort / File(s) Summary
Reusable Workflow Updates
.github/workflows/pytests.yaml
Removed install_package and requirements_file inputs; added python_version input. Test setup now always upgrades pip, installs pytest/pytest-cov, installs package test extras (.[test]), and invokes pytest directly. Codecov upload step runs only when python_version is 3.11.
Example Workflow
workflows_examples/pytests.yaml
Added new workflow that triggers on PRs and pushes to main/master, defines a matrix for Python 3.11 and 3.12, and calls the reusable pytests.yaml passing the matrix python_version.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: refactoring the pytest workflow to make it compatible with other repositories.
Description check ✅ Passed The description is directly related to the changeset, explaining the refactoring of the reusable workflow and its purpose of improving compatibility across Python repositories.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
workflows_examples/pytests.yaml (1)

16-16: Use an immutable ref instead of @master for reusable workflows.

Line 16 uses a moving branch ref, which risks unexpected breakage and inconsistent behavior. GitHub Actions best practices recommend pinning reusable workflows to commit SHAs (most secure), release tags, or major version tags for reproducibility and stability.

Suggested change
-    uses: RedHatInsights/processing-tools/.github/workflows/pytests.yaml@master
+    uses: RedHatInsights/processing-tools/.github/workflows/pytests.yaml@<tag-or-commit-sha>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@workflows_examples/pytests.yaml` at line 16, Replace the moving branch ref in
the reusable workflow invocation by pinning the uses reference to an immutable
ref (commit SHA, release tag, or major-version tag) instead of `@master`; update
the line that currently reads "uses:
RedHatInsights/processing-tools/.github/workflows/pytests.yaml@master" to use a
specific SHA or tag (e.g., `@v1` or @<commit-sha>) so the workflow invocation in
workflows_examples/pytests.yaml is stable and reproducible.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@workflows_examples/pytests.yaml`:
- Line 16: Replace the moving branch ref in the reusable workflow invocation by
pinning the uses reference to an immutable ref (commit SHA, release tag, or
major-version tag) instead of `@master`; update the line that currently reads
"uses: RedHatInsights/processing-tools/.github/workflows/pytests.yaml@master" to
use a specific SHA or tag (e.g., `@v1` or @<commit-sha>) so the workflow
invocation in workflows_examples/pytests.yaml is stable and reproducible.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: ec162240-aa87-4e22-9d1d-80126d45436b

📥 Commits

Reviewing files that changed from the base of the PR and between 5df0570 and 8c2dc9a.

📒 Files selected for processing (2)
  • .github/workflows/pytests.yaml
  • workflows_examples/pytests.yaml

@joselsegura joselsegura enabled auto-merge April 27, 2026 11:58
@joselsegura joselsegura force-pushed the refactor-pytest-workflow branch from 8c2dc9a to e93e58d Compare April 27, 2026 12:14
@joselsegura joselsegura merged commit 607368a into RedHatInsights:master Apr 27, 2026
3 checks passed
@joselsegura joselsegura deleted the refactor-pytest-workflow branch April 27, 2026 13:38
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.

3 participants