Migrate CI/CD from Travis to GitHub Actions#391
Conversation
Replace Travis, Coveralls, and deploy-staging.sh with GitHub Actions workflows for linting, testing, Codecov uploads, and PyPI/TestPyPI publishing. Align CI Python runtime with EvalAI at 3.9.21 and add CodeRabbit badge to README.
📝 WalkthroughWalkthroughTravis CI configuration ( ChangesTravis → GitHub Actions Migration
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
flake8 3.0.4 uses an incompatible pyflakes version that fails on Python 3.9 AST nodes.
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
.github/workflows/ci-cd.yml (1)
132-141: Migrate to PyPI/TestPyPI Trusted Publishing (OIDC) to eliminate long-lived secrets.Both publish jobs use stored secrets for authentication (
TEST_PYPI_USERNAME/TEST_PYPI_PASSWORDandPYPI_API_TOKEN). Replace with OpenID Connect (OIDC) trusted publishing to remove credential handling and reduce secret rotation/leakage risk.Required changes:
- Add
id-token: writepermission to each job- Replace
python -m twine uploadwithpypa/gh-action-pypi-publish@release/v1action (no username/password inputs)- Configure Trusted Publishers in PyPI and TestPyPI project settings with:
- Repository owner and name
- Workflow filename
- Environment name (already set:
stagingfor TestPyPI,productionfor PyPI)- Remove
TWINE_USERNAMEandTWINE_PASSWORDenv varsAlso applies to: 164-171
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/ci-cd.yml around lines 132 - 141, Migrate both the TestPyPI and PyPI publish jobs from long-lived secrets to OIDC Trusted Publishing. In the TestPyPI publish job (lines 132-141) and the PyPI publish job (lines 164-171), add id-token: write permission to the job permissions, replace the env vars TWINE_USERNAME and TWINE_PASSWORD with the pypa/gh-action-pypi-publish@release/v1 action which handles OIDC authentication automatically, and remove the manual twine upload commands. The pypa action will read the dist directory by default. Additionally, configure Trusted Publishers in both PyPI and TestPyPI project settings with the repository owner, name, workflow filename, and corresponding environment names (staging for TestPyPI, production for PyPI).Source: Linters/SAST tools
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/ci-cd.yml:
- Around line 37-43: All GitHub Actions `uses:` references need to be pinned to
immutable commit SHAs for supply-chain security. In
`.github/workflows/ci-cd.yml` (lines 37-43, 63-104, 123-129, 155-161), replace
the mutable version tags like `@v4` and `@v5` with their corresponding full
40-character commit SHAs for actions/checkout and actions/setup-python, and any
other action references in those ranges. Similarly, in
`.github/workflows/upload-coverage.yml` (lines 22-54), replace all mutable
action tags with their corresponding commit SHAs. Verify each action's commit
SHA by checking the official GitHub action repository tag releases.
---
Nitpick comments:
In @.github/workflows/ci-cd.yml:
- Around line 132-141: Migrate both the TestPyPI and PyPI publish jobs from
long-lived secrets to OIDC Trusted Publishing. In the TestPyPI publish job
(lines 132-141) and the PyPI publish job (lines 164-171), add id-token: write
permission to the job permissions, replace the env vars TWINE_USERNAME and
TWINE_PASSWORD with the pypa/gh-action-pypi-publish@release/v1 action which
handles OIDC authentication automatically, and remove the manual twine upload
commands. The pypa action will read the dist directory by default. Additionally,
configure Trusted Publishers in both PyPI and TestPyPI project settings with the
repository owner, name, workflow filename, and corresponding environment names
(staging for TestPyPI, production for PyPI).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 803ae938-90a0-42a2-88df-88d561e673fa
📒 Files selected for processing (11)
.coveralls.yml.flake8.github/CI_CD.md.github/workflows/ci-cd.yml.github/workflows/upload-coverage.yml.pre-commit-config.yaml.travis.ymlREADME.mdcodecov.ymldeploy-staging.shsetup.py
💤 Files with no reviewable changes (3)
- .travis.yml
- .coveralls.yml
- deploy-staging.sh
Address CodeRabbit review by pinning all workflow action references and disabling checkout credential persistence.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
.github/workflows/ci-cd.yml (1)
138-147: 💤 Low valueConsider using
python -m buildinstead of deprecatedsetup.pycommands.
python setup.py sdist bdist_wheelis deprecated. The modern PEP 517-compliant approach usespython -m build, which provides better build isolation.♻️ Suggested refactor
run: | - python -m pip install --upgrade pip setuptools wheel twine - python setup.py sdist bdist_wheel + python -m pip install --upgrade pip build twine + python -m build python -m twine upload \ --repository-url https://test.pypi.org/legacy/ \ dist/*🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/ci-cd.yml around lines 138 - 147, The build process in the "Build and publish package to TestPyPI" step uses the deprecated `python setup.py sdist bdist_wheel` command. Replace this with the modern PEP 517-compliant `python -m build` command by first installing the build package in the pip upgrade line, then replacing the setup.py invocation with `python -m build`. The dist/* output used by the twine upload step will still be created correctly with this change, so no modification to the twine upload command is needed.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In @.github/workflows/ci-cd.yml:
- Around line 138-147: The build process in the "Build and publish package to
TestPyPI" step uses the deprecated `python setup.py sdist bdist_wheel` command.
Replace this with the modern PEP 517-compliant `python -m build` command by
first installing the build package in the pip upgrade line, then replacing the
setup.py invocation with `python -m build`. The dist/* output used by the twine
upload step will still be created correctly with this change, so no modification
to the twine upload command is needed.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 3c256b8a-c67b-4539-a034-7fb4cce0c2a2
📒 Files selected for processing (2)
.github/workflows/ci-cd.yml.github/workflows/upload-coverage.yml
🚧 Files skipped from review as they are similar to previous changes (1)
- .github/workflows/upload-coverage.yml
Summary
codecov.ymlstagingbranch pushes publish to TestPyPI, git tags publish to production PyPI.travis.yml,deploy-staging.sh, and.coveralls.yml; update README badgesTest plan
CODECOV_TOKEN,TEST_PYPI_USERNAME,TEST_PYPI_PASSWORD,PYPI_API_TOKENci-cdworkflow passes (flake8 + pytest) on this PRstagingto confirm TestPyPI publishSummary by CodeRabbit
New Features
Bug Fixes
Chores