Skip to content

Commit

Permalink
Backport mitmproxy & codecov changes (#7158)
Browse files Browse the repository at this point in the history
* switch to doing python coverage in actions (#7154)

codecov still used for rust

* update python version of downstreams for mitmproxy
  • Loading branch information
reaperhulk committed Apr 30, 2022
1 parent 3fb93cf commit 7dd4ff6
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 13 deletions.
10 changes: 7 additions & 3 deletions .coveragerc
@@ -1,15 +1,19 @@
[run]
branch = True
relative_files = True
source =
cryptography
tests/

[paths]
source =
src/cryptography
.tox/*/lib*/python*/site-packages/cryptography
.tox\*\Lib\site-packages\cryptography
.tox/pypy/site-packages/cryptography
*.tox/*/lib*/python*/site-packages/cryptography
*.tox\*\Lib\site-packages\cryptography
*.tox/pypy/site-packages/cryptography
tests =
tests/
*tests\

[report]
exclude_lines =
Expand Down
15 changes: 9 additions & 6 deletions .github/actions/upload-coverage/action.yml
Expand Up @@ -11,10 +11,13 @@ runs:

steps:
- run: |
PATH="/venv/bin:${PATH}"
curl -o codecov.sh -f https://codecov.io/bash || \
curl -o codecov.sh -f https://codecov.io/bash || \
curl -o codecov.sh -f https://codecov.io/bash
bash codecov.sh -n "${{ inputs.name }}"
COVERAGE_UUID=$(python3 -c "import uuid; print(uuid.uuid4())")
echo "::set-output name=COVERAGE_UUID::${COVERAGE_UUID}"
mv .coverage .coverage.${COVERAGE_UUID}
id: coverage-uuid
shell: bash
- uses: actions/upload-artifact@v3.0.0
with:
name: coverage-${{ steps.coverage-uuid.outputs.COVERAGE_UUID }}
path: ".coverage.*"
if-no-files-found: ignore
39 changes: 35 additions & 4 deletions .github/workflows/ci.yml
Expand Up @@ -342,6 +342,13 @@ jobs:
sed -E -i 's/SF:src\/(.*)/SF:src\/rust\/src\/\1/g' ../../pytest-rust-cov.lcov
sed -E -i 's/SF:src\/(.*)/SF:src\/rust\/src\/\1/g' ../../cargo-test-rust-cov.lcov
# We use codecov solely for rust coverage now, not Python
- run: |
curl -o codecov.sh -f https://codecov.io/bash || \
curl -o codecov.sh -f https://codecov.io/bash || \
curl -o codecov.sh -f https://codecov.io/bash
bash codecov.sh -n "Rust Coverage" -f '*.lcov' -X coveragepy
- uses: ./.github/actions/upload-coverage
with:
name: "Rust Coverage"
Expand Down Expand Up @@ -507,7 +514,7 @@ jobs:
RUST:
- stable
PYTHON:
- 3.8
- 3.9
name: "Downstream tests for ${{ matrix.DOWNSTREAM }}"
timeout-minutes: 15
steps:
Expand Down Expand Up @@ -575,6 +582,30 @@ jobs:
needs: [linux, linux-distros, linux-rust, linux-rust-coverage, macos, windows, linux-downstream]
if: ${{ always() }}
steps:
- run: echo "😢"; exit 1
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' }}
- run: echo "🎉"
- uses: actions/checkout@v2.4.0
timeout-minutes: 3
with:
persist-credentials: false
- run: echo "😢"; exit 1
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' }}
- run: echo "🎉"
- name: Setup python
uses: actions/setup-python@v3.1.2
with:
python-version: '3.10'
- run: pip install coverage
- name: Download coverage data
uses: actions/download-artifact@v3.0.0
- run: mv **/.coverage* .
- name: Combine coverage and fail if it's <100%.
run: |
python -m coverage combine
python -m coverage html
python -m coverage report --fail-under=100
- name: Upload HTML report.
uses: actions/upload-artifact@v3.0.0
with:
name: _html-report
path: htmlcov
if-no-files-found: ignore
if: ${{ always() }}

0 comments on commit 7dd4ff6

Please sign in to comment.