Skip to content

Conversation

@bernalde
Copy link
Contributor

This pull request introduces a comprehensive overhaul and standardization of the project's continuous integration (CI) and GitHub workflow infrastructure. It adds new workflow files, updates existing ones for better consistency and coverage, and introduces templates and configuration files to improve the development process and issue reporting. The most important changes are grouped below by theme.

CI/CD Infrastructure Overhaul:

  • Added a new unified CI workflow (ci.yml) that covers linting, testing across multiple Python versions, running examples and tutorials, uploading coverage, and gating PRs on all checks passing. This workflow replaces and consolidates previous individual workflows.
  • Introduced a dedicated workflow for generating and uploading code coverage reports (coverage.yml), including both XML and HTML reports and summary output.
  • Added a workflow (pr-comment.yml) to automatically post or update a summary comment on pull requests with CI results, improving feedback for contributors.

Workflow Modernization and Standardization:

  • Updated all Python-related workflows (python-pytest.yml, python-example.yml, python-tutorials.yml, python-yapf.yml) to use the latest GitHub Actions versions, matrix over more Python versions, cache dependencies, and produce consistent outputs and artifact uploads. [1] [2] [3] [4]
  • Standardized job names, matrix strategies, and artifact handling across workflows for easier maintenance and clarity. [1] [2] [3] [4]

Dependency Management Automation:

  • Added a dependabot.yml configuration to automate updates for GitHub Actions and Python dependencies, with custom labeling, commit message conventions, and rules to ignore major version updates for critical libraries like numpy and scipy.

Templates and Documentation:

  • Introduced a pull request template (PULL_REQUEST_TEMPLATE.md) to standardize PR submissions, including sections for description, testing, and checklists.
  • Added a CI/build issue template (ci_issue.yml) to improve the quality and consistency of CI-related bug reports.

These changes collectively modernize the CI infrastructure, streamline contributor workflows, and automate routine maintenance tasks, making the project easier to maintain and contribute to.

- Update all workflows to latest GitHub Actions (v4/v5)
- Expand Python support from 3.7-3.8 to 3.8-3.12
- Add comprehensive CI workflow (ci.yml) orchestrating all checks
- Add dedicated code coverage workflow with Codecov integration
- Add PR comment workflow for automated result summaries
- Implement pip caching for faster builds
- Add parallel test execution with pytest-xdist

New Features:
- Dependabot configuration for automated dependency updates
- CI issue template and PR template for better contributions
- Development requirements file (requirements-dev.txt)
- Comprehensive CI documentation (docs/CI_INFRASTRUCTURE.md)
- CHANGELOG.md for tracking project changes

Workflow Improvements:
- python-pytest.yml: Python 3.8-3.12, coverage reporting, caching
- python-yapf.yml: Updated actions, caching
- python-tutorials.yml: Python 3.9-3.11, artifact uploads, error handling
- python-example.yml: Python 3.9-3.11, added example_ais.py

Documentation:
- Added CI status badges to README
- Added 'Testing and CI' section with local testing guide
- Updated setup.py with Python 3.8-3.12 classifiers

Breaking Changes:
- Dropped Python 3.7 support (EOL June 2023)
- Dropped Python 3.6 support (EOL December 2021)
- Add test_ais.py with tests for partition_function_post, get_log_omega, and omegas_to_partition
- Test that partition_function_post correctly processes multiple samples (exercises the indentation bug)
- Test error handling when beta=0 is not present
- Test consistency and determinism of calculations
- All tests currently pass with the fixed code
The beta_idx calculation, numpy import, and log_omegas append were
incorrectly dedented outside the for loop, causing only the last sample
to be processed instead of all samples.

Fixed by:
- Moving these lines inside the for loop with proper indentation
- Moving numpy import to top of function for better code organization

This bug would have caused incorrect partition function calculations
when processing multiple samples. The new tests in test_ais.py verify
the fix works correctly.

Addresses critical bug identified in PR #1 review
Added:
- .coverage (coverage database)
- coverage.xml (coverage report)
- htmlcov/ (HTML coverage reports)
- .pytest_cache/ (pytest cache directory)

These files are generated during testing and should not be committed.
Addresses issue identified in PR #1 review where .coverage file was
accidentally committed.
Added token parameter to codecov/codecov-action@v4 in all workflows:
- python-pytest.yml
- ci.yml
- coverage.yml

The codecov-action@v4 requires a token for reliable uploads, especially
for public repositories. Without it, uploads may fail silently due to
continue-on-error: true settings.

Addresses reviewer nitpick from PR #1
Moved pytest from runtime dependencies to dev-only:
- Removed from pyproject.toml dependencies list
- Removed from requirements.txt
- Already properly listed in requirements-dev.txt

pytest is a development/testing tool and should not be installed
for all users of the package. It should only be installed when
developing or testing the package.

Addresses reviewer comment from PR #1
Changed Coverage Summary step to use 'coverage report' instead of
re-running pytest, which is more efficient and avoids re-executing
all tests just to display the summary.

The .coverage file is already generated from the test run on line 30,
so we can directly use 'coverage report' to display the summary.

Addresses reviewer performance comment from PR #1
Removed the redundant 'import numpy as np' statement inside the
partition_function_post function (line 37). Numpy is already imported
at the module level (line 20), so this local import is unnecessary.

Addresses reviewer comment from PR #1
Changed docstrings to raw strings (r'''...''') in:
- uniform_prob_initialization
- bernoulli_prob_initialization

This fixes DeprecationWarning for invalid escape sequence '\pm'
which is used to represent the LaTeX ± symbol. Using raw strings
prevents Python from trying to interpret backslash sequences.

Fixes pytest warnings from test runs
Fixed typo in conda environment file name in README.md:
- Changed 'envinronment.yml' to 'environment.yml'

Note: Artifact names with periods (tutorial-outputs-py3.9) work fine
in GitHub Actions despite the reviewer's concern. The replace()
function is not available in GitHub Actions expressions, and periods
in artifact names are commonly used without issues.
Comprehensive CI infrastructure modernization and enhancements
@codecov-commenter
Copy link

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

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