From 2ea30d6d3fc274f4d5200d86afbffb9576975db5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Fri, 4 Nov 2022 23:30:16 +0100 Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=91=B7=20Move=20from=20pytest-cov=20t?= =?UTF-8?q?o=20coverage=20and=20Codecov=20to=20Smokeshow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/smokeshow.yml | 35 ++++++++++++++++++++++++++++ .github/workflows/test.yml | 41 ++++++++++++++++++++++++++++++--- README.md | 5 ++-- docs/index.md | 5 ++-- pyproject.toml | 12 ++++++++-- scripts/test-cov-html.sh | 5 +++- scripts/test.sh | 2 +- 7 files changed, 92 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/smokeshow.yml diff --git a/.github/workflows/smokeshow.yml b/.github/workflows/smokeshow.yml new file mode 100644 index 000000000..606633a99 --- /dev/null +++ b/.github/workflows/smokeshow.yml @@ -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 }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 25b22f1f2..a77d034b5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 diff --git a/README.md b/README.md index 7c9a1d1ea..de9420074 100644 --- a/README.md +++ b/README.md @@ -11,9 +11,8 @@ Publish - - Coverage - + + Coverage Package version diff --git a/docs/index.md b/docs/index.md index 7c9a1d1ea..de9420074 100644 --- a/docs/index.md +++ b/docs/index.md @@ -11,9 +11,8 @@ Publish - - Coverage - + + Coverage Package version diff --git a/pyproject.toml b/pyproject.toml index 9e6ea70c8..8761eb7b9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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[toml] >= 6.5.0,<7.0", "pytest-xdist >=1.32.0,<2.0.0", "pytest-sugar >=0.9.4,<0.10.0", "mypy ==0.910", @@ -74,3 +73,12 @@ skip_glob = [ "docs_src/subcommands/tutorial003/lands.py", "docs_src/subcommands/tutorial003/main.py", ] + +[tool.coverage.run] +parallel = true +source = [ + "docs_src", + "tests", + "typer" +] +context = '${CONTEXT}' diff --git a/scripts/test-cov-html.sh b/scripts/test-cov-html.sh index 7957277fc..d1bdfced2 100755 --- a/scripts/test-cov-html.sh +++ b/scripts/test-cov-html.sh @@ -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 diff --git a/scripts/test.sh b/scripts/test.sh index 5f41d0f1c..40e7a3f55 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -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 ${@} From 3cbd0578c51f3b65cd2a6936f77bdb60ba636c60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Fri, 4 Nov 2022 23:50:59 +0100 Subject: [PATCH 2/3] =?UTF-8?q?=E2=AC=87=EF=B8=8F=20Try=20to=20relax=20the?= =?UTF-8?q?=20requirement=20for=20coverage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 8761eb7b9..3738b8a6f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,7 +39,7 @@ Documentation = "https://typer.tiangolo.com/" test = [ "shellingham >=1.3.0,<2.0.0", "pytest >=4.4.0,<5.4.0", - "coverage[toml] >= 6.5.0,<7.0", + "coverage[toml] >=5.2,<7.0", "pytest-xdist >=1.32.0,<2.0.0", "pytest-sugar >=0.9.4,<0.10.0", "mypy ==0.910", From 42eb21d92820d5edb675afbe9914500a15b2a786 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Sat, 5 Nov 2022 00:03:31 +0100 Subject: [PATCH 3/3] =?UTF-8?q?=E2=AC=87=EF=B8=8F=20Remove=20coverage=20TO?= =?UTF-8?q?ML=20extra=20to=20support=20Python=203.6,=20move=20configs=20to?= =?UTF-8?q?=20.coveragerc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .coveragerc | 1 + pyproject.toml | 11 +---------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/.coveragerc b/.coveragerc index 18cdff194..54df9e71c 100644 --- a/.coveragerc +++ b/.coveragerc @@ -6,3 +6,4 @@ source = docs_src parallel = True +context = '${CONTEXT}' diff --git a/pyproject.toml b/pyproject.toml index 3738b8a6f..3fc602b9b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,7 +39,7 @@ Documentation = "https://typer.tiangolo.com/" test = [ "shellingham >=1.3.0,<2.0.0", "pytest >=4.4.0,<5.4.0", - "coverage[toml] >=5.2,<7.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", @@ -73,12 +73,3 @@ skip_glob = [ "docs_src/subcommands/tutorial003/lands.py", "docs_src/subcommands/tutorial003/main.py", ] - -[tool.coverage.run] -parallel = true -source = [ - "docs_src", - "tests", - "typer" -] -context = '${CONTEXT}'