Skip to content

Commit c4b84b1

Browse files
pks-tgitster
authored andcommitted
ci: make p4 setup on macOS more robust
When setting up Perforce on macOS we put both `p4` and `p4d` into "$HOME/bin". On GitHub CI this directory is indeed contained in the PATH environment variable and thus there is no need for additional setup than to put the binaries there. But GitLab CI does not do this, and thus our Perforce-based tests would be skipped there even though we download the binaries. Refactor the setup code to become more robust by downloading binaries into a separate directory which we then manually append to our PATH. This matches what we do on Linux-based jobs. Note that it may seem like we already did append "$HOME/bin" to PATH because we're actually removing the lines that adapt PATH. But we only ever adapted the PATH variable in "ci/install-dependencies.sh", and didn't adapt it when running "ci/run-build-and-test.sh". Consequently, the required binaries wouldn't be found during the test run unless the CI platform already had the "$HOME/bin" in PATH right from the start. Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 99c60ed commit c4b84b1

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

ci/install-dependencies.sh

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,13 @@ macos-*)
3737
test -z "$BREW_INSTALL_PACKAGES" ||
3838
brew install $BREW_INSTALL_PACKAGES
3939
brew link --force gettext
40-
mkdir -p $HOME/bin
41-
(
42-
cd $HOME/bin
40+
41+
mkdir -p "$P4_PATH"
42+
pushd "$P4_PATH"
4343
wget -q "$P4WHENCE/bin.macosx1015x86_64/helix-core-server.tgz" &&
4444
tar -xf helix-core-server.tgz &&
4545
sudo xattr -d com.apple.quarantine p4 p4d 2>/dev/null || true
46-
)
47-
PATH="$PATH:${HOME}/bin"
48-
export PATH
46+
popd
4947

5048
if test -n "$CC_PACKAGE"
5149
then

ci/lib.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,9 @@ macos-*)
344344
then
345345
MAKEFLAGS="$MAKEFLAGS APPLE_COMMON_CRYPTO_SHA1=Yes"
346346
fi
347+
348+
P4_PATH="$HOME/custom/p4"
349+
export PATH="$P4_PATH:$PATH"
347350
;;
348351
esac
349352

0 commit comments

Comments
 (0)