Skip to content

Commit a7dffe8

Browse files
Enhance Python CI workflow with caching and fixes
Added caching for pip and fixed disk space error during PyTorch installation.
1 parent 76cb73a commit a7dffe8

1 file changed

Lines changed: 14 additions & 7 deletions

File tree

.github/workflows/python_tests.yaml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,35 @@ on:
1212

1313
jobs:
1414
build:
15-
runs-on: ubuntu-latest # Or 'macos-latest', 'windows-latest' if your tests require a specific OS
15+
runs-on: ubuntu-latest
1616

1717
steps:
1818
- name: Checkout repository
19-
# Checks out your repository under $GITHUB_WORKSPACE, so your workflow can access it.
2019
uses: actions/checkout@v4
2120

2221
- name: Set up Python
23-
# Sets up a Python environment. You can specify a version (e.g., '3.9', '3.10', '3.11').
2422
uses: actions/setup-python@v5
2523
with:
26-
python-version: '3.11' # Ensure this matches your development environment or a compatible version
24+
python-version: '3.11'
25+
cache: 'pip' # Enable caching to speed up future runs
2726

2827
- name: Install dependencies
29-
# Install project dependencies from requirements.txt
3028
run: |
3129
python -m pip install --upgrade pip
30+
31+
# --- FIX FOR DISK SPACE ERROR ---
32+
# Install CPU-only versions of PyTorch first (saves ~3GB)
33+
# We must install torch, torchvision, and torchaudio from the CPU index
34+
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
35+
# -------------------------------
36+
37+
# Now install the rest of the requirements
38+
# (Pip will see torch is already installed and skip the huge download)
3239
pip install -r requirements.txt
33-
# Install tqdm explicitly if it's used but not in requirements.txt (as discussed)
40+
41+
# Install explicit dependencies if needed
3442
pip install tqdm
3543
3644
- name: Run Unit Tests
37-
# Discover and run all tests in the 'tests' directory.
3845
run: |
3946
python -m unittest discover tests

0 commit comments

Comments
 (0)