allow custom multithread name #11
Workflow file for this run
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
name: Tests and Coverage | |
on: | |
push: | |
branches: ['testing'] | |
pull_request: | |
branches: ['main', 'master', 'testing'] | |
workflow_dispatch: | |
jobs: | |
tests: | |
name: Python ${{ matrix.python-version }} on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
python-version: | |
- '3.12' | |
- '3.11' | |
- '3.9' | |
- '3.8' | |
- '3.7' | |
- 'pypy3.10' | |
os: ['ubuntu-20.04', 'windows-latest'] | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install --upgrade coverage | |
- name: Lint | |
run: | | |
python -m pip install --upgrade bandit | |
python -m bandit --recursive asyncutor | |
python -m pip install --upgrade flake8 | |
python -m flake8 . | |
if: ${{ matrix.os == 'ubuntu-20.04' && matrix.python-version == '3.12' }} | |
- name: Run tests | |
run: python tests.py | |
if: ${{ matrix.python-version != '3.12' }} | |
- name: Run tests with coverage | |
run: | | |
python -m coverage run tests.py | |
mkdir artifact && mv .coverage artifact/.coverage.${{ matrix.os }} | |
if: ${{ matrix.python-version == '3.12' && !startsWith(matrix.os, 'windows-') }} | |
- name: Run tests with coverage on Windows | |
run: | | |
python -m coverage run tests.py | |
mkdir artifact && move .coverage artifact\.coverage.windows | |
shell: cmd | |
if: ${{ matrix.python-version == '3.12' && startsWith(matrix.os, 'windows-') }} | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: artifact | |
if: ${{ matrix.python-version == '3.12' }} | |
report: | |
name: Upload Coverage to Codecov & SonarCloud Scan | |
needs: ['tests'] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
python -m venv --system-site-packages .local | |
echo "$HOME/.local/bin" >> $GITHUB_PATH | |
python -m pip install --upgrade pip | |
python -m pip install --upgrade coverage | |
- uses: actions/download-artifact@v3 | |
- name: Combine and view report | |
run: | | |
python -m coverage combine artifact | |
python -m coverage report --show-missing --skip-covered | |
python -m coverage xml | |
- uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
- uses: sonarsource/sonarcloud-github-action@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # needed to get PR information, if any | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |