diff --git a/.coveragerc b/.coveragerc index ef820f0d4c6e..2e55f5c04844 100644 --- a/.coveragerc +++ b/.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 = diff --git a/.github/actions/upload-coverage/action.yml b/.github/actions/upload-coverage/action.yml deleted file mode 100644 index 11d97a7a614d..000000000000 --- a/.github/actions/upload-coverage/action.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Upload Coverage -description: Upload coverage to codecov - -inputs: - name: - description: "Job name" - required: true - -runs: - using: "composite" - - steps: - - 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 "${{ inputs.name }}" - shell: bash diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a95d004ef671..fc488e42558e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 }}" @@ -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" @@ -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' @@ -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: @@ -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: @@ -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 @@ -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: @@ -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: @@ -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: @@ -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 }} @@ -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: @@ -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