33
33
# - codecov-token: Token for coverage upload
34
34
# - max-test-time: Maximum test duration
35
35
# - device: Device to run tests on (cpu/gpu)
36
+ # - enable-cache: Enable pip caching
36
37
#
37
38
# Outputs:
38
39
# - coverage-percentage: Total coverage
@@ -72,6 +73,10 @@ inputs:
72
73
description : " Device to run tests on (cpu/gpu)"
73
74
required : false
74
75
default : " gpu"
76
+ enable-cache :
77
+ description : " Enable pip caching"
78
+ required : false
79
+ default : " true"
75
80
76
81
outputs :
77
82
coverage-percentage :
@@ -87,45 +92,28 @@ outputs:
87
92
runs :
88
93
using : composite
89
94
steps :
95
+ # Set up Python with pip caching
90
96
- name : Set up Python environment
91
97
uses : actions/setup-python@v5
92
98
with :
93
99
python-version : ${{ inputs.python-version }}
100
+ cache : ${{ inputs.enable-cache == 'true' }}
101
+ cache-dependency-path : pyproject.toml
94
102
95
- - name : Configure pip cache
96
- shell : bash
97
- run : |
98
- CACHE_DIR="/opt/github/cache/pip"
99
-
100
- # Ensure cache directory exists and is writable
101
- sudo mkdir -p $CACHE_DIR
102
- sudo chmod 777 $CACHE_DIR
103
-
104
- # Configure pip to use the persistent cache
105
- pip config set global.cache-dir $CACHE_DIR
106
-
107
- # Display cache info
108
- echo "Using pip cache directory: $(pip cache dir)"
109
- echo "Current cache size: $(du -sh $CACHE_DIR 2>/dev/null || echo 'Empty')"
110
-
103
+ # Create and configure virtual environment
111
104
- name : Configure virtual environment
112
105
id : setup-venv
113
106
shell : bash
114
107
run : |
115
- # Create and activate venv
108
+ # Create isolated test environment
116
109
python -m venv .venv
117
110
source .venv/bin/activate
118
-
119
- # Upgrade pip
111
+ # Install dependencies with dev extras
120
112
python -m pip install --upgrade pip
121
-
122
- # Install dependencies using the persistent cache
123
- pip install --prefer-binary ".[dev]"
113
+ pip install ".[dev]"
124
114
pip install codecov
125
115
126
- # Show installed packages for debugging
127
- pip list
128
-
116
+ # Determine which tests to run based on input
129
117
- name : Determine test scope
130
118
id : test-scope
131
119
shell : bash
@@ -155,7 +143,7 @@ runs:
155
143
if [ "${{ inputs.device }}" = "cpu" ]; then
156
144
marker="-m cpu" # Only run CPU tests
157
145
else
158
- marker="-m gpu " # Run all tests
146
+ marker="" # Run all tests (both CPU and GPU marked tests)
159
147
fi
160
148
161
149
# Run pytest
0 commit comments