Skip to content

Commit 3418975

Browse files
authored
Revert Generate coverage reports using only GitHub Actions (#455)
* Revert "Generate coverage reports using only GitHub Actions, without codecov.io (#447)" This reverts commit 9554985. * Add news fragment
1 parent 24f65a0 commit 3418975

File tree

7 files changed

+7
-172
lines changed

7 files changed

+7
-172
lines changed

.github/CODEOWNERS

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# See https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners
2+
* @twisted/twisted-contributors

.github/scripts/pr_comment.js

-80
This file was deleted.

.github/workflows/ci.yml

+1-84
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ on:
66
tags: [ "**" ]
77
pull_request:
88

9-
permissions:
10-
contents: read
11-
129
defaults:
1310
run:
1411
shell: bash
@@ -99,18 +96,8 @@ jobs:
9996

10097
- run: nox --python ${{ matrix.python.action }} -e ${{ matrix.task.nox }} -- --use-wheel dist/*.whl
10198

102-
- name: Store coverage file
103-
uses: actions/upload-artifact@v3
104-
with:
105-
name: coverage
106-
# It is important to keep the unique names for the coverage files
107-
# so that when uploaded to the same artifact, they don't overlap.
108-
path: .coverage*
109-
11099
- name: Codecov
111100
run: |
112-
ls -al .coverage*
113-
coverage combine
114101
codecov -n "GitHub Actions - ${{ matrix.task.name}} - ${{ matrix.os.name }} ${{ matrix.python.name }}"
115102
116103
@@ -150,18 +137,8 @@ jobs:
150137

151138
- run: nox --python ${{ matrix.python.action }} -e ${{ matrix.task.nox }} -- --use-wheel dist/*.whl
152139

153-
- name: Store coverage file
154-
uses: actions/upload-artifact@v3
155-
with:
156-
name: coverage
157-
# It is important to keep the unique names for the coverage files
158-
# so that when uploaded to the same artifact, they don't overlap.
159-
path: .coverage*
160-
161140
- name: Codecov
162141
run: |
163-
ls -al .coverage*
164-
coverage combine
165142
codecov -n "GitHub Actions - ${{ matrix.task.name}} - ${{ matrix.os.name }} ${{ matrix.python.name }}"
166143
167144
check:
@@ -255,65 +232,6 @@ jobs:
255232
password: ${{ secrets.PYPI_TOKEN }}
256233
verbose: true
257234

258-
coverage-report:
259-
name: Coverage report
260-
runs-on: ubuntu-latest
261-
permissions:
262-
# Even we send a comment to a PR, we use the issues API.
263-
# Issues and PR share the same comment API.
264-
issues: write
265-
needs:
266-
# We are waiting only for test jobs.
267-
- test-linux
268-
- test-windows
269-
steps:
270-
- uses: actions/checkout@v3
271-
with:
272-
fetch-depth: 0
273-
274-
- name: Install dependencies
275-
run: |
276-
python -m pip install --upgrade pip
277-
python -m pip install --upgrade coverage[toml] diff_cover
278-
279-
- name: Download coverage reports
280-
uses: actions/download-artifact@v3
281-
with:
282-
name: coverage
283-
path: .
284-
285-
- name: Combine coverage
286-
run: coverage combine
287-
288-
- name: Report coverage
289-
run: |
290-
coverage xml
291-
coverage report --no-skip-covered --show-missing
292-
# Wrap output in markdown verbatim text.
293-
echo '```' > coverage-report.txt
294-
coverage report --show-missing >> coverage-report.txt
295-
echo '```' >> coverage-report.txt
296-
diff-cover --markdown-report diff-cover.md --compare-branch origin/trunk coverage.xml
297-
cat diff-cover.md >> coverage-report.txt
298-
299-
# Use the generic JS script to call our custom script
300-
# for sending a comment to a PR.
301-
- name: Send coverage comment to PR
302-
uses: actions/github-script@v3
303-
env:
304-
COMMENT_MARKER: "<!--- automatic-coverage-report -->"
305-
COMMENT_BODY: coverage-report.txt
306-
with:
307-
script: |
308-
const script = require(`${process.env.GITHUB_WORKSPACE}/.github/scripts/pr_comment.js`)
309-
// Only pass top level objects as GHA does dependecy injection.
310-
await script({github, context, process})
311-
312-
- name: Enforce diff coverage
313-
run: |
314-
diff-cover --fail-under=100 --compare-branch origin/trunk coverage.xml
315-
316-
317235
# This is a meta-job to simplify PR CI enforcement configuration in GitHub.
318236
# Inside the GitHub config UI you only configure this job as required.
319237
# All the extra requirements are defined "as code" as part of the `needs`
@@ -332,9 +250,8 @@ jobs:
332250
- test-windows
333251
- check
334252
- pypi-publish
335-
- coverage-report
336253
steps:
337254
- name: Require all successes
338-
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe
255+
uses: re-actors/alls-green@3a2de129f0713010a71314c74e33c0e3ef90e696
339256
with:
340257
jobs: ${{ toJSON(needs) }}

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ dist/
1111
venv/
1212
htmlcov/
1313
.coverage
14-
coverage.xml
1514
*~
1615
*.lock
1716
apidocs/

noxfile.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ def tests(session: nox.Session) -> None:
3636
session.run("coverage", "run", "--module", "twisted.trial", *posargs)
3737

3838
if os.environ.get("CI") != "true":
39-
# When running the test locally, show the coverage report.
4039
session.notify("coverage_report")
40+
else:
41+
session.run("coverage", "combine")
4142

4243

4344
@nox.session

pyproject.toml

+2-6
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,7 @@ branch = true
9191
source = ["towncrier"]
9292

9393
[tool.coverage.paths]
94-
source = [
95-
"src",
96-
"*.nox/*/site-packages",
97-
# required until coverage 6.6.0 is used: https://github.com/nedbat/coveragepy/issues/991
98-
"*.nox\\*\\*\\site-packages"
99-
]
94+
source = ["src", ".nox/*/site-packages"]
10095

10196
[tool.coverage.report]
10297
show_missing = true
@@ -107,4 +102,5 @@ exclude_lines = [
107102
]
108103
omit = [
109104
"src/towncrier/__main__.py",
105+
"src/towncrier/test/*",
110106
]
File renamed without changes.

0 commit comments

Comments
 (0)