|
2 | 2 |
|
3 | 3 | set -eou pipefail |
4 | 4 |
|
| 5 | +# Platform-specific setup before sourcing shared.sh |
| 6 | +if [[ "$OSTYPE" == "darwin"* ]]; then |
| 7 | + # Set up temporary HAB_ROOT_PATH for macOS to avoid permission issues |
| 8 | + export HAB_ROOT_PATH |
| 9 | + HAB_ROOT_PATH=$(mktemp -d /tmp/hab-root-XXXXXX) |
| 10 | + |
| 11 | + # Clean up Darwin-specific temp directory on exit |
| 12 | + trap 'rm -rf "$HAB_ROOT_PATH"' EXIT |
| 13 | + |
| 14 | + # Accept habitat license via environment variable to avoid sudo issues |
| 15 | + export HAB_LICENSE="accept-no-persist" |
| 16 | +fi |
| 17 | + |
5 | 18 | # shellcheck source=.expeditor/scripts/shared.sh |
6 | 19 | source .expeditor/scripts/verify/shared.sh |
7 | 20 |
|
|
16 | 29 | toolchain=$(get_toolchain) |
17 | 30 |
|
18 | 31 | # TODO: fix this upstream, it looks like it's not saving correctly. |
19 | | -if ${BUILDKITE:-false}; then |
| 32 | +# Only do buildkite-agent chown on Linux systems |
| 33 | +if ${BUILDKITE:-false} && [[ "$OSTYPE" != "darwin"* ]]; then |
20 | 34 | sudo chown -R buildkite-agent /home/buildkite-agent |
21 | 35 | fi |
22 | 36 |
|
23 | | -# TODO: these should be in a shared script? |
24 | | -sudo -E hab pkg install core/zeromq |
25 | | -sudo -E hab pkg install core/protobuf |
26 | | -sudo -E hab pkg install core/rust/"$toolchain" |
27 | | -export LIBZMQ_PREFIX |
28 | | -LIBZMQ_PREFIX=$(hab pkg path core/zeromq) |
29 | | -# now include zeromq and gcc so they exist in the runtime library path when cargo test is run |
30 | | -export LD_LIBRARY_PATH |
31 | | -LD_LIBRARY_PATH="$(hab pkg path core/gcc-base)/lib64:$(hab pkg path core/zeromq)/lib" |
32 | | -old_path=$PATH |
33 | | -eval "$(hab pkg env core/rust/"$toolchain")" |
34 | | -export PATH=$PATH:$old_path |
35 | | - |
36 | | -export PROTOC_NO_VENDOR=1 |
37 | | -export PROTOC |
38 | | -PROTOC=$(hab pkg path core/protobuf)/bin/protoc |
| 37 | +# Platform-specific dependency setup |
| 38 | +if [[ "$OSTYPE" == "darwin"* ]]; then |
| 39 | + echo "--- Setting up macOS environment" |
| 40 | + |
| 41 | + # Install protobuf via homebrew if not available |
| 42 | + if ! command -v protoc &> /dev/null; then |
| 43 | + echo "Installing protobuf via homebrew..." |
| 44 | + brew install protobuf |
| 45 | + fi |
| 46 | + |
| 47 | + # Install GNU tools needed for certificate extraction |
| 48 | + if ! command -v gtail &> /dev/null; then |
| 49 | + echo "Installing GNU coreutils for certificate extraction..." |
| 50 | + brew install coreutils gnu-tar |
| 51 | + fi |
| 52 | + |
| 53 | + # Set up certificate file for TLS tests using macOS approach |
| 54 | + # Temporarily add GNU tools to PATH for the certificate function |
| 55 | + brew_prefix=$(brew --prefix) |
| 56 | + export PATH="/usr/local/bin:${brew_prefix}/bin:$PATH" |
| 57 | + # Create aliases for the certificate extraction function |
| 58 | + alias tail=gtail |
| 59 | + alias tar=gtar |
| 60 | + macos_use_cert_file_from_linux_cacerts_package |
| 61 | + unalias tail tar |
| 62 | + |
| 63 | + install_rustup |
| 64 | + install_rust_toolchain "$toolchain" |
| 65 | + echo "--- :rust: Using Rust toolchain ${toolchain}" |
| 66 | + rustc --version |
| 67 | + |
| 68 | + export PROTOC_NO_VENDOR=1 |
| 69 | + export PROTOC |
| 70 | + PROTOC=$(which protoc) |
| 71 | +else |
| 72 | + echo "--- Setting up Linux environment" |
| 73 | + |
| 74 | + # TODO: these should be in a shared script? |
| 75 | + sudo -E hab pkg install core/zeromq |
| 76 | + sudo -E hab pkg install core/protobuf |
| 77 | + sudo -E hab pkg install core/rust/"$toolchain" |
| 78 | + export LIBZMQ_PREFIX |
| 79 | + LIBZMQ_PREFIX=$(hab pkg path core/zeromq) |
| 80 | + # now include zeromq and gcc so they exist in the runtime library path when cargo test is run |
| 81 | + export LD_LIBRARY_PATH |
| 82 | + LD_LIBRARY_PATH="$(hab pkg path core/gcc-base)/lib64:$(hab pkg path core/zeromq)/lib" |
| 83 | + old_path=$PATH |
| 84 | + eval "$(hab pkg env core/rust/"$toolchain")" |
| 85 | + export PATH=$PATH:$old_path |
| 86 | + |
| 87 | + export PROTOC_NO_VENDOR=1 |
| 88 | + export PROTOC |
| 89 | + PROTOC=$(hab pkg path core/protobuf)/bin/protoc |
| 90 | +fi |
39 | 91 |
|
40 | 92 | # Set testing filesystem root |
41 | 93 | export FS_ROOT |
|
0 commit comments