Skip to content

Commit 45b298f

Browse files
committed
fix(ci): persist PATH modifications to GITHUB_PATH across all install scripts
Ensure all tool installation scripts properly export PATH changes to GITHUB_PATH so subsequent workflow steps can find installed binaries. Changes: - install-system-deps: Export cmake and homebrew paths to GITHUB_PATH - install-cargo tools: Export ~/.cargo/bin to GITHUB_PATH for deny, taplo, llvm-cov - install-shfmt: Export /usr/local/bin to GITHUB_PATH on Linux - install-wasm-pack: Export ~/.cargo/bin to GITHUB_PATH - setup-openssl: Export OpenSSL bin directories to GITHUB_PATH (Linux, macOS, Windows) - setup-go-cgo-env: Use GITHUB_PATH instead of GITHUB_ENV for PATH on Windows Fixes publish workflow failures where cmake and other build tools were not found during cargo builds with build.rs scripts.
1 parent bac66e5 commit 45b298f

File tree

11 files changed

+65
-1
lines changed

11 files changed

+65
-1
lines changed

scripts/ci/actions/setup-go-cgo-env/windows.ps1

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,20 @@ if ([string]::IsNullOrWhiteSpace($env:PKG_CONFIG_PATH)) {
4545

4646
$env:PATH = "${ffiPath};$($env:PATH)"
4747

48+
# Persist FFI path to GITHUB_PATH for subsequent steps
49+
if (Test-Path $ffiPath) {
50+
Add-Content -Path $env:GITHUB_PATH -Value $ffiPath -Encoding utf8
51+
}
52+
4853
# Convert FFI path to MSYS2 format for CGO flags
4954
$msys2FfiPath = ConvertTo-Msys2Path $ffiPath
5055
$msys2IncludePath = "$msys2RepoRoot/crates/kreuzberg-ffi/include"
5156

5257
$mingwBin = "C:\msys64\mingw64\bin"
5358
if (Test-Path (Join-Path $mingwBin "x86_64-w64-mingw32-gcc.exe")) {
5459
$env:PATH = "${mingwBin};$($env:PATH)"
60+
# Persist MinGW bin to GITHUB_PATH for subsequent steps
61+
Add-Content -Path $env:GITHUB_PATH -Value $mingwBin -Encoding utf8
5562
$env:CC = "x86_64-w64-mingw32-gcc"
5663
$env:CXX = "x86_64-w64-mingw32-g++"
5764
$env:AR = "x86_64-w64-mingw32-ar"
@@ -75,7 +82,7 @@ if ($env:KREUZBERG_GO_LINKER_VERBOSE -eq "1") {
7582
$cgoLdflags = "-L$msys2FfiPath $linkerVerboseFlags".Trim()
7683

7784
# Add libraries to PATH for runtime discovery
78-
Add-Content -Path $env:GITHUB_ENV -Value "PATH=$env:PATH"
85+
# Note: PATH modifications are now handled via GITHUB_PATH above
7986
Add-Content -Path $env:GITHUB_ENV -Value "PKG_CONFIG_PATH=$pkgConfigPath"
8087
Add-Content -Path $env:GITHUB_ENV -Value "CGO_ENABLED=$cgoEnabled"
8188
Add-Content -Path $env:GITHUB_ENV -Value "CGO_CFLAGS=$cgoCflags"

scripts/ci/actions/setup-openssl/linux-configure.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ fi
1919
echo "PKG_CONFIG_PATH=${PKG_CONFIG_DIR}:${PKG_CONFIG_PATH:-}"
2020
} >>"$GITHUB_ENV"
2121

22+
# Ensure OpenSSL binaries are in PATH for subsequent steps
23+
if [[ -n "${GITHUB_PATH:-}" && -d "${OPENSSL_ROOT}/bin" ]]; then
24+
echo "${OPENSSL_ROOT}/bin" >>"$GITHUB_PATH"
25+
fi
26+
2227
echo "OpenSSL configuration completed:"
2328
echo " OPENSSL_DIR=${OPENSSL_ROOT}"
2429
echo " PKG_CONFIG_PATH=${PKG_CONFIG_DIR}"

scripts/ci/actions/setup-openssl/macos-configure.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,8 @@ echo "OpenSSL include path: $prefix/include"
2727
echo "OPENSSL_INCLUDE_DIR=$prefix/include"
2828
echo "PKG_CONFIG_PATH=$prefix/lib/pkgconfig:${PKG_CONFIG_PATH:-}"
2929
} >>"$GITHUB_ENV"
30+
31+
# Ensure OpenSSL binaries are in PATH for subsequent steps
32+
if [[ -n "${GITHUB_PATH:-}" && -d "$prefix/bin" ]]; then
33+
echo "$prefix/bin" >>"$GITHUB_PATH"
34+
fi

scripts/ci/actions/setup-openssl/windows-configure.ps1

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ foreach ($key in $envVars.Keys) {
2525
Add-Content -Path $env:GITHUB_ENV -Value "$key=$value"
2626
}
2727

28+
# Ensure OpenSSL binaries are in PATH for subsequent steps
29+
$opensslBin = "$vcpkgRoot\bin"
30+
if (Test-Path $opensslBin) {
31+
Write-Host " Adding $opensslBin to GITHUB_PATH"
32+
Add-Content -Path $env:GITHUB_PATH -Value $opensslBin -Encoding utf8
33+
}
34+
2835
Write-Host "OpenSSL environment configuration completed" -ForegroundColor Green
2936
Write-Host "Summary:" -ForegroundColor Green
3037
Write-Host " OPENSSL_DIR=$vcpkgRoot"

scripts/ci/actions/setup-rust/install-cargo-llvm-cov.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,8 @@ if ! command -v cargo-llvm-cov &>/dev/null; then
77
else
88
echo "cargo-llvm-cov already installed"
99
fi
10+
11+
# Ensure ~/.cargo/bin is in PATH for subsequent steps
12+
if [[ -n "${GITHUB_PATH:-}" && -d "$HOME/.cargo/bin" ]]; then
13+
echo "$HOME/.cargo/bin" >>"$GITHUB_PATH"
14+
fi

scripts/ci/install-system-deps/install-linux.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ echo "CMake:"
6161
if command -v cmake >/dev/null 2>&1; then
6262
cmake --version | head -1
6363
echo "✓ CMake available"
64+
# Ensure cmake binary directory is in GITHUB_PATH for subsequent steps
65+
CMAKE_BIN="$(dirname "$(command -v cmake)")"
66+
if [[ -n "$GITHUB_PATH" && -d "$CMAKE_BIN" ]]; then
67+
echo "$CMAKE_BIN" >>"$GITHUB_PATH"
68+
echo "✓ Added cmake directory to GITHUB_PATH: $CMAKE_BIN"
69+
fi
6470
else
6571
echo "::error::CMake not found after installation"
6672
exit 1

scripts/ci/install-system-deps/install-macos.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,13 @@ echo "::group::Installing macOS dependencies"
1010

1111
if [[ -d "/opt/homebrew/bin" ]]; then
1212
export PATH="/opt/homebrew/bin:/opt/homebrew/sbin:${PATH}"
13+
echo "/opt/homebrew/bin" >>"$GITHUB_PATH"
14+
echo "/opt/homebrew/sbin" >>"$GITHUB_PATH"
1315
fi
1416
if [[ -d "/usr/local/bin" ]]; then
1517
export PATH="/usr/local/bin:/usr/local/sbin:${PATH}"
18+
echo "/usr/local/bin" >>"$GITHUB_PATH"
19+
echo "/usr/local/sbin" >>"$GITHUB_PATH"
1620
fi
1721

1822
if ! brew list cmake &>/dev/null; then
@@ -93,6 +97,12 @@ echo "::group::Verifying macOS installations"
9397
echo "CMake:"
9498
if command -v cmake >/dev/null 2>&1; then
9599
cmake --version | head -1
100+
# Ensure cmake binary directory is in GITHUB_PATH for subsequent steps
101+
CMAKE_BIN="$(dirname "$(command -v cmake)")"
102+
if [[ -n "$GITHUB_PATH" && -d "$CMAKE_BIN" ]]; then
103+
echo "$CMAKE_BIN" >>"$GITHUB_PATH"
104+
echo "✓ Added cmake directory to GITHUB_PATH: $CMAKE_BIN"
105+
fi
96106
else
97107
echo "::error::CMake not found on PATH after installation"
98108
echo "PATH=$PATH"

scripts/ci/validate/install-cargo-deny.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ bash scripts/ci/validate/show-disk-space.sh "Before cargo-deny installation"
55

66
cargo install cargo-deny --locked
77

8+
# Ensure ~/.cargo/bin is in PATH for subsequent steps
9+
if [[ -n "${GITHUB_PATH:-}" && -d "$HOME/.cargo/bin" ]]; then
10+
echo "$HOME/.cargo/bin" >>"$GITHUB_PATH"
11+
fi
12+
813
rm -rf ~/.cargo/registry/cache/* ~/.cargo/git/db/* 2>/dev/null || true
914

1015
bash scripts/ci/validate/show-disk-space.sh "After cargo-deny installation and cleanup"

scripts/ci/validate/install-shfmt.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ bash scripts/ci/validate/show-disk-space.sh "Before shfmt installation"
66
if [[ "${RUNNER_OS:-}" == "Linux" ]]; then
77
curl -sSL "https://github.com/mvdan/sh/releases/download/v3.8.0/shfmt_v3.8.0_linux_amd64" -o /usr/local/bin/shfmt
88
chmod +x /usr/local/bin/shfmt
9+
# Ensure /usr/local/bin is in PATH for subsequent steps
10+
if [[ -n "${GITHUB_PATH:-}" ]]; then
11+
echo "/usr/local/bin" >>"$GITHUB_PATH"
12+
fi
913
elif [[ "${RUNNER_OS:-}" == "macOS" ]]; then
1014
brew install shfmt
1115
fi

scripts/ci/validate/install-taplo.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ if ! command -v taplo >/dev/null 2>&1; then
77
cargo install taplo-cli --locked
88
fi
99

10+
# Ensure ~/.cargo/bin is in PATH for subsequent steps
11+
if [[ -n "${GITHUB_PATH:-}" && -d "$HOME/.cargo/bin" ]]; then
12+
echo "$HOME/.cargo/bin" >>"$GITHUB_PATH"
13+
fi
14+
1015
rm -rf ~/.cargo/registry/cache/* ~/.cargo/git/db/* 2>/dev/null || true
1116

1217
bash scripts/ci/validate/show-disk-space.sh "After taplo installation and cleanup"

0 commit comments

Comments
 (0)