[ci] Remove cache, switch to uv for CI
#2524
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: Unit tests | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - "*-release" | |
| pull_request: | |
| branches: | |
| - main | |
| - "*-release" | |
| workflow_dispatch: | |
| env: | |
| TRANSFORMERS_IS_CI: 1 | |
| HF_HUB_DISABLE_PROGRESS_BARS: 1 # The Transformers v5 weight loading progress bars heavily expand the logs | |
| jobs: | |
| test_sampling: | |
| name: Run unit tests | |
| strategy: | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12", "3.13"] | |
| os: [ubuntu-latest, windows-latest] | |
| transformers-version: ["<5.0.0", ">=5.0.0"] | |
| fail-fast: false | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Remove unnecessary files | |
| run: | | |
| df -h / | |
| # Remove software and language runtimes we're not using | |
| sudo rm -rf \ | |
| "$AGENT_TOOLSDIRECTORY" \ | |
| /opt/google/chrome \ | |
| /opt/microsoft/msedge \ | |
| /opt/microsoft/powershell \ | |
| /opt/pipx \ | |
| /usr/lib/mono \ | |
| /usr/local/julia* \ | |
| /usr/local/lib/android \ | |
| /usr/local/lib/node_modules \ | |
| /usr/local/share/chromium \ | |
| /usr/local/share/powershell \ | |
| /usr/share/dotnet \ | |
| /usr/share/swift | |
| df -h / | |
| if: runner.os == 'Linux' | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Setup Python environment | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v6 | |
| - name: Install dependencies (transformers < 5.0.0) | |
| if: ${{ matrix.transformers-version == '<5.0.0' }} | |
| run: uv pip install '.[train, onnx, openvino, dev]' 'transformers<5.0.0' --system | |
| - name: Install dependencies (transformers >= 5.0.0) | |
| if: ${{ matrix.transformers-version == '>=5.0.0' }} | |
| run: uv pip install '.[train, dev]' 'transformers>=5.0.0' --system | |
| - name: Install model2vec | |
| run: uv pip install model2vec --system | |
| if: ${{ contains(fromJSON('["3.10", "3.11", "3.12", "3.13"]'), matrix.python-version) }} | |
| - name: Run unit tests | |
| run: | | |
| python -m pytest --durations 20 -sv tests/ |