Skip to content

Commit 28b2ec6

Browse files
[CI] always start with a new clean env (#2750)
* Update unit_tests.yml * print env name
1 parent b8762ff commit 28b2ec6

1 file changed

Lines changed: 30 additions & 4 deletions

File tree

.github/workflows/unit_tests.yml

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,8 @@ jobs:
183183
- /monster/ci/models:/monster/data/model
184184
- /monster/ci/dataset:/monster/data/model/dataset
185185
- /monster/ci/huggingface:/github/home/.cache/huggingface
186-
# - /monster/ci/uv:/opt/uv
187186
- /github/workspace/uv:/opt/uv
187+
- /github/workspace/tmp:/opt/uv/tmp
188188
- /monster/ci/uv/python:/opt/uv/python
189189
- /monster/ci/uv/cache/python:/opt/uv/cache/python
190190
- /monster/ci/uv/setup_uv_venv.sh:/opt/uv/setup_uv_venv.sh
@@ -279,7 +279,11 @@ jobs:
279279
echo "-- loaded --"
280280
281281
echo "-- setting up env --"
282-
env_name="gptqmodel_test_cu${{ needs.check-vm.outputs.cuda_version }}_torch${{ env.TORCH_VERSION }}_py${py}_${{ matrix.test_script }}"
282+
safe_ref=$(printf '%s' "${{ env.ref }}" | sed -e 's/[\\/]/_/g' -e 's/^refs_heads_//')
283+
env_name="gptqmodel_${safe_ref}_test_${{ matrix.test_script }}"
284+
echo "env_name: $env_name"
285+
# will clean later
286+
mv /opt/uv/venvs/$env_name "/opt/uv/tmp/${env_name}_$(date +%s)" || true
283287
/opt/uv/setup_uv_venv.sh $env_name
284288
echo "-- set --"
285289
@@ -467,8 +471,8 @@ jobs:
467471
- /monster/ci/models:/monster/data/model
468472
- /monster/ci/dataset:/monster/data/model/dataset
469473
- /monster/ci/huggingface:/github/home/.cache/huggingface
470-
# - /monster/ci/uv:/opt/uv
471474
- /github/workspace/uv:/opt/uv
475+
- /github/workspace/tmp:/opt/uv/tmp
472476
- /monster/ci/uv/python:/opt/uv/python
473477
- /monster/ci/uv/cache/python:/opt/uv/cache/python
474478
- /monster/ci/uv/setup_uv_venv.sh:/opt/uv/setup_uv_venv.sh
@@ -546,8 +550,30 @@ jobs:
546550
547551
- name: Activate uv env
548552
run: |
549-
env_name="gptqmodel_test_cu${{ needs.check-vm.outputs.cuda_version }}_torch${{ env.TORCH_VERSION }}_py${{ env.PYTHON_VERSION }}_${{ matrix.test_script }}"
553+
echo "-- loading unit test's config --"
554+
source /opt/uv/setup_uv_venv.sh unit_test_env
555+
556+
config_json="$(python3 .github/scripts/parse_test_config.py \
557+
--group tests \
558+
--test-name "${{ matrix.test_script }}")"
559+
560+
py="$(printf '%s' "$config_json" | python3 -c 'import json, sys; print(json.load(sys.stdin)["py"])')"
561+
gpu="$(printf '%s' "$config_json" | python3 -c 'import json, sys; print(json.load(sys.stdin)["gpu"])')"
562+
563+
echo "PYTHON_VERSION=$py" >> "$GITHUB_ENV"
564+
echo "GPU_COUNT=$gpu" >> "$GITHUB_ENV"
565+
566+
echo "using py=$py gpu=$gpu for test ${{ matrix.test_script }}"
567+
echo "-- loaded --"
568+
569+
echo "-- setting up env --"
570+
safe_ref=$(printf '%s' "${{ env.ref }}" | sed -e 's/[\\/]/_/g' -e 's/^refs_heads_//')
571+
env_name="gptqmodel_${safe_ref}_test_${{ matrix.test_script }}"
572+
echo "env_name: $env_name"
573+
# will clean later
574+
mv /opt/uv/venvs/$env_name "/opt/uv/tmp/${env_name}_$(date +%s)" || true
550575
/opt/uv/setup_uv_venv.sh $env_name
576+
echo "-- set --"
551577
552578
- name: Setup uv env
553579
run: |

0 commit comments

Comments
 (0)