Improve CI time using uv for dependency setup
#7936
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test Checks (Base/PyTorch) | |
| on: | |
| pull_request: | |
| branches: [ main, 'release/*' ] | |
| push: | |
| branches: [ main, 'release/*' ] | |
| workflow_dispatch: | |
| inputs: | |
| code_coverage: | |
| description: if enabled, code coverage metrics will be collected during the test run | |
| type: boolean | |
| default: false | |
| env: | |
| CADENCE: "commit" | |
| UV_SYSTEM_PYTHON: 1 | |
| UV_TORCH_BACKEND: "auto" | |
| jobs: | |
| base-tests: | |
| runs-on: ubuntu-22.04 | |
| env: | |
| COVERAGE_FILE: ".coverage.base" | |
| steps: | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v6 | |
| - name: "⚙️ Install dependencies" | |
| run: uv pip install .[dev] | |
| - uses: actions/checkout@v4 | |
| with: | |
| repository: "neuralmagic/compressed-tensors" | |
| path: "compressed-tensors" | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: "⚙️ Install compressed-tensors dependencies" | |
| run: | | |
| uv pip uninstall compressed-tensors | |
| export GIT_CEILING_DIRECTORIES="$(pwd)" | |
| cd compressed-tensors | |
| BUILD_TYPE=nightly uv pip install . | |
| - name: "Clean compressed-tensors directory" | |
| run: rm -r compressed-tensors/ | |
| - name: "⚙️ Prepare code coverage" | |
| if: inputs.code_coverage | |
| uses: ./.github/actions/prepare-code-coverage | |
| - name: "🔬 Running base tests" | |
| run: make test | |
| - name: "Upload coverage report" | |
| if: (success() || failure()) && inputs.code_coverage | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: base-tests-coverage-results | |
| path: | | |
| .coverage* | |
| coverage-html | |
| coverage.json | |
| include-hidden-files: true | |
| retention-days: 5 | |
| - name: "Report coverage" | |
| if: (success() || failure()) && inputs.code_coverage | |
| run: | | |
| coverage report --data-file="$COVERAGE_FILE" --skip-empty --format="markdown" > "$GITHUB_STEP_SUMMARY" | |
| pytorch-tests: | |
| runs-on: ubuntu-22.04 | |
| env: | |
| COVERAGE_FILE: ".coverage.pytorch" | |
| steps: | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v6 | |
| - name: "⚙️ Install dependencies" | |
| run: uv pip install .[dev] | |
| - uses: actions/checkout@v4 | |
| with: | |
| repository: "neuralmagic/compressed-tensors" | |
| path: "compressed-tensors" | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: "⚙️ Install compressed-tensors dependencies" | |
| run: | | |
| uv pip uninstall compressed-tensors | |
| export GIT_CEILING_DIRECTORIES="$(pwd)" | |
| cd compressed-tensors | |
| BUILD_TYPE=nightly uv pip install . | |
| - name: "Clean compressed-tensors directory" | |
| run: rm -r compressed-tensors/ | |
| - name: "⚙️ Prepare code coverage" | |
| if: inputs.code_coverage | |
| uses: ./.github/actions/prepare-code-coverage | |
| - name: "🔬 Running pytorch tests" | |
| run: | | |
| pytest -v tests/llmcompressor/pytorch | |
| - name: "Upload coverage report" | |
| if: (success() || failure()) && inputs.code_coverage | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: pytorch-tests-coverage-results | |
| path: | | |
| .coverage* | |
| coverage-html | |
| coverage.json | |
| include-hidden-files: true | |
| retention-days: 5 | |
| - name: "Report coverage" | |
| if: (success() || failure()) && inputs.code_coverage | |
| run: | | |
| coverage report --data-file="$COVERAGE_FILE" --skip-empty --format="markdown" > "$GITHUB_STEP_SUMMARY" | |
| combine-coverage: | |
| runs-on: ubuntu-22.04 | |
| needs: [base-tests, pytorch-tests] | |
| if: (success() || failure()) && inputs.code_coverage | |
| steps: | |
| - name: "Checkout llm-compressor" | |
| uses: actions/checkout@v4 | |
| - name: "Download coverage artifacts" | |
| uses: actions/download-artifact@v4 | |
| with: | |
| merge-multiple: true | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v6 | |
| - name: "Install dependencies" | |
| run: | | |
| uv pip install -U setuptools | |
| uv pip install coverage setuptools-scm | |
| make build # need to build to generate the version.py file | |
| - name: "Combine and report coverage" | |
| run: | | |
| cat << EOF > .coveragerc | |
| [paths] | |
| source = | |
| src/ | |
| */site-packages/ | |
| EOF | |
| coverage combine | |
| coverage report --skip-empty --format="markdown" >> "$GITHUB_STEP_SUMMARY" | |
| coverage html --directory coverage-html | |
| coverage json -o coverage.json | |
| - name: "Upload coverage report" | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: combined-coverage-results | |
| path: | | |
| .coverage | |
| coverage-html | |
| coverage.json | |
| include-hidden-files: true | |
| retention-days: 5 |