Skip to content

Commit 7dd4ff6

Browse files
authored
Backport mitmproxy & codecov changes (#7158)
* switch to doing python coverage in actions (#7154) codecov still used for rust * update python version of downstreams for mitmproxy
1 parent 3fb93cf commit 7dd4ff6

File tree

3 files changed

+51
-13
lines changed

3 files changed

+51
-13
lines changed

.coveragerc

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
[run]
22
branch = True
3+
relative_files = True
34
source =
45
cryptography
56
tests/
67

78
[paths]
89
source =
910
src/cryptography
10-
.tox/*/lib*/python*/site-packages/cryptography
11-
.tox\*\Lib\site-packages\cryptography
12-
.tox/pypy/site-packages/cryptography
11+
*.tox/*/lib*/python*/site-packages/cryptography
12+
*.tox\*\Lib\site-packages\cryptography
13+
*.tox/pypy/site-packages/cryptography
14+
tests =
15+
tests/
16+
*tests\
1317

1418
[report]
1519
exclude_lines =

.github/actions/upload-coverage/action.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@ runs:
1111

1212
steps:
1313
- run: |
14-
PATH="/venv/bin:${PATH}"
15-
curl -o codecov.sh -f https://codecov.io/bash || \
16-
curl -o codecov.sh -f https://codecov.io/bash || \
17-
curl -o codecov.sh -f https://codecov.io/bash
18-
19-
bash codecov.sh -n "${{ inputs.name }}"
14+
COVERAGE_UUID=$(python3 -c "import uuid; print(uuid.uuid4())")
15+
echo "::set-output name=COVERAGE_UUID::${COVERAGE_UUID}"
16+
mv .coverage .coverage.${COVERAGE_UUID}
17+
id: coverage-uuid
2018
shell: bash
19+
- uses: actions/[email protected]
20+
with:
21+
name: coverage-${{ steps.coverage-uuid.outputs.COVERAGE_UUID }}
22+
path: ".coverage.*"
23+
if-no-files-found: ignore

.github/workflows/ci.yml

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,13 @@ jobs:
342342
sed -E -i 's/SF:src\/(.*)/SF:src\/rust\/src\/\1/g' ../../pytest-rust-cov.lcov
343343
sed -E -i 's/SF:src\/(.*)/SF:src\/rust\/src\/\1/g' ../../cargo-test-rust-cov.lcov
344344
345+
# We use codecov solely for rust coverage now, not Python
346+
- run: |
347+
curl -o codecov.sh -f https://codecov.io/bash || \
348+
curl -o codecov.sh -f https://codecov.io/bash || \
349+
curl -o codecov.sh -f https://codecov.io/bash
350+
bash codecov.sh -n "Rust Coverage" -f '*.lcov' -X coveragepy
351+
345352
- uses: ./.github/actions/upload-coverage
346353
with:
347354
name: "Rust Coverage"
@@ -507,7 +514,7 @@ jobs:
507514
RUST:
508515
- stable
509516
PYTHON:
510-
- 3.8
517+
- 3.9
511518
name: "Downstream tests for ${{ matrix.DOWNSTREAM }}"
512519
timeout-minutes: 15
513520
steps:
@@ -575,6 +582,30 @@ jobs:
575582
needs: [linux, linux-distros, linux-rust, linux-rust-coverage, macos, windows, linux-downstream]
576583
if: ${{ always() }}
577584
steps:
578-
- run: echo "😢"; exit 1
579-
if: ${{ needs.linux.result != 'success' || needs.linux-distros.result != 'success' || needs.linux-rust.result != 'success' || needs.linux-rust-coverage.result != 'success' || needs.macos.result != 'success' || needs.windows.result != 'success' || needs.linux-downstream.result != 'success' }}
580-
- run: echo "🎉"
585+
- uses: actions/[email protected]
586+
timeout-minutes: 3
587+
with:
588+
persist-credentials: false
589+
- run: echo "😢"; exit 1
590+
if: ${{ needs.linux.result != 'success' || needs.linux-distros.result != 'success' || needs.linux-rust.result != 'success' || needs.linux-rust-coverage.result != 'success' || needs.macos.result != 'success' || needs.windows.result != 'success' || needs.linux-downstream.result != 'success' }}
591+
- run: echo "🎉"
592+
- name: Setup python
593+
uses: actions/[email protected]
594+
with:
595+
python-version: '3.10'
596+
- run: pip install coverage
597+
- name: Download coverage data
598+
uses: actions/[email protected]
599+
- run: mv **/.coverage* .
600+
- name: Combine coverage and fail if it's <100%.
601+
run: |
602+
python -m coverage combine
603+
python -m coverage html
604+
python -m coverage report --fail-under=100
605+
- name: Upload HTML report.
606+
uses: actions/[email protected]
607+
with:
608+
name: _html-report
609+
path: htmlcov
610+
if-no-files-found: ignore
611+
if: ${{ always() }}

0 commit comments

Comments
 (0)