Skip to content

Commit d837f02

Browse files
committed
local pip caching, update to changed files
Signed-off-by: Peter St. John <pstjohn@nvidia.com>
1 parent e1d955a commit d837f02

2 files changed

Lines changed: 28 additions & 6 deletions

File tree

.github/workflows/unit-tests-recipes.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,21 @@ jobs:
3535
with:
3636
fetch-depth: 0
3737

38+
- name: Get merge-base commit
39+
id: merge-base
40+
run: |
41+
# Get the merge-base between current branch and main
42+
MERGE_BASE=$(git merge-base HEAD origin/main)
43+
echo "merge-base=$MERGE_BASE" >> $GITHUB_OUTPUT
44+
echo "Merge-base commit: $MERGE_BASE"
45+
3846
- name: Get changed files
3947
id: changed-files
4048
uses: step-security/changed-files@v46
4149
with:
4250
json: true
4351
matrix: true
44-
base_sha: main
52+
base_sha: ${{ steps.merge-base.outputs.merge-base }}
4553
dir_names: true
4654
dir_names_max_depth: 2
4755
files: |
@@ -84,6 +92,12 @@ jobs:
8492
echo "dirs=$DIRS" >> $GITHUB_OUTPUT
8593
- name: Show output
8694
run: |
95+
echo "=== Changed Files Analysis ==="
96+
echo "Current branch: ${{ github.ref_name }}"
97+
echo "Merge-base commit: ${{ steps.merge-base.outputs.merge-base }}"
98+
echo "Changed files compared to merge-base:"
99+
echo '${{ steps.changed-files.outputs.all_changed_files }}' | jq -r '.[]' | sed 's/^/ - /'
100+
echo "Total changed files: $(echo '${{ steps.changed-files.outputs.all_changed_files }}' | jq '. | length')"
87101
echo '${{ toJSON(steps.changed-files.outputs) }}'
88102
echo '${{ toJSON(steps.set-dirs.outputs) }}'
89103
shell: bash

ci/recipes_local_test.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
from pathlib import Path
2424
from typing import List, Optional
2525

26+
from platformdirs import user_cache_dir
27+
28+
29+
PIP_CACHE_DIR = user_cache_dir(appname="bionemo-pip-cache", appauthor="nvidia")
2630

2731
logger = logging.getLogger(__name__)
2832
logger.setLevel(logging.DEBUG)
@@ -36,12 +40,15 @@
3640
"memlock=-1",
3741
"--ulimit",
3842
"stack=67108864",
43+
"-v",
44+
f"{PIP_CACHE_DIR}:/workspace/.cache/pip",
3945
]
4046

4147
CUSTOM_CONTAINERS = {
4248
"models/amplify": "svcbionemo023/bionemo-framework:amplify-model-devcontainer-082025",
4349
}
44-
DEFAULT_CONTAINER = "nvcr.io/nvidia/pytorch:25.06-py3"
50+
# DEFAULT_CONTAINER = "nvcr.io/nvidia/pytorch:25.06-py3"
51+
DEFAULT_CONTAINER = "nvcr.io/nvidian/cvai_bnmo_trng/bionemo:pytorch25.06-py3-squashed"
4552

4653

4754
def get_git_root() -> str:
@@ -89,23 +96,22 @@ def run_tests_in_docker(work_dir: str) -> bool:
8996
set -e # Exit on any error
9097
9198
echo "Checking for dependency files..."
92-
9399
# Install dependencies based on available files
94100
if [ -f pyproject.toml ] || [ -f setup.py ]; then
95101
echo "Installing package in editable mode..."
96-
PIP_CONSTRAINT= pip install -e .
102+
PIP_CACHE_DIR=/workspace/.cache/pip PIP_CONSTRAINT= pip install -e .
97103
echo "Installed package as editable package"
98104
elif [ -f requirements.txt ]; then
99105
echo "Installing from requirements.txt..."
100-
PIP_CONSTRAINT= pip install -r requirements.txt
106+
PIP_CACHE_DIR=/workspace/.cache/pip PIP_CONSTRAINT= pip install -r requirements.txt
101107
echo "Installed from requirements.txt"
102108
else
103109
echo "No pyproject.toml, setup.py, or requirements.txt found"
104110
exit 1
105111
fi
106112
107113
echo "Running tests..."
108-
pytest -v .
114+
python -m pytest -v .
109115
""")
110116

111117
relative_path = Path(work_dir).relative_to(git_root).as_posix()
@@ -165,6 +171,8 @@ def main():
165171
if args.debug:
166172
logging.getLogger().setLevel(logging.DEBUG)
167173

174+
logger.info(f"Caching pip installations to: {PIP_CACHE_DIR}")
175+
168176
# Get directories to test
169177
test_dirs = get_test_directories(args.directories)
170178

0 commit comments

Comments
 (0)