Skip to content

Commit eba62fd

Browse files
ejfineclaude
andcommitted
ci: allow long file paths before checking out on Windows
Windows defaults to a 260 character path limit, and a checkout that cannot write a file fails the job before any step of it runs. Tooling that names files after the tests they belong to reaches that limit without the names being unreasonable, so a generated project with Windows runners can find its backend unit tests never running at all. The config has to be set before the checkout writes the files, so it leads every job that can run on Windows rather than living in a shared action. Jobs whose runners are chosen by matrix only get the step when use_windows_in_ci is set, so a project without Windows runners carries nothing dead. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 2bdcd8b commit eba62fd

4 files changed

Lines changed: 56 additions & 8 deletions

‎template/.github/workflows/ci.yaml.jinja‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,13 @@ jobs:
7777
timeout-minutes: {% endraw %}{{ gha_medium_timeout_minutes }}{% raw %}
7878
env:
7979
UV_PYTHON: ${{ matrix.python-version }}
80-
steps:
80+
steps:{% endraw %}{% if use_windows_in_ci %}
81+
- name: Allow long file paths
82+
if: runner.os == 'Windows'
83+
# Some tooling (e.g. vcrpy, syrupy) generates file names past the 260 character limit Windows
84+
# defaults to. This has to happen before the checkout that writes those files.
85+
run: git config --global core.longpaths true
86+
{% endif %}{% raw %}
8187
- name: Checkout code
8288
uses: actions/checkout@{% endraw %}{{ gha_checkout }}{% raw %}
8389

@@ -170,7 +176,13 @@ jobs:
170176
env:
171177
UV_PYTHON: ${{ matrix.python-version }}
172178

173-
steps:
179+
steps:{% endraw %}{% if use_windows_in_exe_ci %}
180+
- name: Allow long file paths
181+
if: runner.os == 'Windows'
182+
# Some tooling (e.g. vcrpy, syrupy) generates file names past the 260 character limit Windows
183+
# defaults to. This has to happen before the checkout that writes those files.
184+
run: git config --global core.longpaths true
185+
{% endif %}{% raw %}
174186
- name: Checkout code
175187
uses: actions/checkout@{% endraw %}{{ gha_checkout }}{% raw %}
176188
- name: Install python tooling

‎template/.github/workflows/release.yaml.jinja‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,13 @@ jobs:
157157
env:
158158
UV_PYTHON: ${{ matrix.python-version }}
159159

160-
steps:
160+
steps:{% endraw %}{% if use_windows_in_ci %}
161+
- name: Allow long file paths
162+
if: runner.os == 'Windows'
163+
# Some tooling (e.g. vcrpy, syrupy) generates file names past the 260 character limit Windows
164+
# defaults to. This has to happen before the checkout that writes those files.
165+
run: git config --global core.longpaths true
166+
{% endif %}{% raw %}
161167
- name: Checkout code
162168
uses: actions/checkout@{% endraw %}{{ gha_checkout }}{% raw %}
163169
- name: Setup python
@@ -313,7 +319,13 @@ jobs:
313319
env:
314320
UV_PYTHON: ${{ matrix.python-version }}
315321

316-
steps:
322+
steps:{% endraw %}{% if use_windows_in_ci %}
323+
- name: Allow long file paths
324+
if: runner.os == 'Windows'
325+
# Some tooling (e.g. vcrpy, syrupy) generates file names past the 260 character limit Windows
326+
# defaults to. This has to happen before the checkout that writes those files.
327+
run: git config --global core.longpaths true
328+
{% endif %}{% raw %}
317329
- name: Checkout code
318330
uses: actions/checkout@{% endraw %}{{ gha_checkout }}{% raw %}
319331
- name: Setup python

‎template/.github/workflows/{% if not deploy_as_executable %}publish.yaml{% endif %}.jinja‎

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,13 @@ jobs:
6767
env:
6868
UV_PYTHON: ${{ matrix.python-version }}
6969

70-
steps:
70+
steps:{% endraw %}{% if use_windows_in_ci %}
71+
- name: Allow long file paths
72+
if: runner.os == 'Windows'
73+
# Some tooling (e.g. vcrpy, syrupy) generates file names past the 260 character limit Windows
74+
# defaults to. This has to happen before the checkout that writes those files.
75+
run: git config --global core.longpaths true
76+
{% endif %}{% raw %}
7177
- name: Checkout code
7278
uses: actions/checkout@{% endraw %}{{ gha_checkout }}{% raw %}
7379

@@ -180,7 +186,13 @@ jobs:
180186
env:
181187
UV_PYTHON: ${{ matrix.python-version }}
182188

183-
steps:
189+
steps:{% endraw %}{% if use_windows_in_ci %}
190+
- name: Allow long file paths
191+
if: runner.os == 'Windows'
192+
# Some tooling (e.g. vcrpy, syrupy) generates file names past the 260 character limit Windows
193+
# defaults to. This has to happen before the checkout that writes those files.
194+
run: git config --global core.longpaths true
195+
{% endif %}{% raw %}
184196
- name: Checkout code
185197
uses: actions/checkout@{% endraw %}{{ gha_checkout }}{% raw %}
186198
- name: Setup python
@@ -326,7 +338,13 @@ jobs:
326338
env:
327339
UV_PYTHON: ${{ matrix.python-version }}
328340

329-
steps:
341+
steps:{% endraw %}{% if use_windows_in_ci %}
342+
- name: Allow long file paths
343+
if: runner.os == 'Windows'
344+
# Some tooling (e.g. vcrpy, syrupy) generates file names past the 260 character limit Windows
345+
# defaults to. This has to happen before the checkout that writes those files.
346+
run: git config --global core.longpaths true
347+
{% endif %}{% raw %}
330348
- name: Checkout code
331349
uses: actions/checkout@{% endraw %}{{ gha_checkout }}{% raw %}
332350
- name: Setup python

‎template/.github/workflows/{% if not deploy_as_executable %}publish_to_staging.yaml{% endif %}.jinja‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,13 @@ jobs:
4141
env:
4242
UV_PYTHON: ${{ matrix.python-version }}
4343

44-
steps:
44+
steps:{% endraw %}{% if use_windows_in_ci %}
45+
- name: Allow long file paths
46+
if: runner.os == 'Windows'
47+
# Some tooling (e.g. vcrpy, syrupy) generates file names past the 260 character limit Windows
48+
# defaults to. This has to happen before the checkout that writes those files.
49+
run: git config --global core.longpaths true
50+
{% endif %}{% raw %}
4551
- name: Checkout code
4652
uses: actions/checkout@{% endraw %}{{ gha_checkout }}{% raw %}
4753

0 commit comments

Comments
 (0)