Day 5 part 1 #19
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
# This workflow will install Python dependencies, run tests and lint. | |
name: CI | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
jobs: | |
checks: | |
name: Code Quality Checks | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install poetry | |
run: | | |
pipx install poetry | |
- name: Chekout Repo | |
uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
cache: "poetry" | |
- name: Install dependencies | |
run: | | |
poetry env use 3.11 | |
poetry config installer.modern-installation false | |
poetry install | |
- name: Verify formatting | |
run: | | |
poetry run ruff . --select I | |
poetry run ruff format --check . | |
- name: Lint | |
run: | | |
poetry run ruff . --exit-zero | |
poetry run mypy --install-types --non-interactive . | |
poetry run mypy --html-report=mypy_report . | |
- name: "Upload Mypy Report" | |
uses: actions/upload-artifact@v3 | |
with: | |
name: mypy | |
path: mypy_report | |
- name: Build Docs | |
run: | | |
make docs | |
- name: Upload Docs | |
uses: actions/upload-artifact@v3 | |
with: | |
name: docs | |
path: docs/site | |
- name: Build Wheel | |
run: | | |
python -m pip install --upgrade pip | |
pip install build | |
python -m build . | |
- name: "Upload Distribution" | |
uses: actions/upload-artifact@v3 | |
with: | |
name: dist | |
path: dist | |
- name: Run tests | |
run: | | |
poetry run coverage run -m pytest --html=test_report.html --self-contained-html | |
- name: "Upload Coverage" | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage | |
path: .coverage.* | |
- name: Show Coverage Report | |
run: | | |
poetry run coverage combine | |
poetry run coverage report | |
- name: Create HTML report | |
run: | | |
poetry run coverage html | |
- name: Upload HTML report | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage_html | |
path: htmlcov | |
- name: Upload coverage data | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage | |
path: .coverage | |
- name: Check minimum coverage | |
run: | | |
poetry run coverage report | |
poetry run echo '## Test Coverage Report' >> $GITHUB_STEP_SUMMARY | |
poetry run coverage report --format markdown >> $GITHUB_STEP_SUMMARY |