Skip to content

Commit b9ac69f

Browse files
committed
Try removing Git for Windows PATH directories
In the `test-fast` Windows jobs, this removes descendant directories under the directory where Git for Windows is installed on CI Windows runners, from the `PATH` environment variable. This is done after the full test suite run. The idea is to support running some specific tests, where `gix-path` will have to find `git` by checking common locations. But this does rerun any tests yet. The other change this makes is to remove the CI runner PATH search instrumentation steps in `test-fast` and `test-fixtures-windows` that were just previously added. (Those steps were added temporarily to examine how this change should be made, and they are no longer needed.)
1 parent 5f1ea68 commit b9ac69f

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -220,12 +220,6 @@ jobs:
220220
runs-on: ${{ matrix.os }}
221221

222222
steps:
223-
- name: Show PATH
224-
if: startsWith(matrix.os, 'windows')
225-
run: $Env:PATH -split ';'
226-
- name: Find git
227-
if: startsWith(matrix.os, 'windows')
228-
run: where.exe git
229223
- uses: actions/checkout@v4
230224
- uses: dtolnay/rust-toolchain@stable
231225
- uses: Swatinem/rust-cache@v2
@@ -241,6 +235,17 @@ jobs:
241235
run: cargo nextest run --workspace --no-fail-fast -- ${{ matrix.test-args }}
242236
- name: Check that tracked archives are up to date
243237
run: git diff --exit-code # If this fails, the fix is usually to commit a regenerated archive.
238+
- name: Remove Git for Windows directories from PATH
239+
if: startsWith(matrix.os, 'windows')
240+
run: |
241+
$prefix = 'C:\Program Files\Git'
242+
$filtered = ($Env:PATH -split ';' | Where-Object { $_ -notlike "$prefix\*" }) -join ';'
243+
Add-Content -Value "PATH=$filtered" -Path $Env:GITHUB_ENV
244+
- name: Check that `git` is no longer found
245+
if: startsWith(matrix.os, 'windows')
246+
run: |
247+
$git = Get-Command git -ErrorAction SilentlyContinue
248+
if ($null -eq $git) { exit 0 } else { exit 1 }
244249
245250
test-fixtures-windows:
246251
strategy:
@@ -256,12 +261,6 @@ jobs:
256261
runs-on: ${{ matrix.os }}
257262

258263
steps:
259-
- name: Show PATH
260-
if: startsWith(matrix.os, 'windows')
261-
run: $Env:PATH -split ';'
262-
- name: Find git
263-
if: startsWith(matrix.os, 'windows')
264-
run: where.exe git
265264
- uses: actions/checkout@v4
266265
- uses: dtolnay/rust-toolchain@stable
267266
- uses: Swatinem/rust-cache@v2

0 commit comments

Comments
 (0)