Skip to content

Commit 79eac71

Browse files
committed
CI: fix yarn-berry Windows setup — git-bash 'command -v' doesn't see .cmd
Previous setup called command -v yarn-berry / yarn-berry --version after creating yarn-berry.cmd. git-bash's command -v doesn't consult PATHEXT so it couldn't find the .cmd shim, failing the whole Setup step with exit code 1 before any tests could run. Invoke the .cmd file directly for the build-time version check, and rely on GITHUB_PATH export for subsequent steps (pytest / shutil.which on Windows does honor PATHEXT).
1 parent c3cb5c1 commit 79eac71

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

.github/workflows/tests.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -175,17 +175,21 @@ jobs:
175175
YARN_BERRY_PREFIX="$USERPROFILE/yarn-berry"
176176
YARN_BERRY_ALIAS_DIR="$USERPROFILE/yarn-berry-bin"
177177
mkdir -p "$YARN_BERRY_ALIAS_DIR"
178-
# GITHUB_PATH is interpreted by runner as \-prefixed lines on Windows.
178+
# Stage onto GITHUB_PATH so later steps (pytest subprocess
179+
# ``shutil.which``, etc.) find ``yarn-berry.cmd`` via ``PATHEXT``.
179180
echo "$YARN_BERRY_ALIAS_DIR" >> "$GITHUB_PATH"
180181
npm install --prefix "$YARN_BERRY_PREFIX" @yarnpkg/cli-dist@4.13.0
181182
# Emit a one-line ``yarn-berry.cmd`` that forwards to npm-installed
182183
# ``yarn.cmd``. Use ``%*`` to pass through all args. Built with
183184
# printf so the heredoc body doesn't collide with YAML block-scalar
184185
# indentation.
185-
printf '@echo off\n"%s\\node_modules\\.bin\\yarn.cmd" %%*\n' "$YARN_BERRY_PREFIX" > "$YARN_BERRY_ALIAS_DIR/yarn-berry.cmd"
186-
export PATH="$YARN_BERRY_ALIAS_DIR:$PATH"
187-
command -v yarn-berry
188-
yarn-berry --version | grep -q '^4\.'
186+
YARN_BERRY_CMD="$YARN_BERRY_ALIAS_DIR/yarn-berry.cmd"
187+
printf '@echo off\n"%s\\node_modules\\.bin\\yarn.cmd" %%*\n' "$YARN_BERRY_PREFIX" > "$YARN_BERRY_CMD"
188+
# Verify each shim works. ``command -v`` in git-bash doesn't
189+
# consult ``PATHEXT`` so reference the ``.cmd`` file directly for
190+
# the version check — the GITHUB_PATH export above is what later
191+
# pytest steps rely on.
192+
"$YARN_BERRY_CMD" --version | grep -q '^4\.'
189193
yarn --version | grep -q '^1\.'
190194
191195
- name: Setup Bun

0 commit comments

Comments
 (0)