From e673fe1134fa746044976d2a883ff4574ed484f9 Mon Sep 17 00:00:00 2001 From: Leo Fang Date: Sun, 7 Jun 2026 15:53:01 +0000 Subject: [PATCH] CI: shrink checkouts via shallow / treeless partial clones Of the 15 workflow checkouts that used fetch-depth: 0, only 7 actually need the commit graph (setuptools-scm, git merge-base, git worktree), and none of them need historical blobs. The remaining 8 either do no git operations or only need tag resolution. - 6 sites with no local git ops: fetch-depth: 1 (ci.yml ci-vars, build-docs.yml, release-upload.yml, release.yml check-tag, release-cuda-pathfinder.yml upload-assets, coverage.yml coverage-windows) - 2 sites that resolve a tag to a SHA via lookup-run-id: fetch-depth: 1 + fetch-tags: true (release.yml determine-run-id, release-cuda-pathfinder.yml prepare) - 7 sites that need the commit graph but not blobs: fetch-depth: 0 + filter: blob:none (build-wheel.yml, ci.yml detect-changes, cleanup-pr-previews.yml, coverage.yml coverage-linux, coverage.yml build-wheel-windows, test-sdist-linux.yml, test-sdist-windows.yml) Closes #2091 --- .github/workflows/build-docs.yml | 2 +- .github/workflows/build-wheel.yml | 3 +++ .github/workflows/ci.yml | 5 ++++- .github/workflows/cleanup-pr-previews.yml | 4 +++- .github/workflows/coverage.yml | 8 +++++++- .github/workflows/release-cuda-pathfinder.yml | 6 ++++-- .github/workflows/release-upload.yml | 2 +- .github/workflows/release.yml | 7 ++++--- .github/workflows/test-sdist-linux.yml | 3 +++ .github/workflows/test-sdist-windows.yml | 3 +++ 10 files changed, 33 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index db8cb0420b2..e95a50b2a03 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -47,7 +47,7 @@ jobs: - name: Checkout ${{ github.event.repository.name }} uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 with: - fetch-depth: 0 + fetch-depth: 1 ref: ${{ inputs.git-tag }} - name: Read build CTK version diff --git a/.github/workflows/build-wheel.yml b/.github/workflows/build-wheel.yml index a101c381138..53117982b8a 100644 --- a/.github/workflows/build-wheel.yml +++ b/.github/workflows/build-wheel.yml @@ -42,7 +42,10 @@ jobs: - name: Checkout ${{ github.event.repository.name }} uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 with: + # Treeless clone: setuptools-scm needs the commit graph (`git describe`) + # but not historical blobs. fetch-depth: 0 + filter: blob:none - name: Install latest rapidsai/sccache if: ${{ startsWith(inputs.host-platform, 'linux') }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9f9236b09fe..6b510ecffc8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,7 +35,7 @@ jobs: - name: Checkout repository uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 with: - fetch-depth: 0 + fetch-depth: 1 - name: Get CUDA build versions id: get-vars run: | @@ -106,7 +106,10 @@ jobs: - name: Checkout repository uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 with: + # Treeless clone: commit graph is needed for `git merge-base` and + # `git diff --name-only` below, but historical blobs aren't. fetch-depth: 0 + filter: blob:none # copy-pr-bot pushes every PR (whether it targets main or a backport # branch such as 12.9.x) to pull-request/, so the base branch diff --git a/.github/workflows/cleanup-pr-previews.yml b/.github/workflows/cleanup-pr-previews.yml index 6d6f0bc5060..ff4b01f70af 100644 --- a/.github/workflows/cleanup-pr-previews.yml +++ b/.github/workflows/cleanup-pr-previews.yml @@ -30,8 +30,10 @@ jobs: - name: Checkout repository uses: actions/checkout@v6.0.3 with: - # Fetch all history and branches for worktree operations + # Treeless clone: `git worktree add gh-pages` needs the commit graph, + # but historical blobs aren't required. fetch-depth: 0 + filter: blob:none - name: Configure git identity run: | diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 9581cff3088..7888af362cd 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -66,7 +66,10 @@ jobs: - name: Checkout ${{ github.event.repository.name }} uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 with: + # Treeless clone: setuptools-scm needs the commit graph (`git describe`) + # but not historical blobs. fetch-depth: 0 + filter: blob:none - name: Fix workspace ownership run: | @@ -198,7 +201,10 @@ jobs: - name: Checkout ${{ github.event.repository.name }} uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 with: + # Treeless clone: setuptools-scm needs the commit graph (`git describe`) + # but not historical blobs. fetch-depth: 0 + filter: blob:none - name: Set up Python uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 @@ -269,7 +275,7 @@ jobs: - name: Checkout ${{ github.event.repository.name }} uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 with: - fetch-depth: 0 + fetch-depth: 1 - name: Setup proxy cache uses: nv-gha-runners/setup-proxy-cache@main diff --git a/.github/workflows/release-cuda-pathfinder.yml b/.github/workflows/release-cuda-pathfinder.yml index c8bc37e71d4..3a47c669440 100644 --- a/.github/workflows/release-cuda-pathfinder.yml +++ b/.github/workflows/release-cuda-pathfinder.yml @@ -61,7 +61,9 @@ jobs: - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 with: - fetch-depth: 0 + # lookup-run-id resolves the git tag to a SHA; we need tags but not history. + fetch-depth: 1 + fetch-tags: true # Resolve only the exact tag ref; checkout fails if the tag does not exist. ref: refs/tags/${{ steps.vars.outputs.tag }} @@ -161,7 +163,7 @@ jobs: steps: - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 with: - fetch-depth: 0 + fetch-depth: 1 ref: ${{ needs.prepare.outputs.tag }} - name: Create source archive diff --git a/.github/workflows/release-upload.yml b/.github/workflows/release-upload.yml index 18dba727a93..05e03febd64 100644 --- a/.github/workflows/release-upload.yml +++ b/.github/workflows/release-upload.yml @@ -43,7 +43,7 @@ jobs: - name: Checkout Source uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 with: - fetch-depth: 0 + fetch-depth: 1 ref: ${{ inputs.git-tag }} - name: Create Release Directory diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 697d9783601..635aba08923 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -43,8 +43,9 @@ jobs: - name: Checkout Source uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 with: - # fetch-depth: 0 is required so the lookup-run-id script can access all git tags - fetch-depth: 0 + # lookup-run-id resolves the git tag to a SHA; we need tags but not history. + fetch-depth: 1 + fetch-tags: true - name: Determine Run ID id: lookup-run-id @@ -62,7 +63,7 @@ jobs: - name: Checkout Source uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 with: - fetch-depth: 0 + fetch-depth: 1 - name: Check or create draft release for the tag env: diff --git a/.github/workflows/test-sdist-linux.yml b/.github/workflows/test-sdist-linux.yml index 25d8cae9cdb..bb2c66aa3af 100644 --- a/.github/workflows/test-sdist-linux.yml +++ b/.github/workflows/test-sdist-linux.yml @@ -28,7 +28,10 @@ jobs: - name: Checkout ${{ github.event.repository.name }} uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 with: + # Treeless clone: setuptools-scm (invoked via `python -m build`) needs + # the commit graph (`git describe`) but not historical blobs. fetch-depth: 0 + filter: blob:none - name: Set up Python uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 diff --git a/.github/workflows/test-sdist-windows.yml b/.github/workflows/test-sdist-windows.yml index e7c2fcdda9e..2f1c6a0cb7a 100644 --- a/.github/workflows/test-sdist-windows.yml +++ b/.github/workflows/test-sdist-windows.yml @@ -34,7 +34,10 @@ jobs: - name: Checkout ${{ github.event.repository.name }} uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 with: + # Treeless clone: setuptools-scm (invoked via `python -m build`) needs + # the commit graph (`git describe`) but not historical blobs. fetch-depth: 0 + filter: blob:none - name: Set up Python uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0