Skip to content

Commit f5999ff

Browse files
committed
Remove 3rd party support; only console + 1st party
1 parent 7f67cf3 commit f5999ff

File tree

2 files changed

+39
-90
lines changed

2 files changed

+39
-90
lines changed

.github/workflows/ci.yml

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,14 @@ jobs:
9292
python -m unittest test_typing_extensions.py
9393
9494
- name: Archive code coverage results
95+
id: archive-coverage
9596
if: ${{ !startsWith(matrix.python-version, 'pypy') }}
9697
uses: actions/upload-artifact@v4
9798
with:
9899
name: .coverage_${{ matrix.python-version }}
99100
path: ./src/.coverage*
100101
include-hidden-files: true
101102
compression-level: 0 # no compression
102-
103-
104103
- name: Test CPython typing test suite
105104
# Test suite fails on PyPy even without typing_extensions
106105
if: ${{ !startsWith(matrix.python-version, 'pypy') }}
@@ -109,6 +108,9 @@ jobs:
109108
# Run the typing test suite from CPython with typing_extensions installed,
110109
# because we monkeypatch typing under some circumstances.
111110
python -c 'import typing_extensions; import test.__main__' test_typing -v
111+
outputs:
112+
# report if coverage was uploaded
113+
cov_uploaded: ${{ steps.archive-coverage.outputs.artifact-id }}
112114

113115
create-issue-on-failure:
114116
name: Create an issue if daily tests failed
@@ -138,14 +140,19 @@ jobs:
138140
title: `Daily tests failed on ${new Date().toDateString()}`,
139141
body: "Runs listed here: https://github.com/python/typing_extensions/actions/workflows/ci.yml",
140142
})
141-
prepare-report-coverage:
143+
144+
report-coverage:
142145
name: Report coverage
143146

144147
runs-on: ubuntu-latest
145148

146149
needs: [tests]
147150

148-
if: ${{ always() }}
151+
permissions:
152+
pull-requests: write
153+
154+
# Job will run even if tests failed but only if at least one artifact was uploaded
155+
if: ${{ always() && needs.tests.outputs.cov_uploaded != '' }}
149156

150157
steps:
151158
- uses: actions/checkout@v4
@@ -171,12 +178,39 @@ jobs:
171178
ls -aR .coverage*
172179
coverage combine .coverage*
173180
echo "Creating coverage report..."
181+
# Create a coverage report (console)
174182
coverage report
183+
# Create xml file for further processing
175184
coverage xml
176185
186+
# For future use in case we want to add a PR comment for 3rd party PRs which requires
187+
# a workflow with elevated PR write permissions. Move below steps into a separate job.
177188
- name: Archive code coverage report
178189
uses: actions/upload-artifact@v4
179190
with:
180191
name: coverage
181192
path: coverage.xml
182-
compression-level: 0 # no compression
193+
194+
- name: Code Coverage Report
195+
uses: irongut/CodeCoverageSummary@51cc3a756ddcd398d447c044c02cb6aa83fdae95 # v1.3.0
196+
with:
197+
filename: coverage.xml
198+
badge: true
199+
fail_below_min: true
200+
format: markdown
201+
hide_branch_rate: false
202+
hide_complexity: true
203+
indicators: true
204+
output: both # console, file or both
205+
thresholds: '90 95'
206+
207+
- name: Add Coverage PR Comment
208+
uses: marocchino/sticky-pull-request-comment@52423e01640425a022ef5fd42c6fb5f633a02728 # v2.9.3
209+
# Create PR comment when the branch is on the repo, otherwise we lack PR write permissions
210+
# -> need another workflow with access to secret token
211+
if: >-
212+
github.event_name == 'pull_request'
213+
&& github.event.pull_request.head.repo.full_name == github.repository
214+
with:
215+
recreate: true
216+
path: code-coverage-results.md

.github/workflows/coverage_report.yml

Lines changed: 0 additions & 85 deletions
This file was deleted.

0 commit comments

Comments
 (0)