git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 4/5] ci: make p4 setup on macOS more robust

From
Patrick Steinhardt <ps@pks.im>
Date
Jan 18, 2024, 10:22 UTC
Message-ID
<1ed6e6865014b5f24aeadd14505b06a15ed20eb2.1705573336.git.ps@pks.im>
In-Reply-To
<cover.1705573336.git.ps@pks.im>

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 <ps@pks.im>
---
 ci/install-dependencies.sh | 10 ++++------
 ci/lib.sh                  |  3 +++
 2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh
index 4f407530d3..b4e22de3cb 100755
--- a/ci/install-dependencies.sh
+++ b/ci/install-dependencies.sh
@@ -37,15 +37,13 @@ macos-*)
 	test -z "$BREW_INSTALL_PACKAGES" ||
 	brew install $BREW_INSTALL_PACKAGES
 	brew link --force gettext
-	mkdir -p $HOME/bin
-	(
-		cd $HOME/bin
+
+	mkdir -p "$P4_PATH"
+	pushd "$P4_PATH"
 		wget -q "$P4WHENCE/bin.macosx1015x86_64/helix-core-server.tgz" &&
 		tar -xf helix-core-server.tgz &&
 		sudo xattr -d com.apple.quarantine p4 p4d 2>/dev/null || true
-	)
-	PATH="$PATH:${HOME}/bin"
-	export PATH
+	popd
 
 	if test -n "$CC_PACKAGE"
 	then
diff --git a/ci/lib.sh b/ci/lib.sh
index c749b21366..f631206a44 100755
--- a/ci/lib.sh
+++ b/ci/lib.sh
@@ -344,6 +344,9 @@ macos-*)
 	then
 		MAKEFLAGS="$MAKEFLAGS APPLE_COMMON_CRYPTO_SHA1=Yes"
 	fi
+
+	P4_PATH="$HOME/custom/p4"
+	export PATH="$P4_PATH:$PATH"
 	;;
 esac
 
-- 
2.43.GIT
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 13 of 17 in “ci: add support for macOS to GitLab CI”
  1. 0/3 ci: add support for macOS to GitLab CIPatrick Steinhardt, Jan 15, 2024
  2. 1/3 ci: make p4 setup on macOS more robustPatrick Steinhardt, Jan 15, 2024
  3. Matthias AßhauerJan 18, 2024
  4. Patrick SteinhardtJan 18, 2024
  5. 2/3 Makefile: detect new Homebrew location for ARM-based MacsPatrick Steinhardt, Jan 15, 2024
  6. 3/3 ci: add macOS jobs to GitLab CIPatrick Steinhardt, Jan 15, 2024
  7. Phillip WoodJan 16, 2024
  8. Patrick SteinhardtJan 17, 2024
  9. 0/5 ci: add support for macOS to GitLab CIPatrick Steinhardt, Jan 18, 2024
  10. 1/5 t7527: decrease likelihood of racing with fsmonitor daemonPatrick Steinhardt, Jan 18, 2024
  11. 2/5 Makefile: detect new Homebrew location for ARM-based MacsPatrick Steinhardt, Jan 18, 2024
  12. 3/5 ci: handle TEST_OUTPUT_DIRECTORY when printing test failuresPatrick Steinhardt, Jan 18, 2024
  13. 4/5 ci: make p4 setup on macOS more robustPatrick Steinhardt, Jan 18, 2024
  14. 5/5 ci: add macOS jobs to GitLab CIPatrick Steinhardt, Jan 18, 2024
  15. Phillip WoodJan 21, 2024
  16. Patrick SteinhardtJan 22, 2024
  17. Junio C HamanoJan 22, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.