55 branches : [ "main" ]
66 paths :
77 - " **/*.py"
8- - " requirements.txt"
8+ - " requirements* .txt"
99 - " .github/workflows/*.yml"
1010 pull_request :
1111 branches : [ "main" ]
1212 paths :
1313 - " **/*.py"
14- - " requirements.txt"
14+ - " requirements* .txt"
1515 - " .github/workflows/*.yml"
16+
1617jobs :
1718 test :
1819 name : Run tests on ${{ matrix.os }} with Python ${{ matrix.python }}
@@ -21,51 +22,56 @@ jobs:
2122 fail-fast : false
2223 matrix :
2324 os : ["ubuntu-latest", "macos-latest", "windows-latest"]
24- torch : [{base: '2.5.1', vision: '0.20.1'}]
2525 python : ["3.10", "3.11", "3.12"]
2626
2727 runs-on : ${{ matrix.os }}
28+
2829 steps :
29- - uses : actions/checkout@v4
30- - name : Set up Python ${{ matrix.python }}
31- uses : actions/setup-python@v3
32- with :
33- python-version : ${{ matrix.python }}
34- - name : Install testing dependencies
35- run : |
36- python -m pip install --upgrade pip
37- pip install wheel
38- pip install -r requirements.txt
39- pip install -e .[vllm]
30+ - uses : actions/checkout@v4
4031
41- - name : Run tests on Windows
42- if : startsWith(matrix.os, 'windows')
43- env :
44- PYTHONDONTWRITEBYTECODE : 1
45- # torchrun --nproc_per_node=2 -m pytest ./tests/dist
46- run : |
47- pytest -m cpu test
32+ - name : Set up Python ${{ matrix.python }}
33+ uses : actions/setup-python@v5
34+ with :
35+ python-version : ${{ matrix.python }}
4836
49- - name : Run '${{ matrix.testmarker }}' tests on Linux / Mac
50- if : ${{ !startsWith(matrix.os, 'windows') }}
51- env :
52- # LD_PRELOAD: /usr/lib/x86_64-linux-gnu/libtcmalloc.so.4
53- PYTHONDONTWRITEBYTECODE : 1
54- run : |
55- pytest -m cpu test
37+ # 仅 Linux:释放 GitHub runner 的大块预装组件,立刻回收十几 GB
38+ - name : Free up disk space on Linux
39+ if : runner.os == 'Linux'
40+ run : |
41+ df -h
42+ sudo rm -rf /usr/local/lib/android || true
43+ sudo rm -rf /usr/share/dotnet || true
44+ sudo rm -rf /opt/ghc || true
45+ sudo rm -rf /opt/hostedtoolcache/CodeQL || true
46+ docker system prune -af || true
47+ sudo apt-get clean
48+ sudo rm -rf /var/lib/apt/lists/*
49+ df -h
5650
57- # big-model-test:
58- # if: github.repository == 'OpenDCAI/DataFlow-Preview'
59- # runs-on: [self-hosted] # 跑在你的私有 GPU runner 上
60- # steps :
61- # - uses: actions/checkout@v4
51+ # 安装 uv(正确的官方 action)
52+ - name : Install uv
53+ uses : astral-sh/setup-uv@v7
54+ with :
55+ enable-cache : true # 远端缓存 uv 自身(对磁盘占用很小)
6256
63- # - name: Install GPU dependencies
64- # run: pip install -e .
57+ # 用系统 Python 安装依赖,禁用缓存,避免写入大体积 wheel 缓存
58+ - name : Install dependencies
59+ env :
60+ UV_SYSTEM_PYTHON : " 1"
61+ run : |
62+ uv pip install --no-cache -r requirements.txt
63+ uv pip install -e .
6564
66- # - name: upgrade omegaconf
67- # run: pip install --upgrade omegaconf
65+ - name : Run tests on Windows
66+ if : startsWith(matrix.os, 'windows')
67+ env :
68+ PYTHONDONTWRITEBYTECODE : 1
69+ run : |
70+ pytest -m cpu test
6871
69- # - name: Run GPU tests
70- # run: |
71- # pytest -m gpu test
72+ - name : Run tests on Linux / macOS
73+ if : ${{ !startsWith(matrix.os, 'windows') }}
74+ env :
75+ PYTHONDONTWRITEBYTECODE : 1
76+ run : |
77+ pytest -m cpu test
0 commit comments