Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 29 additions & 2 deletions .github/workflows/pythonapp.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
name: Python application

on: [push]
on:
push:
pull_request:

jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version:
- '3.10'
Expand All @@ -18,11 +21,35 @@ jobs:
with:
python-version: '${{ matrix.python-version }}'
- name: 'Install dependencies'
run: "python -m pip install --upgrade pip\npip install tox tox-gh-actions\n"
run: pip install tox tox-gh-actions
- name: 'Test with tox'
run: tox
- name: 'Upload coverage report'
if: matrix.python-version == '3.10'
uses: actions/upload-artifact@v4
with:
name: cobertura-report
path: cobertura.xml
- uses: casperdcl/deploy-pypi@v2
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') && matrix.python-version == '3.10'
with:
password: ${{ secrets.pypi_token }}
build: true

upload-coverage:
needs: build
if: ${{ !cancelled() && needs.build.result == 'success' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }}
runs-on: ubuntu-latest
permissions:
contents: read
code-quality: write
pull-requests: read
steps:
- uses: actions/download-artifact@v4
with:
name: cobertura-report
- uses: actions/upload-code-coverage@v1
with:
file: cobertura.xml
language: Python
label: code-coverage/pytest
3 changes: 2 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
envlist = py310, py312, py314, lint

[testenv]
commands = pytest {posargs}
commands = pytest --cov=ros_ws --cov-report=xml:cobertura.xml {posargs}
deps =
pytest
pytest-cov

[testenv:lint]
basepython=python3.12
Expand Down
Loading