Use codecov github action instead of deprecated bash uploader (#9252)
Fixes #9202.
This commit is contained in:
		
							parent
							
								
									0191563fd6
								
							
						
					
					
						commit
						f288afde1d
					
				| 
						 | 
				
			
			@ -165,11 +165,17 @@ jobs:
 | 
			
		|||
      if: "matrix.use_coverage"
 | 
			
		||||
      run: "tox -e ${{ matrix.tox_env }}-coverage"
 | 
			
		||||
 | 
			
		||||
    - name: Upload coverage
 | 
			
		||||
      if: matrix.use_coverage && github.repository == 'pytest-dev/pytest'
 | 
			
		||||
      env:
 | 
			
		||||
        CODECOV_NAME: ${{ matrix.name }}
 | 
			
		||||
      run: bash scripts/upload-coverage.sh -F GHA,${{ runner.os }}
 | 
			
		||||
    - name: Generate coverage report
 | 
			
		||||
      if: "matrix.use_coverage"
 | 
			
		||||
      run: python -m coverage xml
 | 
			
		||||
 | 
			
		||||
    - name: Upload coverage to Codecov
 | 
			
		||||
      if: "matrix.use_coverage"
 | 
			
		||||
      uses: codecov/codecov-action@v2
 | 
			
		||||
      with:
 | 
			
		||||
        fail_ci_if_error: true
 | 
			
		||||
        files: ./coverage.xml
 | 
			
		||||
        verbose: true
 | 
			
		||||
 | 
			
		||||
  deploy:
 | 
			
		||||
    if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') && github.repository == 'pytest-dev/pytest'
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
Add github action to upload coverage report to codecov instead of bash uploader.
 | 
			
		||||
| 
						 | 
				
			
			@ -1,28 +0,0 @@
 | 
			
		|||
#!/usr/bin/env bash
 | 
			
		||||
 | 
			
		||||
set -euo pipefail
 | 
			
		||||
set -x
 | 
			
		||||
 | 
			
		||||
# Install coverage.
 | 
			
		||||
if [[ -z ${TOXENV+x} || -z $TOXENV ]]; then
 | 
			
		||||
  python -m pip install coverage
 | 
			
		||||
else
 | 
			
		||||
  # Add last TOXENV to $PATH.
 | 
			
		||||
  PATH="$PWD/.tox/${TOXENV##*,}/bin:$PATH"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# Run coverage.
 | 
			
		||||
python -m coverage xml
 | 
			
		||||
 | 
			
		||||
# Download and verify latest Codecov bash uploader.
 | 
			
		||||
# Set --connect-timeout to work around https://github.com/curl/curl/issues/4461
 | 
			
		||||
curl --silent --show-error --location --connect-timeout 5 --retry 6 -o codecov https://codecov.io/bash
 | 
			
		||||
VERSION=$(grep --only-matching 'VERSION=\"[0-9\.]*\"' codecov | cut -d'"' -f2)
 | 
			
		||||
if command -v sha256sum; then
 | 
			
		||||
    sha256sum --check --strict --ignore-missing --quiet <(curl --silent "https://raw.githubusercontent.com/codecov/codecov-bash/${VERSION}/SHA256SUM")
 | 
			
		||||
else
 | 
			
		||||
    shasum --algorithm 256 --check --strict --ignore-missing --quiet <(curl --silent "https://raw.githubusercontent.com/codecov/codecov-bash/${VERSION}/SHA256SUM")
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# Upload coverage.
 | 
			
		||||
bash codecov -Z -X fix -f coverage.xml "$@"
 | 
			
		||||
		Loading…
	
		Reference in New Issue