Skip to content

Commit f360e01

Browse files
author
Etienne Lescot
committed
fix(ci): read the runner image instead of interpolating an empty string
`${{ env.ImageOS }}` and `${{ env.ImageVersion }}` have expanded to nothing since the line was written. The `env` expression context holds only what a workflow, job or step `env:` block put there; the runner sets these two into its own process environment, where `run:` steps see them and `${{ env.… }}` does not. The repository's own cache list shows the result — three consecutive hyphens where the image should be: whisper-stt-build-darwin-arm64---2ca5d2c75aac59ca… So the cache was keyed on the tag and the CMakeLists hash alone, and the exact failure the comment above it predicts — a restored tree with dead absolute SDK paths, "No rule to make target …libz.tbd" — was never actually guarded against. A shell step reads the values and both the key and the restore-keys prefix use its output. `shell: bash` is not decorative: this matrix includes windows-latest, whose default shell has no `${VAR:-default}`. Second, unrelated to the key but proven by the same cache list's neighbours: `on.push` had `paths:` and no `branches:`, so a tag push matched. Publishing `v0.0.0-onnxruntime-1.27.1` started a four-platform whisper build for a tag that touches none of these files. `branches: ['**']` excludes tags while keeping every branch, which is how this workflow is used. Closes #596
1 parent 818bfaa commit f360e01

1 file changed

Lines changed: 27 additions & 3 deletions

File tree

‎.github/workflows/build-whisper-stt.yml‎

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ name: Build whisper-stt binaries
1616
on:
1717
workflow_dispatch:
1818
push:
19+
# ALL branches, NO tags. `paths:` alone also matches a tag push, and it has:
20+
# publishing `v0.0.0-onnxruntime-1.27.1` started a four-platform whisper build
21+
# for a tag that touched none of these files. Listing `branches` is what
22+
# excludes tags; `'**'` keeps every branch working, which is the point of this
23+
# workflow — contributors push a branch to get binaries built.
24+
branches:
25+
- "**"
1926
paths:
2027
- "scripts/build-whisper-stt.sh"
2128
- "electron/native/whisper-stt/**"
@@ -139,6 +146,23 @@ jobs:
139146
"${VCPKG_ROOT_DIR}/vcpkg" install spirv-headers:x64-windows
140147
echo "CMAKE_PREFIX_PATH=${VCPKG_ROOT_DIR}/installed/x64-windows" >> "$GITHUB_ENV"
141148
149+
# `${{ env.ImageOS }}` DOES NOT WORK, and it fails silently — the `env`
150+
# expression context holds only what a workflow/job/step `env:` block put
151+
# there, and the runner sets ImageOS/ImageVersion into its own process
152+
# environment instead. Written that way, both halves expanded to the empty
153+
# string and the cache below was keyed on the tag and the CMakeLists hash
154+
# alone, for every platform, for as long as the line existed: the repo's
155+
# own cache list read `whisper-stt-build-darwin-arm64---<hash>`. Reading
156+
# them here in a shell is what actually gets their values.
157+
#
158+
# `shell: bash` is required, not decorative: this matrix includes
159+
# windows-latest, where the default shell is PowerShell and `${VAR:-default}`
160+
# is not syntax. GitHub ships bash on the Windows image.
161+
- name: Read the runner image
162+
id: image
163+
shell: bash
164+
run: echo "tag=${ImageOS:-unknown}-${ImageVersion:-unknown}" >> "$GITHUB_OUTPUT"
165+
142166
- name: Cache whisper.cpp build tree
143167
uses: actions/cache@v6
144168
with:
@@ -151,15 +175,15 @@ jobs:
151175
# bump there invalidates the cache instead of silently reusing a stale
152176
# FetchContent checkout; falls back to the newest cache for the same
153177
# platform + runner image on a miss so incremental compilation still
154-
# helps. The runner image version ($ImageOS/$ImageVersion) is part of
178+
# helps. The runner image version (read by the step above) is part of
155179
# the key AND the restore-keys prefix because CMake bakes absolute
156180
# toolchain paths (e.g. the Xcode SDK's libz.tbd) into the cached build
157181
# tree — when GitHub rolls the image's Xcode/SDK, those paths vanish and
158182
# a restored tree fails with "No rule to make target …libz.tbd". Scoping
159183
# the cache to the image version auto-busts it on every toolchain roll.
160-
key: whisper-stt-build-${{ matrix.tag }}-${{ env.ImageOS }}-${{ env.ImageVersion }}-${{ hashFiles('electron/native/whisper-stt/CMakeLists.txt') }}
184+
key: whisper-stt-build-${{ matrix.tag }}-${{ steps.image.outputs.tag }}-${{ hashFiles('electron/native/whisper-stt/CMakeLists.txt') }}
161185
restore-keys: |
162-
whisper-stt-build-${{ matrix.tag }}-${{ env.ImageOS }}-${{ env.ImageVersion }}-
186+
whisper-stt-build-${{ matrix.tag }}-${{ steps.image.outputs.tag }}-
163187
164188
- name: Run whisper-stt build script
165189
run: bash scripts/build-whisper-stt.sh

0 commit comments

Comments
 (0)