Skip to content

Update Codecov action to v5 and add slug for coverage reporting #18

Update Codecov action to v5 and add slug for coverage reporting

Update Codecov action to v5 and add slug for coverage reporting #18

name: Python Tests and Publish
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
release:
types: [created]
jobs:
test:
runs-on: self-hosted
strategy:
matrix:
python-version: [3.7, 3.8, 3.9]
steps:
- uses: actions/checkout@v2
- name: Set Environment Variables
run: |
export PATH="/home/dixon/actions-runner/_work/_tool:$PATH"
export RUNNER_TOOL_CACHE="/home/dixon/actions-runner/_work/_tool"
export AGENT_TOOLSDIRECTORY="/home/dixon/actions-runner/_work/_tool"
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
architecture: 'x64'
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade setuptools wheel
pip install -r requirements.txt
- name: Install test dependencies
run: |
pip install pytest pytest-cov
- name: Run tests
run: |
export PYTHONPATH=$PYTHONPATH:$(pwd)
pytest tests/ --cov=src/ --cov-report=xml
- name: Upload coverage report
uses: codecov/codecov-action@v5
with:
file: ./coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}
slug: dxns-hub/vapos
flags: unittests
fail_ci_if_error: false
publish:
needs: test
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'created'
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
architecture: 'x64'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*