Fix: Make CI/CD pipeline robust and non-interactive#12
Closed
Fix: Make CI/CD pipeline robust and non-interactive#12
Conversation
**Interactive Script Fix:** - Add os.isatty() check to detect non-interactive environments - Use dummy model by default in CI/CD environments - Skip user prompts and run minimal evaluation in CI mode - Preserve all interactive functionality for manual use - Ensures integration tests can run without hanging on input() **CI/CD Workflow Improvements:** - Remove --exit-zero flag from flake8 to fail build on linting errors - Remove || true from bandit to fail build on security vulnerabilities - Remove --ignore-missing-imports from mypy for stricter type checking - Add examples/ directory to flake8 linting scope - Add --strict-optional flag to mypy for better type safety These changes make the CI/CD pipeline more robust by ensuring that linting errors, security issues, and type checking problems will properly fail the build instead of being ignored.
- Set choice variable in non-interactive branch to prevent UnboundLocalError - Script now properly runs without hanging on input() calls - Maintains compatibility for both interactive and CI/CD environments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This pull request resolves critical issues in the CI/CD pipeline that were causing the
integration-testjob to fail and makes the overall pipeline more robust by ensuring linting, security, and type checking failures properly fail the build.🔧 Interactive Script Fix
Problem: The
examples/basic_usage.pyscript was hanging during CI/CD execution due toinput()calls waiting for user interaction.Solution:
os.isatty()check to detect non-interactive environments (CI/CD)Before:
After:
🛡️ CI/CD Workflow Improvements
Problem: The CI/CD pipeline was not failing builds when it should due to permissive flags that treated errors as warnings.
Changes Made:
1. Linting (flake8)
--exit-zeroflag that treated all errors as warningsexamples/directory to linting scope2. Security Scanning (bandit)
|| truethat prevented security failures from failing the build3. Type Checking (mypy)
--ignore-missing-importsflag for stricter checking--strict-optionalflag for better type safety📊 Impact
Before (Problematic)
input()calls--exit-zero|| trueAfter (Robust)
🧪 Testing
Non-Interactive Mode Verification:
Interactive Mode Preserved:
# Still prompts for user input when run manually python examples/basic_usage.py🎯 Files Changed
examples/basic_usage.pyos.isatty().github/workflows/ci.yml✅ Verification Checklist
🚀 Benefits
This PR ensures the MEQ-Bench CI/CD pipeline is robust, reliable, and maintains high code quality standards while preserving the excellent user experience for manual testing and development.
🤖 Generated with Claude Code