Fix GitHub Actions workflows for reliable CI/CD#6
Merged
Conversation
- Fix deprecated github/copilot-models action in release workflow - Remove deprecated 'models: read' permission - Add proper error handling and validation for dependency installation - Make test execution conditional when tests don't exist - Add build artifact validation before PyPI publishing - Create separate CI workflow for PR testing with matrix builds - Improve logging and debugging output throughout workflows
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes the deprecated github/copilot-models action (which was used to auto-detect version bump type via an LLM) and replaces it with a simple default-to-patch fallback. It also adds a new CI workflow for PR testing and improves the release workflow with better logging, error handling, and build validation.
Changes:
- Replace the
github/copilot-modelsaction with a deterministic patch-default fallback and remove the invalidmodels: readpermission - Add verbose logging, build artifact validation, and version update verification to the release workflow
- Create a new
ci.ymlworkflow that runs tests, build checks, import validation, andpyproject.tomlvalidation on PRs and pushes to main
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
.github/workflows/release.yml |
Removes deprecated Copilot models action, adds logging/validation, improves error handling for dependency install, tests, build, and version update steps |
.github/workflows/ci.yml |
New CI workflow with test matrix (Python 3.12/3.13), build check, import validation, and pyproject.toml validation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+164
to
+168
| if [ -d "tests" ] && [ "$(ls -A tests/*.py 2>/dev/null)" ]; then | ||
| echo "Running tests..." | ||
| python -m pytest tests/ -v | ||
| else | ||
| echo "No tests found, skipping test step" |
Comment on lines
+32
to
+36
| if [ -d "tests" ] && [ "$(ls -A tests/*.py 2>/dev/null)" ]; then | ||
| echo "Running tests..." | ||
| python -m pytest tests/ -v | ||
| else | ||
| echo "No tests found, skipping test step" |
|
|
||
| - name: Validate pyproject.toml | ||
| run: | | ||
| pip install tomli-w |
Comment on lines
+4
to
+75
| pull_request: | ||
| branches: [main] | ||
| push: | ||
| branches: [main] | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| python-version: ["3.12", "3.13"] | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python ${{ matrix.python-version }} | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| pip install --upgrade pip | ||
| pip install -e . | ||
| pip install pytest | ||
|
|
||
| - name: Run tests | ||
| run: | | ||
| if [ -d "tests" ] && [ "$(ls -A tests/*.py 2>/dev/null)" ]; then | ||
| echo "Running tests..." | ||
| python -m pytest tests/ -v | ||
| else | ||
| echo "No tests found, skipping test step" | ||
| fi | ||
|
|
||
| - name: Check package can be built | ||
| run: | | ||
| pip install build | ||
| python -m build | ||
| echo "Package built successfully" | ||
|
|
||
| lint: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.12" | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| pip install --upgrade pip | ||
| pip install -e . | ||
|
|
||
| - name: Check imports | ||
| run: | | ||
| echo "Testing basic import..." | ||
| python -c "import pyflic_ble; print('Import successful')" | ||
|
|
||
| - name: Validate pyproject.toml | ||
| run: | | ||
| pip install tomli-w | ||
| python -c " | ||
| import tomllib | ||
| with open('pyproject.toml', 'rb') as f: | ||
| data = tomllib.load(f) | ||
| print('pyproject.toml is valid') | ||
| print(f'Project: {data[\"project\"][\"name\"]} v{data[\"project\"][\"version\"]}') | ||
| " |
Keep the better fix that removes deprecated github/copilot-models action entirely rather than trying to update to @latest (which is also non-functional). The simple fallback to patch bump is more reliable.
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.
Fix deprecated GitHub Actions and improve CI/CD reliability.
Key changes:
This makes the release workflow more reliable and adds early testing for PRs.