| name: PR Test |
|
|
| on: |
| pull_request: |
| branches: [ main ] |
| workflow_dispatch: |
|
|
| concurrency: |
| group: pr-test-${{ github.ref }} |
| cancel-in-progress: true |
|
|
| permissions: |
| contents: read |
|
|
| jobs: |
| unit-test: |
| if: (github.repository == 'sgl-project/SpecForge' || github.event_name == 'pull_request') && |
| github.event.pull_request.draft == false |
| runs-on: [self-hosted] |
| container: |
| image: lmsysorg/sglang:v0.5.14-cu130 |
| options: --gpus all --shm-size=2g --rm -v /dev/shm --privileged --pid=host |
| steps: |
| - name: Checkout code |
| uses: actions/checkout@v4 |
|
|
| - name: Restore cache |
| run: | |
| if [ -d /github/home/cache ] && [ ! -z "$(ls -A /github/home/cache/)" ]; then |
| cp -p -r /github/home/cache ./ |
| fi |
| |
| if [ -d /github/home/sf ] && [ ! -z "$(ls -A /github/home/sf/)" ]; then |
| cp -p -r /github/home/sf ./ |
| fi |
|
|
| - name: Remove flashinfer |
| run: | |
| rm -rf /github/home/.cache/flashinfer |
| |
| - name: Install dependencies |
| shell: bash |
| run: | |
| # if sf venv does not exist, create it |
| if [ ! -d sf ]; then |
| uv venv sf -p 3.11 |
| fi |
| source sf/bin/activate |
| uv pip install wheel setuptools psutil packaging ninja |
| uv pip install torch==2.11.0 --index-url https://download.pytorch.org/whl/cu130 |
| MAX_JOBS=8 uv pip install -v flash-attn --no-build-isolation |
| uv pip install -v . --prerelease=allow |
| |
| - name: Run test |
| timeout-minutes: 45 |
| shell: bash |
| run: | |
| source sf/bin/activate |
| export PYTHONPATH=$PWD |
| python -m unittest discover -s ./tests -p "test_*.py" -v |
| |
| - name: Save cache |
| run: | |
| cp -p -r sf /github/home/ |
| cp -p -r cache /github/home/ |
| |