Skip to content

Add nightly scheduled GitHub Actions workflow#148

Merged
JAVGan merged 2 commits into
mainfrom
add-nightly-workflow
May 29, 2026
Merged

Add nightly scheduled GitHub Actions workflow#148
JAVGan merged 2 commits into
mainfrom
add-nightly-workflow

Conversation

@JAVGan
Copy link
Copy Markdown
Collaborator

@JAVGan JAVGan commented May 8, 2026

Summary

  • Add a new nightly.yml workflow that runs the full tox test suite weekly on Mondays at 6:23 AM UTC
  • Includes all jobs from tox-test.yml: linting, mypy, unit tests (Python 3.10-3.13), coverage, security, and docs
  • Supports manual triggering via workflow_dispatch

Test plan

  • Verify workflow syntax is valid by triggering manually from the Actions tab
  • Confirm scheduled runs appear after merging

🤖 Generated with Claude Code

Summary by Sourcery

CI:

  • Introduce a nightly GitHub Actions workflow that runs linting, type checks, unit tests across Python 3.10–3.13, coverage, security scans, and docs via tox on a daily cron schedule with manual dispatch support.

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented May 8, 2026

Reviewer's Guide

Adds a new nightly GitHub Actions workflow that mirrors the existing tox-based CI jobs (linting, typing, tests across Python 3.10–3.13, coverage, security, and docs) and runs them on a daily schedule at 06:23 UTC, while also allowing manual runs via workflow_dispatch.

Sequence diagram for manual dispatch of nightly workflow

sequenceDiagram
  actor Developer
  participant GitHubUI
  participant GitHubActions
  participant NightlyWorkflow
  participant Job_linting
  participant Job_mypy
  participant Job_unit_tests_matrix
  participant Job_coverage
  participant Job_security
  participant Job_docs

  Developer->>GitHubUI: Trigger_nightly_workflow_dispatch
  GitHubUI->>GitHubActions: Create_workflow_run_nightly_yml
  GitHubActions->>NightlyWorkflow: Start_workflow

  NightlyWorkflow->>Job_linting: Start_job
  NightlyWorkflow->>Job_mypy: Start_job
  NightlyWorkflow->>Job_unit_tests_matrix: Start_job
  NightlyWorkflow->>Job_coverage: Start_job
  NightlyWorkflow->>Job_security: Start_job
  NightlyWorkflow->>Job_docs: Start_job

  Job_linting-->>NightlyWorkflow: Status_success_or_failure
  Job_mypy-->>NightlyWorkflow: Status_success_or_failure
  Job_unit_tests_matrix-->>NightlyWorkflow: Status_success_or_failure
  Job_coverage-->>NightlyWorkflow: Status_success_or_failure
  Job_security-->>NightlyWorkflow: Status_success_or_failure
  Job_docs-->>NightlyWorkflow: Status_success_or_failure

  NightlyWorkflow-->>GitHubActions: Aggregate_job_status
  GitHubActions-->>Developer: Report_workflow_result
Loading

Flow diagram for unit tests matrix job in nightly workflow

flowchart TD
  Start[unit_tests_job_start] --> Matrix[Expand_matrix_python_versions_3_10_3_11_3_12_3_13]

  Matrix --> Checkout[actions_checkout_v6]
  Checkout --> SetupPy[actions_setup_python_v6_with_matrix_version]
  SetupPy --> AptUpdate[sudo_apt_get_update]
  AptUpdate --> InstallRpm[sudo_apt_get_install_rpm]
  InstallRpm --> InstallKrb[sudo_apt_get_install_libkrb5_dev]
  InstallKrb --> InstallTox[pip_install_tox]
  InstallTox --> RunTox[tox_e_pyXY_from_matrix_python_version]
  RunTox --> End[unit_tests_job_end]
Loading

File-Level Changes

Change Details Files
Introduce a scheduled nightly CI workflow that runs the full tox test suite and related checks.
  • Define a GitHub Actions workflow named "Nightly tests" triggered by a daily cron schedule at 06:23 UTC and via manual workflow_dispatch.
  • Add separate jobs for linting, mypy type checking, unit tests across a Python version matrix (3.10–3.13), coverage, security scanning (including pip-audit), and docs build.
  • Standardize job setup steps to check out the repository, install required OS packages (rpm, libkrb5-dev), configure Python via actions/setup-python, and install tox (sometimes pinned with virtualenv<20.21.1).
  • Configure unit test job to map matrix python versions to tox environments (e.g., py310, py311) and run corresponding tox environments.
  • Extend the security job to install the project and run pip-audit against requirements.txt and requirements-test.txt.
.github/workflows/nightly.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@JAVGan
Copy link
Copy Markdown
Collaborator Author

JAVGan commented May 8, 2026

@lslebodn @ashwgit PTAL

Comment thread .github/workflows/nightly.yml Fixed
Comment thread .github/workflows/nightly.yml Fixed
Comment thread .github/workflows/nightly.yml Fixed
Comment thread .github/workflows/nightly.yml Fixed
Comment thread .github/workflows/nightly.yml Fixed
Comment thread .github/workflows/nightly.yml Fixed
Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - I've found 1 issue, and left some high level feedback:

  • There is a lot of repeated setup (checkout, apt-get, setup-python, tox install) across jobs; consider extracting this into a composite action, YAML anchors, or a reusable workflow so changes only need to be made in one place.
  • The unit-tests job installs plain tox while the other jobs pin virtualenv<20.21.1; if that pin is important for reproducibility, you may want to align the unit-tests job with the others to avoid subtle differences in behavior.
  • Each job runs apt-get update and installs the same OS packages independently; consider consolidating this via a shared base image or caching to reduce runtime and avoid redundant package installation in the nightly workflow.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- There is a lot of repeated setup (checkout, apt-get, setup-python, tox install) across jobs; consider extracting this into a composite action, YAML anchors, or a reusable workflow so changes only need to be made in one place.
- The unit-tests job installs plain `tox` while the other jobs pin `virtualenv<20.21.1`; if that pin is important for reproducibility, you may want to align the unit-tests job with the others to avoid subtle differences in behavior.
- Each job runs `apt-get update` and installs the same OS packages independently; consider consolidating this via a shared base image or caching to reduce runtime and avoid redundant package installation in the nightly workflow.

## Individual Comments

### Comment 1
<location path=".github/workflows/nightly.yml" line_range="104-107" />
<code_context>
+        run: tox -e security
+      - name: Install project
+        run: python -m pip install .
+      - name: Run pip-audit
+        uses: pypa/gh-action-pip-audit@v1.1.0
+        with:
+          inputs: requirements.txt requirements-test.txt
+  docs:
</code_context>
<issue_to_address>
**🚨 suggestion (security):** Using a fixed minor version of the pip-audit action may limit security updates.

Since this is a security tool, consider pinning to the major version (e.g. `pypa/gh-action-pip-audit@v1`) so the workflow automatically picks up patch/minor security and database updates while still avoiding breaking changes from a new major version.

```suggestion
      - name: Run pip-audit
        uses: pypa/gh-action-pip-audit@v1
        with:
          inputs: requirements.txt requirements-test.txt
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread .github/workflows/nightly.yml
@JAVGan
Copy link
Copy Markdown
Collaborator Author

JAVGan commented May 8, 2026

NOTE: depends on #147

@ashwgit
Copy link
Copy Markdown
Collaborator

ashwgit commented May 29, 2026

@JAVGan could I know why are we running linting test daily ?

@lslebodn lslebodn force-pushed the add-nightly-workflow branch from 6ff9f47 to c23fe5e Compare May 29, 2026 10:29
@lslebodn
Copy link
Copy Markdown
Collaborator

@JAVGan could I know why are we running linting test daily ?

IIRc the plan was to run them periodically, so we would catch failures like in #147 a bit earlier.

Maybe daily is too frequent. @ashwgit Would you rather prefer weekly?

@ashwgit
Copy link
Copy Markdown
Collaborator

ashwgit commented May 29, 2026

@JAVGan could I know why are we running linting test daily ?

IIRc the plan was to run them periodically, so we would catch failures like in #147 a bit earlier.

Maybe daily is too frequent. @ashwgit Would you rather prefer weekly?

@lslebodn but for every PR proposed we run mypy, so isn't that will make sure that our code is mypy compatible ?

@lslebodn
Copy link
Copy Markdown
Collaborator

@JAVGan could I know why are we running linting test daily ?

IIRc the plan was to run them periodically, so we would catch failures like in #147 a bit earlier.
Maybe daily is too frequent. @ashwgit Would you rather prefer weekly?

@lslebodn but for every PR proposed we run mypy, so isn't that will make sure that our code is mypy compatible ?

yeah but we do not have pinned version of mypy here and new version of any python package (including mypy) can reveal new issues which we needn't notice when there is a long delay between 2 PRs :-)

@ashwgit
Copy link
Copy Markdown
Collaborator

ashwgit commented May 29, 2026

@lslebodn @JAVGan then let's go with weekly.

@JAVGan
Copy link
Copy Markdown
Collaborator Author

JAVGan commented May 29, 2026

Ok, I'll adjust it to weekly

JAVGan and others added 2 commits May 29, 2026 09:28
Run the full tox test suite (lint, mypy, unit tests, coverage, security,
docs) weekly at 6:23 AM UTC with manual trigger support via workflow_dispatch.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@JAVGan JAVGan force-pushed the add-nightly-workflow branch from c23fe5e to caf5313 Compare May 29, 2026 12:29
@JAVGan
Copy link
Copy Markdown
Collaborator Author

JAVGan commented May 29, 2026

@lslebodn @ashwgit I modified it to run each Monday now

Copy link
Copy Markdown
Collaborator

@ashwgit ashwgit left a comment

Choose a reason for hiding this comment

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

LGTM

@JAVGan JAVGan merged commit d379346 into main May 29, 2026
22 checks passed
@JAVGan JAVGan deleted the add-nightly-workflow branch May 29, 2026 15:22
Copy link
Copy Markdown
Collaborator

@lslebodn lslebodn left a comment

Choose a reason for hiding this comment

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

Couple of post merge questions :-)

- name: Install Tox
run: pip install tox 'virtualenv<20.21.1'
- name: Install pytest cov
run: pip install pytest-cov
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.

Why do we install it here?
IIUC tox would not use it in venv or did I overlook something?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I think this was an old workaround for something I can't properly remember. It is there since we opened the repository as opensource: https://github.com/release-engineering/pubtools-marketplacesvm/blame/main/.github/workflows/tox-test.yml#L20

So I feel it was safer to keep it there, but we may test removing it, but I would do that for all workflows, not just this new one.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

PR >> #149

run: |
sudo apt-get -y update
sudo apt-get install -y rpm
sudo apt-get install -y libkrb5-dev
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.

could we install all dependencies as part of single command?
sudo apt-get install -y rpm libkrb5-dev

it might be a bit faster in CI

Adn similar on other places.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, I can file a PR to adjust that, tks!

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

PR >> #149

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.

4 participants