1#!/usr/local/bin/bash 2# Upload code coverage reports to codecov.io. 3# Multiple coverage files from multiple languages are accepted and aggregated after upload. 4# Python coverage, as well as PowerShell and Python stubs can all be uploaded. 5 6set -o pipefail -eu 7 8output_path="$1" 9 10curl --silent --show-error https://ansible-ci-files.s3.us-east-1.amazonaws.com/codecov/codecov.sh > codecov.sh 11 12for file in "${output_path}"/reports/coverage*.xml; do 13 name="${file}" 14 name="${name##*/}" # remove path 15 name="${name##coverage=}" # remove 'coverage=' prefix if present 16 name="${name%.xml}" # remove '.xml' suffix 17 18 bash codecov.sh \ 19 -f "${file}" \ 20 -n "${name}" \ 21 -X coveragepy \ 22 -X gcov \ 23 -X fix \ 24 -X search \ 25 -X xcode \ 26 || echo "Failed to upload code coverage report to codecov.io: ${file}" 27done 28