Skip to content

Commit e6e73ac

Browse files
dagardner-nvColinM-sys
authored andcommitted
Misc CI improvements (NVIDIA#1866)
* Use commit sha for versioning GitHub Actions instead of version tags * Remove unused environment variables and functions * Remove dependency on Rapids GHA Tools, we were only using `rapids-logger` ## 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/index.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 ## Release Notes * **Chores** * Pinned external GitHub Actions to specific commit SHAs across workflows for improved stability and reproducibility * Removed unused CI environment variables (`GH_TOKEN`, `RAPIDS_CONDA_RETRY_MAX`) * Simplified CI script logging mechanisms throughout the pipeline * Removed deprecated helper functions from CI infrastructure Authors: - David Gardner (https://github.com/dagardner-nv) Approvers: - Will Killian (https://github.com/willkill07) URL: NVIDIA#1866
1 parent ed7f0c4 commit e6e73ac

15 files changed

Lines changed: 65 additions & 136 deletions

File tree

.github/workflows/ci_pipe.yml

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,9 @@ defaults:
5353
shell: bash
5454

5555
env:
56-
GH_TOKEN: "${{ github.token }}"
5756
GIT_COMMIT: "${{ github.sha }}"
5857
BASE_SHA: "${{ inputs.base_sha }}"
5958
BUILD_NAT_COMPAT: "true"
60-
RAPIDS_CONDA_RETRY_MAX: "5"
6159
WORKSPACE: "${{ github.workspace }}/nat"
6260
WORKSPACE_TMP: "${{ github.workspace }}/tmp"
6361
UV_CACHE_DIR: .uv-cache
@@ -89,7 +87,7 @@ jobs:
8987

9088
steps:
9189
- name: Checkout
92-
uses: actions/checkout@v6
90+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
9391
with:
9492
fetch-depth: 0
9593
path: 'nat'
@@ -125,7 +123,7 @@ jobs:
125123

126124
steps:
127125
- name: Checkout
128-
uses: actions/checkout@v6
126+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
129127
with:
130128
fetch-depth: 0
131129
fetch-tags: true
@@ -137,15 +135,15 @@ jobs:
137135
run: ./nat/ci/scripts/github/tests.sh
138136

139137
- name: Upload Test Results
140-
uses: actions/upload-artifact@v6
138+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
141139
# Upload test results even if the tests fail
142140
if: ${{ always() }}
143141
with:
144142
name: "test-results-${{ matrix.arch }}-py${{ matrix.python-version }}"
145143
path: "${{ github.workspace }}/tmp/reports/*.xml"
146144
if-no-files-found: error
147145
- name: Upload coverage to Codecov
148-
uses: codecov/codecov-action@v5
146+
uses: codecov/codecov-action@75cd11691c0faa626561e295848008c8a7dddffe # v5
149147
# Upload test results even if the tests fail
150148
if: ${{ always() }}
151149
with:
@@ -169,7 +167,7 @@ jobs:
169167

170168
steps:
171169
- name: Checkout
172-
uses: actions/checkout@v6
170+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
173171
with:
174172
fetch-tags: true
175173
path: 'nat'
@@ -179,7 +177,7 @@ jobs:
179177
run: ./nat/ci/scripts/github/docs.sh
180178

181179
- name: Upload Documentation
182-
uses: actions/upload-artifact@v6
180+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
183181
with:
184182
name: "docs"
185183
path: "${{ github.workspace }}/tmp/docs.tar.bz2"
@@ -199,7 +197,7 @@ jobs:
199197

200198
steps:
201199
- name: Checkout
202-
uses: actions/checkout@v6
200+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
203201
with:
204202
fetch-depth: 0
205203
fetch-tags: true
@@ -210,7 +208,7 @@ jobs:
210208
run: ./nat/ci/scripts/github/build_wheel.sh
211209

212210
- name: Upload Package Reports
213-
uses: actions/upload-artifact@v6
211+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
214212
if: ${{ always() }}
215213
with:
216214
name: "package_listings"
@@ -219,7 +217,7 @@ jobs:
219217
compression-level: 0
220218

221219
- name: Upload Wheels
222-
uses: actions/upload-artifact@v6
220+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
223221
with:
224222
name: "wheels"
225223
path: "${{ github.workspace }}/tmp/wheels/*.whl"

.github/workflows/pr.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
- prepare
5151
- ci_pipe
5252
secrets: inherit
53-
uses: rapidsai/shared-workflows/.github/workflows/pr-builder.yaml@branch-25.04
53+
uses: rapidsai/shared-workflows/.github/workflows/pr-builder.yaml@5fe52098676ca51435a73337131685e340658c51 # branch-25.04
5454

5555
prepare:
5656
# Executes the get-pr-info action to determine if the PR has the skip-ci label, if the action fails we assume the
@@ -60,7 +60,7 @@ jobs:
6060
steps:
6161
- name: Get PR Info
6262
id: get-pr-info
63-
uses: nv-gha-runners/get-pr-info@main
63+
uses: nv-gha-runners/get-pr-info@090577647b8ddc4e06e809e264f7881650ecdccf # main
6464
if: ${{ startsWith(github.ref_name, 'pull-request/') }}
6565
outputs:
6666
is_pr: ${{ startsWith(github.ref_name, 'pull-request/') }}

ci/scripts/common.sh

Lines changed: 11 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -44,62 +44,6 @@ export PYTHON_FILE_REGEX='^(\.\/)?(?!\.|build|external).*\.(py|pyx|pxd)$'
4444
# Use these options to skip any of the checks
4545
export SKIP_COPYRIGHT=${SKIP_COPYRIGHT:-""}
4646

47-
48-
# Determine the merge base as the root to compare against. Optionally pass in a
49-
# result variable otherwise the output is printed to stdout
50-
function get_merge_base() {
51-
local __resultvar=$1
52-
local result=$(git merge-base ${BASE_SHA} ${COMMIT_SHA:-HEAD})
53-
54-
if [[ "$__resultvar" ]]; then
55-
eval $__resultvar="'${result}'"
56-
else
57-
echo "${result}"
58-
fi
59-
}
60-
61-
# Determine the changed files. First argument is the (optional) regex filter on
62-
# the results. Second argument is the (optional) variable with the returned
63-
# results. Otherwise the output is printed to stdout. Result is an array
64-
function get_modified_files() {
65-
local __resultvar=$2
66-
67-
local GIT_DIFF_ARGS=${GIT_DIFF_ARGS:-"--name-only"}
68-
local GIT_DIFF_BASE=${GIT_DIFF_BASE:-$(get_merge_base)}
69-
70-
# If invoked by a git-commit-hook, this will be populated
71-
local result=( $(git diff ${GIT_DIFF_ARGS} ${GIT_DIFF_BASE} | grep -P ${1:-'.*'}) )
72-
73-
local files=()
74-
75-
for i in "${result[@]}"; do
76-
if [[ -e "${i}" ]]; then
77-
files+=(${i})
78-
fi
79-
done
80-
81-
if [[ "$__resultvar" ]]; then
82-
eval $__resultvar="( ${files[@]} )"
83-
else
84-
echo "${files[@]}"
85-
fi
86-
}
87-
88-
# Determine a unified diff useful for clang-XXX-diff commands. First arg is
89-
# optional file regex. Second argument is the (optional) variable with the
90-
# returned results. Otherwise the output is printed to stdout
91-
function get_unified_diff() {
92-
local __resultvar=$2
93-
94-
local result=$(git diff --no-color --relative -U0 $(get_merge_base) -- $(get_modified_files $1))
95-
96-
if [[ "$__resultvar" ]]; then
97-
eval $__resultvar="'${result}'"
98-
else
99-
echo "${result}"
100-
fi
101-
}
102-
10347
function get_num_proc() {
10448
NPROC_TOOL=`which nproc`
10549
NUM_PROC=${NUM_PROC:-`${NPROC_TOOL}`}
@@ -119,7 +63,7 @@ function set_versions() {
11963
set -e
12064

12165
if [[ ${SETUPTOOLS_SCM_RESULT} -ne 0 ]]; then
122-
rapids-logger "Error, setuptools_scm failed to determine the version: ${NAT_VERSION}"
66+
echo "Error, setuptools_scm failed to determine the version: ${NAT_VERSION}"
12367
exit ${SETUPTOOLS_SCM_RESULT}
12468
fi
12569
fi
@@ -129,7 +73,7 @@ function set_versions() {
12973
}
13074

13175
function build_wheel() {
132-
rapids-logger "Building Wheel for $1"
76+
echo "Building Wheel for $1"
13377
uv build --wheel --no-progress --out-dir "${WHEELS_DIR}/$2" --directory $1
13478
}
13579

@@ -143,7 +87,7 @@ function build_package_wheel()
14387

14488
function create_env() {
14589

146-
rapids-logger "Creating uv env"
90+
echo "Creating uv env"
14791
VENV_DIR="${WORKSPACE_TMP}/.venv"
14892
uv venv --python=${PYTHON_VERSION} --seed ${VENV_DIR}
14993
source ${VENV_DIR}/bin/activate
@@ -172,31 +116,25 @@ function create_env() {
172116
exit 1
173117
fi
174118

175-
rapids-logger "Final Environment"
119+
echo "Final Environment"
176120
uv pip list
177121
}
178122

179-
function install_rapids_gha_tools()
180-
{
181-
echo "Installing Rapids GHA tools"
182-
wget https://github.com/rapidsai/gha-tools/releases/latest/download/tools.tar.gz -O - | tar -xz -C /usr/local/bin
183-
}
184-
185123
function get_lfs_files() {
186-
rapids-logger "Installing git-lfs from apt"
124+
echo "Installing git-lfs from apt"
187125
apt update
188126
apt install --no-install-recommends -y git-lfs
189127

190128
if [[ "${USE_HOST_GIT}" == "1" ]]; then
191-
rapids-logger "Using host git, skipping git-lfs install"
129+
echo "Using host git, skipping git-lfs install"
192130
else
193-
rapids-logger "Calling git lfs fetch"
131+
echo "Calling git lfs fetch"
194132
git lfs fetch
195-
rapids-logger "Calling git lfs pull"
133+
echo "Calling git lfs pull"
196134
git lfs pull
197135
fi
198136

199-
rapids-logger "git lfs ls-files"
137+
echo "git lfs ls-files"
200138
git lfs ls-files
201139
}
202140

@@ -218,11 +156,11 @@ function install_python_versions() {
218156
PYTHON_FIND_RESULT=$?
219157
set -e
220158
if [[ ${PYTHON_FIND_RESULT} -ne 0 ]]; then
221-
rapids-logger "Downloading Python version ${pyver}"
159+
echo "Downloading Python version ${pyver}"
222160

223161
# In common.sh we set this to never, we want to override that here
224162
UV_PYTHON_DOWNLOADS="manual" uv python install --managed-python ${pyver}
225-
rapids-logger "✓ Successfully installed Python ${pyver}"
163+
echo "✓ Successfully installed Python ${pyver}"
226164
fi
227165
done
228166
}

ci/scripts/github/build_wheel.sh

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ PIP_REPORTS_DIR="${WORKSPACE_TMP}/pip_reports"
2525
mkdir -p "${PIP_REPORTS_DIR}"
2626

2727
GIT_TAG=$(get_git_tag)
28-
rapids-logger "Git Version: ${GIT_TAG}"
28+
echo "Git Version: ${GIT_TAG}"
2929

3030
create_env
3131

@@ -37,12 +37,12 @@ for NAT_PACKAGE in "${NAT_PACKAGES[@]}"; do
3737
done
3838

3939
# Build all examples with a pyproject.toml in the first directory below examples
40-
for NAT_EXAMPLE in ${NAT_EXAMPLES[@]}; do
40+
for NAT_EXAMPLE in "${NAT_EXAMPLES[@]}"; do
4141
# places all wheels flat under example
4242
build_wheel ${NAT_EXAMPLE} "examples"
4343
done
4444

45-
rapids-logger "Removing built examples wheels"
45+
echo "Removing built examples wheels"
4646
rm -rf "${WHEELS_BASE_DIR}/examples"
4747

4848
# Flatten out the wheels into a single directory for upload
@@ -74,12 +74,12 @@ trap create_package_report_tarball EXIT
7474
for whl in "${MOVED_WHEELS[@]}"; do
7575

7676
for pyver in "${SUPPORTED_PYTHON_VERSIONS[@]}"; do
77-
rapids-logger "Testing wheel: ${whl} with Python ${pyver}"
77+
echo "Testing wheel: ${whl} with Python ${pyver}"
7878
UV_VENV_OUT=$(uv venv -q -p ${pyver} --seed "${TEMP_INSTALL_LOCATION}" 2>&1)
7979
UV_VENV_RESULT=$?
8080

8181
if [[ ${UV_VENV_RESULT} -ne 0 ]]; then
82-
rapids-logger "Error, failed to create uv venv with Python ${pyver} for wheel ${whl}"
82+
echo "Error, failed to create uv venv with Python ${pyver} for wheel ${whl}"
8383
echo "${UV_VENV_OUT}"
8484
exit ${UV_VENV_RESULT}
8585
fi
@@ -91,11 +91,11 @@ for whl in "${MOVED_WHEELS[@]}"; do
9191
INSTALL_RESULT=$?
9292

9393
# Report the packages in the environment regardless of install success
94-
rapids-logger "Installed wheel ${whl} with Python ${pyver}, pip install exit code ${INSTALL_RESULT}"
94+
echo "Installed wheel ${whl} with Python ${pyver}, pip install exit code ${INSTALL_RESULT}"
9595
uv pip list --format json > "${PIP_REPORTS_DIR}/$(basename "${whl}" .whl)_py${pyver}_packages.json"
9696

9797
if [[ ${INSTALL_RESULT} -ne 0 ]]; then
98-
rapids-logger "Error, failed to install wheel ${whl} with Python ${pyver}"
98+
echo "Error, failed to install wheel ${whl} with Python ${pyver}"
9999
echo "${UV_PIP_OUT}"
100100
exit ${INSTALL_RESULT}
101101
fi
@@ -106,9 +106,9 @@ for whl in "${MOVED_WHEELS[@]}"; do
106106
IMPORT_TEST_RESULT=$?
107107

108108
if [[ ${IMPORT_TEST_RESULT} -ne 0 ]]; then
109-
rapids-logger "Error, failed to import nat from wheel ${whl} with Python ${pyver}"
110-
rapids-logger "This may indicate missing dependencies, Python version incompatibility, or build issues"
111-
rapids-logger "Check if the wheel includes all necessary binary extensions for this Python version"
109+
echo "Error, failed to import nat from wheel ${whl} with Python ${pyver}"
110+
echo "This may indicate missing dependencies, Python version incompatibility, or build issues"
111+
echo "Check if the wheel includes all necessary binary extensions for this Python version"
112112
echo "${PYTHON_IMPORT_OUT}"
113113
exit ${IMPORT_TEST_RESULT}
114114
fi
@@ -118,19 +118,19 @@ for whl in "${MOVED_WHEELS[@]}"; do
118118
NAT_CMD_EXIT_CODE=$?
119119

120120
if [[ ${NAT_CMD_EXIT_CODE} -ne 0 ]]; then
121-
rapids-logger "Error 'nat --version' command failed exit code ${NAT_CMD_EXIT_CODE} from wheel ${whl} with Python ${pyver}"
121+
echo "Error 'nat --version' command failed exit code ${NAT_CMD_EXIT_CODE} from wheel ${whl} with Python ${pyver}"
122122
echo "${REPORTED_VERSION}"
123123
exit ${NAT_CMD_EXIT_CODE}
124124
fi
125125
else
126-
rapids-logger "Skipping nat CLI test; 'nat' command not installed by wheel ${whl}"
126+
echo "Skipping nat CLI test; 'nat' command not installed by wheel ${whl}"
127127
fi
128128
else
129-
rapids-logger "Skipping nat CLI test for nvidia_nat_app (framework-agnostic package); verifying nat_app import"
129+
echo "Skipping nat CLI test for nvidia_nat_app (framework-agnostic package); verifying nat_app import"
130130
PYTHON_IMPORT_OUT=$(python -c "import nat_app" 2>&1)
131131
IMPORT_TEST_RESULT=$?
132132
if [[ ${IMPORT_TEST_RESULT} -ne 0 ]]; then
133-
rapids-logger "Error, failed to import nat_app from wheel ${whl} with Python ${pyver}"
133+
echo "Error, failed to import nat_app from wheel ${whl} with Python ${pyver}"
134134
echo "${PYTHON_IMPORT_OUT}"
135135
exit ${IMPORT_TEST_RESULT}
136136
fi

ci/scripts/github/checks.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ get_lfs_files
2323

2424
create_env
2525

26-
rapids-logger "Running checks"
26+
echo "Running checks"
2727
${SCRIPT_DIR}/checks.sh

ci/scripts/github/common.sh

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,9 @@ SCRIPT_DIR=$( dirname ${GITHUB_SCRIPT_DIR} )
1818

1919
source ${SCRIPT_DIR}/common.sh
2020

21-
install_rapids_gha_tools
22-
2321
# Ensure the workspace tmp directory exists
2422
mkdir -p ${WORKSPACE_TMP}
2523

26-
rapids-logger "Environment Variables"
27-
printenv | sort
28-
2924
function get_git_tag() {
3025
# Get the latest Git tag, sorted by version, excluding lightweight tags
3126
git describe --first-parent --tags --abbrev=0 2>/dev/null || echo "no-tag"

ci/scripts/github/docs.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,18 @@ GITHUB_SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd
2020

2121
source ${GITHUB_SCRIPT_DIR}/common.sh
2222

23-
rapids-logger "Installing non-pip deps"
23+
echo "Installing non-pip deps"
2424
get_lfs_files
2525

2626
create_env
2727

28-
rapids-logger "Building documentation"
28+
echo "Building documentation"
2929
pushd ${PROJECT_ROOT}/docs
3030
make html
3131

3232
DOCS_TAR=${WORKSPACE_TMP}/docs.tar.bz2
33-
rapids-logger "Archiving documentation to ${DOCS_TAR}"
33+
echo "Archiving documentation to ${DOCS_TAR}"
3434
tar cvfj ${DOCS_TAR} build/html
3535
popd
3636

37-
rapids-logger "Documentation build completed"
37+
echo "Documentation build completed"

ci/scripts/github/tests.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ mkdir -p ${REPORTS_DIR}
2424
get_lfs_files
2525

2626
create_env
27-
rapids-logger "Git Version: $(get_git_tag)"
27+
echo "Git Version: $(get_git_tag)"
2828

29-
rapids-logger "Running tests with Python version $(python --version) and pytest version $(pytest --version) on $(arch)"
29+
echo "Running tests with Python version $(python --version) and pytest version $(pytest --version) on $(arch)"
3030
set +e
3131

3232
REPORT_IDENT_SLUG="$(arch)-py${PYTHON_VERSION}"

0 commit comments

Comments
 (0)