Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wip] attempt to use GHA for generating coverage reports #5982

Closed
wants to merge 17 commits into from
11 changes: 6 additions & 5 deletions .coveragerc
@@ -1,15 +1,16 @@
[run]
parallel = True
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

[report]
exclude_lines =
Expand Down
19 changes: 0 additions & 19 deletions .github/actions/upload-coverage/action.yml

This file was deleted.

42 changes: 30 additions & 12 deletions .github/workflows/ci.yml
Expand Up @@ -42,7 +42,7 @@ jobs:
- {VERSION: "3.9", TOXENV: "py39", OPENSSL: {TYPE: "libressl", VERSION: "3.4.1"}}
- {VERSION: "3.10", TOXENV: "py310"}
# Latest commit on the main-with-bazel branch, as of November 8, 2021
- {VERSION: "3.10", TOXENV: "backend-import", OPENSSL: {TYPE: "boringssl", VERSION: "4fb158925f7753d80fb858cb0239dff893ef9f15"}}
- {VERSION: "3.10", TOXENV: "backend-import", OPENSSL: {TYPE: "boringssl", VERSION: "4fb158925f7753d80fb858cb0239dff893ef9f15"}, COVERAGE: "false"}
RUST:
- stable
name: "${{ matrix.PYTHON.TOXENV }} ${{ matrix.PYTHON.OPENSSL.TYPE }} ${{ matrix.PYTHON.OPENSSL.VERSION }} ${{ matrix.PYTHON.TOXARGS }} ${{ matrix.PYTHON.OPENSSL.CONFIG_FLAGS }}"
Expand Down Expand Up @@ -76,7 +76,7 @@ jobs:
repository: "google/wycheproof"
path: "wycheproof"
ref: "master"
- run: python -m pip install tox requests coverage
- run: python -m pip install tox requests git+https://github.com/alex/coveragepy@patch-1
- name: Compute config hash and set config vars
run: |
DEFAULT_CONFIG_FLAGS="shared no-ssl2 no-ssl3"
Expand Down Expand Up @@ -116,8 +116,9 @@ jobs:
TOXENV: ${{ matrix.PYTHON.TOXENV }}
CARGO_TARGET_DIR: ${{ format('{0}/src/rust/target/', github.workspace) }}

- uses: ./.github/actions/upload-coverage
- uses: alex/github-actions-coverage-merge@main
with:
mode: upload
name: "tox -e ${{ matrix.PYTHON.TOXENV }} ${{ env.OSSL_INFO }}"
if: matrix.PYTHON.COVERAGE != 'false'

Expand Down Expand Up @@ -165,13 +166,15 @@ jobs:
echo "OPENSSL_FORCE_FIPS_MODE=1" >> $GITHUB_ENV
echo "CFLAGS=-DUSE_OSRANDOM_RNG_FOR_TESTING" >> $GITHUB_ENV
if: matrix.IMAGE.FIPS
- run: pip install git+https://github.com/alex/coveragepy@patch-1
- run: 'tox -- --wycheproof-root="wycheproof"'
env:
TOXENV: ${{ matrix.IMAGE.TOXENV }}
RUSTUP_HOME: /root/.rustup
CARGO_TARGET_DIR: ${{ format('{0}/src/rust/target/', github.workspace) }}
- uses: ./.github/actions/upload-coverage
- uses: alex/github-actions-coverage-merge@main
with:
mode: upload
name: "${{ matrix.IMAGE.TOXENV }} on ${{ matrix.IMAGE.IMAGE }}"

linux-rust:
Expand Down Expand Up @@ -217,15 +220,16 @@ jobs:
repository: "google/wycheproof"
path: "wycheproof"
ref: "master"
- run: python -m pip install tox coverage
- run: python -m pip install tox git+https://github.com/alex/coveragepy@patch-1
- name: Tests
run: |
tox -r -- --color=yes --wycheproof-root=wycheproof
env:
TOXENV: ${{ matrix.PYTHON.TOXENV }}
CARGO_TARGET_DIR: ${{ format('{0}/src/rust/target/', github.workspace) }}
- uses: ./.github/actions/upload-coverage
- uses: alex/github-actions-coverage-merge@main
with:
mode: upload
name: "${{ matrix.PYTHON.TOXENV }} with Rust ${{ matrix.RUST }}"

linux-rust-coverage:
Expand Down Expand Up @@ -275,7 +279,7 @@ jobs:
repository: "google/wycheproof"
path: "wycheproof"
ref: "master"
- run: python -m pip install tox coverage
- run: python -m pip install tox git+https://github.com/alex/coveragepy@patch-1
- name: Tests
run: |
tox -r -- --color=yes --wycheproof-root=wycheproof
Expand Down Expand Up @@ -313,8 +317,9 @@ 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

- uses: ./.github/actions/upload-coverage
- uses: alex/github-actions-coverage-merge@main
with:
mode: upload
name: "Rust Coverage"

macos:
Expand Down Expand Up @@ -354,7 +359,7 @@ jobs:
override: true
default: true

- run: python -m pip install tox requests coverage
- run: python -m pip install tox requests git+https://github.com/alex/coveragepy@patch-1

- uses: actions/checkout@v2.3.4
with:
Expand All @@ -378,8 +383,9 @@ jobs:
EXTRA_CFLAGS: ${{ matrix.PYTHON.EXTRA_CFLAGS }}
CARGO_TARGET_DIR: ${{ format('{0}/src/rust/target/', github.workspace) }}

- uses: ./.github/actions/upload-coverage
- uses: alex/github-actions-coverage-merge@main
with:
mode: upload
name: "${{ matrix.PYTHON.TOXENV }} on macOS"

windows:
Expand Down Expand Up @@ -426,7 +432,7 @@ jobs:
default: true
target: ${{ matrix.WINDOWS.RUST_TRIPLE }}

- run: python -m pip install tox requests coverage
- run: python -m pip install tox requests git+https://github.com/alex/coveragepy@patch-1
- name: Download OpenSSL
run: |
python .github/workflows/download_openssl.py windows openssl-${{ matrix.WINDOWS.WINDOWS }}-${{ matrix.PYTHON.MSVC_VERSION }}
Expand All @@ -447,8 +453,9 @@ jobs:
TOXENV: ${{ matrix.PYTHON.TOXENV }}
CARGO_TARGET_DIR: ${{ format('{0}/src/rust/target/', github.workspace) }}

- uses: ./.github/actions/upload-coverage
- uses: alex/github-actions-coverage-merge@main
with:
mode: upload
name: "${{ matrix.PYTHON.TOXENV }} on ${{ matrix.WINDOWS.WINDOWS }} (part ${{ matrix.JOB_NUMBER }})"

linux-downstream:
Expand Down Expand Up @@ -512,3 +519,14 @@ jobs:
- 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 "🎉"

merge-coverage:
runs-on: ubuntu-latest
needs: [linux, linux-distros, linux-rust, linux-rust-coverage, macos, windows]
name: "Merge Coverage"
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
- uses: alex/github-actions-coverage-merge@main
with:
mode: merge