Skip to content

Commit 738324b

Browse files
authored
Upload test results to codecov (#699)
* Create an explicit directory for test reports rather than the workspace-tmp dir which might contain other files * Use the codecov action to perform the uploading. ## By Submitting this PR I confirm: - I am familiar with the [Contributing Guidelines](https://github.com/NVIDIA/NeMo-Agent-Toolkit/blob/develop/docs/source/resources/contributing.md). - We require that all contributors "sign-off" on their commits. This certifies that the contribution is your original work, or you have rights to submit it under the same license, or a compatible license. - Any contribution which contains commits that are not Signed-Off will not be accepted. - When the PR is ready for review, new or existing tests cover these changes. - When the PR is ready for review, the documentation is up to date with these changes. ## Summary by CodeRabbit - Tests - Test reports are now saved in a dedicated reports directory with filenames that include runtime details (architecture and Python version) for easier traceability. - Chores - Continuous integration now uploads coverage to Codecov with stricter failure handling and consistent behavior even if tests fail. - CI propagates environment metadata (architecture and Python version) across steps and standardizes report paths. - Required secrets are passed securely to the workflow. Authors: - David Gardner (https://github.com/dagardner-nv) Approvers: - Will Killian (https://github.com/willkill07) URL: #699
1 parent 5aca747 commit 738324b

File tree

3 files changed

+27
-4
lines changed

3 files changed

+27
-4
lines changed

.github/workflows/ci_pipe.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ on:
3939
description: 'The base SHA of the PR'
4040
required: true
4141
type: string
42+
secrets:
43+
CODECOV_TOKEN:
44+
required: true
4245

4346
# We only support ubuntu, so bash is the default
4447
defaults:
@@ -109,6 +112,10 @@ jobs:
109112
- python-version: "3.12"
110113
container: ${{ inputs.py_12_container }}
111114

115+
env:
116+
CI_PYTHON_VERSION: ${{ matrix.python-version }}
117+
CI_ARCH: ${{ matrix.arch }}
118+
112119
steps:
113120
- name: Checkout
114121
uses: actions/checkout@v4
@@ -127,9 +134,20 @@ jobs:
127134
if: ${{ always() }}
128135
with:
129136
name: "test-results-${{ matrix.arch }}-py${{ matrix.python-version }}"
130-
path: "${{ github.workspace }}/tmp/*.xml"
137+
path: "${{ github.workspace }}/tmp/reports/*.xml"
131138
if-no-files-found: error
132-
139+
- name: Upload coverage to Codecov
140+
uses: codecov/codecov-action@v5
141+
# Upload test results even if the tests fail
142+
if: ${{ always() }}
143+
with:
144+
directory: "${{ github.workspace }}/tmp/reports"
145+
env_vars: CI_ARCH,CI_PYTHON_VERSION
146+
fail_ci_if_error: true
147+
flags: unittests
148+
name: nat-code-cov-${{ matrix.arch }}-py${{ matrix.python-version }}
149+
token: ${{ secrets.CODECOV_TOKEN }}
150+
verbose: true
133151

134152
documentation:
135153
name: Documentation

.github/workflows/pr.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,5 @@ jobs:
8585
# Info about the PR. Empty for non PR branches. Useful for extracting PR number, title, etc.
8686
pr_info: ${{ needs.prepare.outputs.pr_info }}
8787
base_sha: ${{ needs.prepare.outputs.base_sha }}
88+
secrets:
89+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

ci/scripts/github/tests.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ set -e
1919
GITHUB_SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
2020

2121
source ${GITHUB_SCRIPT_DIR}/common.sh
22+
export REPORTS_DIR=${WORKSPACE_TMP}/reports
23+
mkdir -p ${REPORTS_DIR}
2224
get_lfs_files
2325

2426
create_env group:dev extra:all
@@ -27,9 +29,10 @@ rapids-logger "Git Version: $(git describe)"
2729
rapids-logger "Running tests with Python version $(python --version) and pytest version $(pytest --version) on $(arch)"
2830
set +e
2931

30-
pytest --junit-xml=${WORKSPACE_TMP}/report_pytest.xml \
32+
REPORT_IDENT_SLUG="$(arch)-py${PYTHON_VERSION}"
33+
pytest --junit-xml=${REPORTS_DIR}/report-${REPORT_IDENT_SLUG}_pytest.xml \
3134
--cov=nat --cov-report term-missing \
32-
--cov-report=xml:${WORKSPACE_TMP}/report_pytest_coverage.xml
35+
--cov-report=xml:${REPORTS_DIR}/report-${REPORT_IDENT_SLUG}_pytest_coverage.xml
3336
PYTEST_RESULTS=$?
3437

3538
exit ${PYTEST_RESULTS}

0 commit comments

Comments
 (0)