👷 Move from pytest-cov to coverage and Codecov to Smokeshow (#483)

This commit is contained in:
Sebastián Ramírez 2022-11-05 00:08:30 +01:00 committed by GitHub
parent 1e43c6bb0d
commit b988f6fe67
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 84 additions and 13 deletions

View file

@ -6,3 +6,4 @@ source =
docs_src
parallel = True
context = '${CONTEXT}'

35
.github/workflows/smokeshow.yml vendored Normal file
View file

@ -0,0 +1,35 @@
name: Smokeshow
on:
workflow_run:
workflows: [Test]
types: [completed]
permissions:
statuses: write
jobs:
smokeshow:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v4
with:
python-version: '3.9'
- run: pip install smokeshow
- uses: dawidd6/action-download-artifact@v2
with:
workflow: test.yml
commit: ${{ github.event.workflow_run.head_sha }}
- run: smokeshow upload coverage-html
env:
SMOKESHOW_GITHUB_STATUS_DESCRIPTION: Coverage {coverage-percentage}
SMOKESHOW_GITHUB_COVERAGE_THRESHOLD: 100
SMOKESHOW_GITHUB_CONTEXT: coverage
SMOKESHOW_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SMOKESHOW_GITHUB_PR_HEAD_SHA: ${{ github.event.workflow_run.head_sha }}
SMOKESHOW_AUTH_KEY: ${{ secrets.SMOKESHOW_AUTH_KEY }}

View file

@ -25,7 +25,6 @@ jobs:
- name: Install Flit
run: pip install flit
- name: Install Dependencies
# run: flit install --deps=develop --symlink
run: python -m pip install ".[test]"
- name: Install Click 7
if: matrix.click-7
@ -33,7 +32,43 @@ jobs:
- name: Lint
if: ${{ matrix.python-version != '3.6' && matrix.click-7 == false }}
run: bash scripts/lint.sh
- run: mkdir coverage
- name: Test
run: bash scripts/test.sh
- name: Upload coverage
uses: codecov/codecov-action@v3
env:
COVERAGE_FILE: coverage/.coverage.${{ runner.os }}-py${{ matrix.python-version }}
CONTEXT: ${{ runner.os }}-py${{ matrix.python-version }}
- name: Store coverage files
uses: actions/upload-artifact@v3
with:
name: coverage
path: coverage
coverage-combine:
needs: [test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Get coverage files
uses: actions/download-artifact@v3
with:
name: coverage
path: coverage
- run: pip install coverage[toml]
- run: ls -la coverage
- run: coverage combine coverage
- run: coverage report
- run: coverage html --show-contexts --title "Coverage for ${{ github.sha }}"
- name: Store coverage HTML
uses: actions/upload-artifact@v3
with:
name: coverage-html
path: htmlcov

View file

@ -11,9 +11,8 @@
<a href="https://github.com/tiangolo/typer/actions?query=workflow%3APublish" target="_blank">
<img src="https://github.com/tiangolo/typer/workflows/Publish/badge.svg" alt="Publish">
</a>
<a href="https://codecov.io/gh/tiangolo/typer" target="_blank">
<img src="https://img.shields.io/codecov/c/github/tiangolo/typer?color=%2334D058" alt="Coverage">
</a>
<a href="https://coverage-badge.samuelcolvin.workers.dev/redirect/tiangolo/typer" target="_blank">
<img src="https://coverage-badge.samuelcolvin.workers.dev/tiangolo/typer.svg" alt="Coverage">
<a href="https://pypi.org/project/typer" target="_blank">
<img src="https://img.shields.io/pypi/v/typer?color=%2334D058&label=pypi%20package" alt="Package version">
</a>

View file

@ -11,9 +11,8 @@
<a href="https://github.com/tiangolo/typer/actions?query=workflow%3APublish" target="_blank">
<img src="https://github.com/tiangolo/typer/workflows/Publish/badge.svg" alt="Publish">
</a>
<a href="https://codecov.io/gh/tiangolo/typer" target="_blank">
<img src="https://img.shields.io/codecov/c/github/tiangolo/typer?color=%2334D058" alt="Coverage">
</a>
<a href="https://coverage-badge.samuelcolvin.workers.dev/redirect/tiangolo/typer" target="_blank">
<img src="https://coverage-badge.samuelcolvin.workers.dev/tiangolo/typer.svg" alt="Coverage">
<a href="https://pypi.org/project/typer" target="_blank">
<img src="https://img.shields.io/pypi/v/typer?color=%2334D058&label=pypi%20package" alt="Package version">
</a>

View file

@ -39,8 +39,7 @@ Documentation = "https://typer.tiangolo.com/"
test = [
"shellingham >=1.3.0,<2.0.0",
"pytest >=4.4.0,<5.4.0",
"pytest-cov >=2.10.0,<3.0.0",
"coverage >=5.2,<6.0",
"coverage >=5.2,<7.0",
"pytest-xdist >=1.32.0,<2.0.0",
"pytest-sugar >=0.9.4,<0.10.0",
"mypy ==0.910",

View file

@ -3,4 +3,7 @@
set -e
set -x
bash scripts/test.sh --cov-report=html ${@}
bash scripts/test.sh ${@}
coverage combine
coverage report --show-missing
coverage html

View file

@ -9,4 +9,4 @@ export TERMINAL_WIDTH=3000
export _TYPER_FORCE_DISABLE_TERMINAL=1
bash ./scripts/test-files.sh
# Use xdist-pytest --forked to ensure modified sys.path to import relative modules in examples keeps working
pytest --cov=typer --cov=tests --cov=docs_src --cov-report=term-missing --cov-report=xml -o console_output_style=progress --forked --numprocesses=auto ${@}
coverage run -m pytest -o console_output_style=progress --forked --numprocesses=auto ${@}