Open
Description
Description
We need to set up a Continuous Integration (CI) pipeline for the Arc Pinned Tabs to HTML Bookmarks Converter project. This pipeline will automate code quality checks, linting, and running tests to ensure code consistency and reliability.
Objectives
- Set up GitHub Actions for CI
- Implement linting with flake8
- Implement code formatting with black
- Set up and run unit tests
- Generate code coverage reports
Tasks
1. Set up GitHub Actions
- Create a
.github/workflows
directory - Create a YAML file for the CI workflow (e.g.,
ci.yml
)
2. Implement Linting with flake8
- Add flake8 to the project development dependencies
- Create a
.flake8
configuration file - Add a step in the CI workflow to run flake8
3. Implement Code Formatting with black
- Add black to the project development dependencies
- Create a
pyproject.toml
file for black configuration - Add a step in the CI workflow to check if the code is formatted with black
4. Set up and Run Unit Tests
- Add pytest to the project development dependencies
- Create a
tests
directory and add initial test files - Add a step in the CI workflow to run pytest
5. Generate Code Coverage Reports
- Add pytest-cov to the project development dependencies
- Configure pytest to generate coverage reports
- Add a step in the CI workflow to generate and upload coverage reports
Proposed CI Workflow
name: CI
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 black pytest pytest-cov
- name: Run linting
run: flake8 .
- name: Check formatting
run: black --check .
- name: Run tests with coverage
run: pytest --cov=./ --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
file: ./coverage.xml
fail_ci_if_error: true
Additional Tasks
- Update
requirements.txt
orsetup.py
to include development dependencies - Add badges to the README.md for build status and code coverage
- Document the CI process in the project documentation
Acceptance Criteria
- CI pipeline is set up and running on every push and pull request
- Linting with flake8 is implemented and passing
- Code formatting with black is enforced
- Unit tests are running in the CI pipeline
- Code coverage reports are generated and uploaded
- README is updated with CI and code quality badges