Migrate from pdm to uv #1128
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: Continuous Integration | |
| on: | |
| push: | |
| branches: [master] | |
| pull_request: | |
| branches: [master] | |
| env: | |
| PYTHON_DEFAULT_VERSION: "3.12" | |
| UV_VERSION: "0.8.24" | |
| jobs: | |
| lint: | |
| timeout-minutes: 30 | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: codespell-project/actions-codespell@2391250ab05295bddd51e36a8c6295edb6343b0e | |
| with: | |
| ignore_words_list: datas re-use | |
| - name: Set up Python ${{ env.PYTHON_DEFAULT_VERSION }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ env.PYTHON_DEFAULT_VERSION }} | |
| - uses: astral-sh/setup-uv@v7 | |
| with: | |
| version: ${{ env.UV_VERSION }} | |
| enable-cache: true | |
| - name: Install dependencies | |
| run: | | |
| uv sync --locked --group nox | |
| - name: Run linters | |
| run: uv run nox -vs lint | |
| - name: Validate new changelog entries | |
| if: (contains(github.event.pull_request.labels.*.name, '-changelog') == false) && (github.event.pull_request.base.ref != '') | |
| run: if [ -z "$(git diff --diff-filter=A --name-only origin/${{ github.event.pull_request.base.ref }} changelog.d)" ]; | |
| then echo no changelog item added; exit 1; fi | |
| - name: Changelog validation | |
| run: uv run nox -vs towncrier_check | |
| build: | |
| timeout-minutes: 30 | |
| needs: lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python ${{ env.PYTHON_DEFAULT_VERSION }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ env.PYTHON_DEFAULT_VERSION }} | |
| - uses: astral-sh/setup-uv@v7 | |
| with: | |
| version: ${{ env.UV_VERSION }} | |
| enable-cache: true | |
| - name: Install dependencies | |
| run: | | |
| uv sync --locked --group nox | |
| - name: Build the distribution | |
| run: uv run nox -vs build | |
| cleanup_buckets: | |
| timeout-minutes: 30 | |
| needs: lint | |
| env: | |
| B2_TEST_APPLICATION_KEY: ${{ secrets.B2_TEST_APPLICATION_KEY }} | |
| B2_TEST_APPLICATION_KEY_ID: ${{ secrets.B2_TEST_APPLICATION_KEY_ID }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' }} # TODO: skip this whole job instead | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python ${{ env.PYTHON_DEFAULT_VERSION }} | |
| if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' }} # TODO: skip this whole job instead | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ env.PYTHON_DEFAULT_VERSION }} | |
| cache: "pip" | |
| - uses: astral-sh/setup-uv@v7 | |
| if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' }} # TODO: skip this whole job instead | |
| with: | |
| version: ${{ env.UV_VERSION }} | |
| enable-cache: true | |
| - name: Install dependencies | |
| if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' }} # TODO: skip this whole job instead | |
| run: | | |
| uv sync --locked --group nox | |
| - name: Find and remove old buckets | |
| if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' }} # TODO: skip this whole job instead | |
| run: uv run nox -vs cleanup_buckets | |
| test: | |
| timeout-minutes: 90 | |
| needs: cleanup_buckets | |
| env: | |
| B2_TEST_APPLICATION_KEY: ${{ secrets.B2_TEST_APPLICATION_KEY }} | |
| B2_TEST_APPLICATION_KEY_ID: ${{ secrets.B2_TEST_APPLICATION_KEY_ID }} | |
| WORKFLOW_ID: ${{ github.run_id }}-${{ github.run_attempt }}-${{ github.job }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: ["ubuntu-latest", "ubuntu-24.04-arm", "macos-latest", "windows-latest"] | |
| python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14", "pypy3.9", "pypy3.10"] | |
| exclude: | |
| - os: "macos-latest" | |
| python-version: "pypy3.10" | |
| - os: "windows-latest" | |
| python-version: "pypy3.10" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - uses: astral-sh/setup-uv@v7 | |
| with: | |
| version: ${{ env.UV_VERSION }} | |
| enable-cache: true | |
| - name: Install test binary dependencies | |
| if: startsWith(matrix.os, 'ubuntu') | |
| run: | | |
| sudo apt-get -y update | |
| sudo apt-get -y install zsh fish | |
| sudo chmod -R 755 /usr/share/zsh/vendor-completions /usr/share/zsh # Fix permissions for zsh completions | |
| - name: Install test binary dependencies (macOS) | |
| if: startsWith(matrix.os, 'macos') | |
| run: | | |
| brew install fish | |
| - name: Install dependencies | |
| run: | | |
| uv sync --locked --group nox | |
| - name: Run unit tests | |
| run: uv run nox -vs unit -p ${{ matrix.python-version }} | |
| - name: Run integration tests (without secrets) | |
| run: uv run nox -vs integration -p ${{ matrix.python-version }} -- -m "not require_secrets" | |
| - name: Run integration tests (with secrets) | |
| # Limit CI workload by running integration tests with secrets only on edge Python versions. | |
| if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' && contains(fromJSON('["3.9", "pypy3.10", "3.14"]'), matrix.python-version) }} | |
| run: uv run nox -vs integration -p ${{ matrix.python-version }} -- -m "require_secrets" --cleanup | |
| test-docker: | |
| timeout-minutes: 90 | |
| needs: cleanup_buckets | |
| env: | |
| B2_TEST_APPLICATION_KEY: ${{ secrets.B2_TEST_APPLICATION_KEY }} | |
| B2_TEST_APPLICATION_KEY_ID: ${{ secrets.B2_TEST_APPLICATION_KEY_ID }} | |
| WORKFLOW_ID: ${{ github.run_id }}-${{ github.run_attempt }}-${{ github.job }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python ${{ env.PYTHON_DEFAULT_VERSION }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ env.PYTHON_DEFAULT_VERSION }} | |
| - uses: astral-sh/setup-uv@v7 | |
| with: | |
| version: ${{ env.UV_VERSION }} | |
| enable-cache: true | |
| - name: Install dependencies | |
| run: | | |
| uv sync --locked --group nox | |
| - name: Generate Dockerfile | |
| run: uv run nox -vs generate_dockerfile | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build Docker | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| load: true | |
| tags: backblazeit/b2:test | |
| platforms: linux/amd64 | |
| - name: Run tests with docker | |
| if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' }} | |
| run: uv run nox -vs docker_test -- backblazeit/b2:test | |
| test-linux-bundle: | |
| timeout-minutes: 90 | |
| needs: cleanup_buckets | |
| env: | |
| B2_TEST_APPLICATION_KEY: ${{ secrets.B2_TEST_APPLICATION_KEY }} | |
| B2_TEST_APPLICATION_KEY_ID: ${{ secrets.B2_TEST_APPLICATION_KEY_ID }} | |
| WORKFLOW_ID: ${{ github.run_id }}-${{ github.run_attempt }}-${{ github.job }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: ["ubuntu-22.04", "ubuntu-22.04-arm"] # keep the versions aligned with cd.yml | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python ${{ env.PYTHON_DEFAULT_VERSION }} | |
| uses: deadsnakes/action@v3.2.0 # staticx doesn't work with python installed by setup-python action | |
| with: | |
| python-version: ${{ env.PYTHON_DEFAULT_VERSION }} | |
| - uses: astral-sh/setup-uv@v7 | |
| with: | |
| version: ${{ env.UV_VERSION }} | |
| enable-cache: true | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get -y update | |
| sudo apt-get -y install patchelf scons | |
| uv sync --locked --group nox | |
| git config --global --add safe.directory '*' | |
| - name: Bundle the distribution | |
| id: bundle | |
| shell: bash | |
| run: uv run nox -vs bundle | |
| - name: Generate hashes | |
| id: hashes | |
| run: uv run nox -vs make_dist_digest | |
| - name: Run integration tests (without secrets) | |
| run: uv run nox -vs integration -p ${{ env.PYTHON_DEFAULT_VERSION }} -- --sut=${{ steps.bundle.outputs.sut_path }} -m "not require_secrets" | |
| - name: Run integration tests (with secrets) | |
| if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' }} | |
| run: uv run nox -vs integration -p ${{ env.PYTHON_DEFAULT_VERSION }} -- --sut=${{ steps.bundle.outputs.sut_path }} -m "require_secrets" --cleanup | |
| - name: Upload assets | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| path: ${{ steps.bundle.outputs.asset_path }} | |
| if-no-files-found: warn | |
| retention-days: 7 | |
| overwrite: true | |
| test-windows-bundle: | |
| timeout-minutes: 90 | |
| needs: cleanup_buckets | |
| env: | |
| B2_TEST_APPLICATION_KEY: ${{ secrets.B2_TEST_APPLICATION_KEY }} | |
| B2_TEST_APPLICATION_KEY_ID: ${{ secrets.B2_TEST_APPLICATION_KEY_ID }} | |
| WORKFLOW_ID: ${{ github.run_id }}-${{ github.run_attempt }}-${{ github.job }} | |
| runs-on: windows-2022 # keep the version aligned with cd.yml | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python ${{ env.PYTHON_DEFAULT_VERSION }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ env.PYTHON_DEFAULT_VERSION }} | |
| - uses: astral-sh/setup-uv@v7 | |
| with: | |
| version: ${{ env.UV_VERSION }} | |
| enable-cache: true | |
| - name: Install dependencies | |
| run: | | |
| uv sync --locked --group nox | |
| - name: Bundle the distribution | |
| id: bundle | |
| shell: bash | |
| run: uv run nox -vs bundle | |
| - name: Generate hashes | |
| id: hashes | |
| run: uv run nox -vs make_dist_digest | |
| - name: Run integration tests (without secrets) | |
| run: uv run nox -vs integration -p ${{ env.PYTHON_DEFAULT_VERSION }} -- --sut=${{ steps.bundle.outputs.sut_path }} -m "not require_secrets" | |
| - name: Run integration tests (with secrets) | |
| if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' }} | |
| run: uv run nox -vs integration -p ${{ env.PYTHON_DEFAULT_VERSION }} -- --sut=${{ steps.bundle.outputs.sut_path }} -m "require_secrets" --cleanup | |
| - name: Upload assets | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| path: ${{ steps.bundle.outputs.asset_path }} | |
| if-no-files-found: warn | |
| retention-days: 7 | |
| overwrite: true | |
| doc: | |
| timeout-minutes: 30 | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python ${{ env.PYTHON_DEFAULT_VERSION }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ env.PYTHON_DEFAULT_VERSION }} | |
| - uses: astral-sh/setup-uv@v7 | |
| with: | |
| version: ${{ env.UV_VERSION }} | |
| enable-cache: true | |
| - name: Install dependencies | |
| env: | |
| DEBIAN_FRONTEND: noninteractive | |
| run: | | |
| sudo apt-get update -y | |
| sudo apt-get install -y graphviz plantuml | |
| uv sync --locked --group nox | |
| - name: Build the docs | |
| run: uv run nox --non-interactive -vs doc |