diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index 7b1809e1c5f0..f925868d8248 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -30,12 +30,18 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python }} + - name: Setup uv + uses: astral-sh/setup-uv@v5 + with: + enable-cache: true - name: Install nox run: | - python -m pip install --upgrade setuptools pip wheel - python -m pip install nox + uv pip install --system "nox[uv]" - name: Run unit tests env: + NOX_DEFAULT_VENV_BACKEND: uv + UV_VENV_SEED: 1 + UV_COMPILE_BYTECODE: 1 COVERAGE_FILE: .coverage-${{ matrix.python }} BUILD_TYPE: presubmit TARGET_BRANCH: ${{ github.base_ref || github.event.merge_group.base_ref }} @@ -68,12 +74,18 @@ jobs: with: python-version: ${{ matrix.python }} allow-prereleases: true + - name: Setup uv + uses: astral-sh/setup-uv@v5 + with: + enable-cache: true - name: Install nox run: | - python -m pip install --upgrade setuptools pip wheel - python -m pip install nox + uv pip install --system "nox[uv]" - name: Run ${{ matrix.option }} tests env: + NOX_DEFAULT_VENV_BACKEND: uv + UV_VENV_SEED: 1 + UV_COMPILE_BYTECODE: 1 BUILD_TYPE: presubmit TARGET_BRANCH: ${{ github.base_ref || github.event.merge_group.base_ref }} TEST_TYPE: ${{ matrix.option }} @@ -100,12 +112,18 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python }} + - name: Setup uv + uses: astral-sh/setup-uv@v5 + with: + enable-cache: true - name: Install nox run: | - python -m pip install --upgrade setuptools pip wheel - python -m pip install nox + uv pip install --system "nox[uv]" - name: Run ${{ matrix.option }} tests env: + NOX_DEFAULT_VENV_BACKEND: uv + UV_VENV_SEED: 1 + UV_COMPILE_BYTECODE: 1 BUILD_TYPE: presubmit TARGET_BRANCH: ${{ github.base_ref || github.event.merge_group.base_ref }} TEST_TYPE: ${{ matrix.option }} @@ -133,11 +151,15 @@ jobs: - name: Set number of files changes in packages directory id: packages run: echo "::set-output name=num_files_changed::$(git diff HEAD~1 -- packages | wc -l)" + - name: Setup uv + if: steps.packages.outputs.num_files_changed > 0 || steps.packages.num_files_changed > 0 + uses: astral-sh/setup-uv@v5 + with: + enable-cache: true - name: Install coverage - if: steps.packages.num_files_changed > 0 + if: steps.packages.outputs.num_files_changed > 0 || steps.packages.num_files_changed > 0 run: | - python -m pip install --upgrade setuptools pip wheel - python -m pip install coverage + uv pip install --system coverage - name: Download coverage results if: ${{ steps.date.packages.num_files_changed > 0 }} uses: actions/download-artifact@v4