Assistant checkpoint: Add CI/CD workflows and code quality checks #21
This file contains 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
name: Python Tests | |
on: | |
push: | |
branches: | |
- main # Run tests on pushes to the main branch | |
pull_request: | |
branches: | |
- main # Run tests on pull requests to the main branch | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.9' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Run tests with coverage | |
run: | | |
pip install coverage | |
coverage run -m unittest discover tests | |
coverage report | |
coverage xml | |
- name: Upload coverage reports | |
uses: codecov/codecov-action@v4 | |
with: | |
file: ./coverage.xml | |
fail_ci_if_error: true | |
- name: Send notification on failure | |
if: failure() # This step runs only if the workflow fails | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
github.issues.createComment({ | |
issue_number: context.issue.number, | |
body: "🚨 Tests failed! Please check the workflow logs for details." | |
}) |