Skip to content

Commit

Permalink
add optional codecov flag
Browse files Browse the repository at this point in the history
  • Loading branch information
pstjohn committed Dec 5, 2024
1 parent 8625f27 commit 6e3cf49
Showing 1 changed file with 36 additions and 13 deletions.
49 changes: 36 additions & 13 deletions ci/scripts/run_pytest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,25 @@
# See the License for the specific language governing permissions and
# limitations under the License.


# Parse arguments
CODECOV_DISABLED=0
while [[ "$#" -gt 0 ]]; do
case $1 in
--no-codecov) CODECOV_DISABLED=1 ;;
--help)
echo "Usage: $0 [--no-codecov] [--help]"
echo " --no-codecov Disables installing and uploading coverage results to codecov"
echo " --help Display this help message"
exit 0
;;
esac
shift
done

set -xueo pipefail


export PYTHONDONTWRITEBYTECODE=1
# NOTE: if a non-nvidia user wants to run the test suite, just run `export BIONEMO_DATA_SOURCE=ngc` prior to this call.
export BIONEMO_DATA_SOURCE="${BIONEMO_DATA_SOURCE:-pbss}"
Expand All @@ -26,17 +44,19 @@ if ! set_bionemo_home; then
fi

# download Codecov CLI
curl -Os https://cli.codecov.io/latest/linux/codecov
if [[ $CODECOV_DISABLED -eq 0 ]]; then
curl -Os https://cli.codecov.io/latest/linux/codecov

# integrity check
curl https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --no-default-keyring --keyring trustedkeys.gpg --import # One-time step
curl -Os https://cli.codecov.io/latest/linux/codecov
curl -Os https://cli.codecov.io/latest/linux/codecov.SHA256SUM
curl -Os https://cli.codecov.io/latest/linux/codecov.SHA256SUM.sig
gpgv codecov.SHA256SUM.sig codecov.SHA256SUM
# integrity check
curl https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --no-default-keyring --keyring trustedkeys.gpg --import # One-time step
curl -Os https://cli.codecov.io/latest/linux/codecov
curl -Os https://cli.codecov.io/latest/linux/codecov.SHA256SUM
curl -Os https://cli.codecov.io/latest/linux/codecov.SHA256SUM.sig
gpgv codecov.SHA256SUM.sig codecov.SHA256SUM

shasum -a 256 -c codecov.SHA256SUM
sudo chmod +x codecov
shasum -a 256 -c codecov.SHA256SUM
sudo chmod +x codecov
fi

# If pytests fail, we still want to ensure that the report is uploaded to codecov, so we set +e from here through the
# upload.
Expand All @@ -49,9 +69,12 @@ done
# Merge all sub-directory test results into a single xml file.
junitparser merge *.junit.xml combined.junit.xml

# Upload test analytics to codecov.
./codecov do-upload --report-type test_results --file combined.junit.xml
if [[ $CODECOV_DISABLED -eq 0 ]]; then
# Upload test analytics to codecov.
./codecov do-upload --report-type test_results --file combined.junit.xml

# Upload coverage results to codecov.
./codecov upload-process
fi

# Upload coverage results to codecov.
./codecov upload-process
set -e

0 comments on commit 6e3cf49

Please sign in to comment.