Skip to content

Try with coverage report on gh #87

Try with coverage report on gh

Try with coverage report on gh #87

Workflow file for this run

name: Test suite
on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
jobs:
tests:
name: "Python ${{ matrix.python-version }}"
runs-on: "ubuntu-latest"
permissions:
pull-requests: write
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup user groups
run: |
sudo usermod -aG input,audio $USER
sudo modprobe -i uinput
echo KERNEL==\"uinput\", SUBSYSTEM==\"misc\" GROUP=\"docker\", MODE:=\"0666\" | sudo tee /etc/udev/rules.d/99-$USER.rules
echo KERNEL==\"event[0-9]*\", SUBSYSTEM==\"input\" GROUP=\"docker\", MODE:=\"0666\" | sudo tee -a /etc/udev/rules.d/99-$USER.rules
cat /etc/udev/rules.d/99-$USER.rules
sudo udevadm control --reload-rules
sudo udevadm trigger
lsmod
- name: Set up Python ${{ matrix.python-version }}
id: setuppy
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
# Issue ref: https://github.com/actions/setup-python/issues/436
# cache: 'pip'
# cache-dependency-path: pyproject.toml
- uses: actions/cache@v3
id: cache
with:
path: ${{ env.pythonLocation }}
key: python-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: |
pip install --disable-pip-version-check -e .[dev]
- name: Linting
run: |
ruff check --diff --output-format=github linuxpy tests examples
ruff format linuxpy tests examples --check
- name: Build package
run: |
python -m build
twine check dist/*
- name: Tests
id: tests
run: |
sudo -s -E -u $USER bash -c '${{ steps.setuppy.outputs.python-path }} -m ward'
- name: Upload coverage data
uses: actions/upload-artifact@v3
with:
name: html_report
path: ./htmlcov/
- name: Code Coverage Summary Report
uses: irongut/[email protected]
with:
filename: coverage.xml
badge: true
format: 'markdown'
output: 'both'
- name: Add Coverage PR Comment
uses: marocchino/sticky-pull-request-comment@v2
if: github.event_name == 'pull_request'
with:
path: code-coverage-results.md
recreate: true
- name: Write to Job Summary
run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY
deploy:
runs-on: ubuntu-latest
needs: tests
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Git
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
- name: Create and switch to gh-pages branch
run: |
git checkout gh-pages
#git fetch origin gh-pages:gh-pages
- name: Copy coverage HTML report from artifact
run: |
cp -r ${{ needs.tests.outputs.artifacts_directory }}/htmlcov/* .
- name: Commit and push changes
run: |
git add .
git commit -m "Update coverage HTML report"
git push origin gh-pages