diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e8a3b07..a8d08ca 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,9 @@ on: jobs: tests: name: "Python ${{ matrix.python-version }}" - runs-on: "ubuntu-20.04" + runs-on: "ubuntu-latest" + permissions: + pull-requests: write strategy: matrix: @@ -17,17 +19,17 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 - - name: Setup udev device correctly + uses: actions/checkout@v4 + - name: Setup user groups run: | sudo usermod -aG input,audio $USER - sudo -s -u ${USER} bash -c 'whoami && groups' 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 @@ -48,7 +50,8 @@ jobs: pip install --disable-pip-version-check -e .[dev] - name: Linting run: | - scripts/lint.sh + ruff check --diff --output-format=github linuxpy tests examples + ruff format linuxpy tests examples --check - name: Build package run: | python -m build @@ -57,3 +60,24 @@ jobs: 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/CodeCoverageSummary@v1.3.0 + 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 diff --git a/pyproject.toml b/pyproject.toml index b667cc6..2101332 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -86,7 +86,7 @@ show-slowest = 3 [tool.ward.plugins.coverage] branch = true omit = ["*test*"] -report_type = ["term", "html"] +report_type = ["term", "html", "json", "xml"] report = {skip_empty = true, show_missing = true}