Skip to content

Commit 8d285c0

Browse files
Added macos tests
Signed-off-by: sougata-progress <sougatab@progress.com>
1 parent f663668 commit 8d285c0

File tree

3 files changed

+94
-18
lines changed

3 files changed

+94
-18
lines changed

.expeditor/scripts/verify/run_cargo_test.sh

Lines changed: 69 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,19 @@
22

33
set -eou pipefail
44

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+
518
# shellcheck source=.expeditor/scripts/shared.sh
619
source .expeditor/scripts/verify/shared.sh
720

@@ -16,26 +29,65 @@ fi
1629
toolchain=$(get_toolchain)
1730

1831
# 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
2034
sudo chown -R buildkite-agent /home/buildkite-agent
2135
fi
2236

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
3991

4092
# Set testing filesystem root
4193
export FS_ROOT

.expeditor/scripts/verify/shared.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ source .expeditor/scripts/shared.sh
77
# This script should contain all shared functions for the verify pipeline
88

99
# Always accept habitat license
10-
sudo hab license accept
10+
if [[ -z "${HAB_LICENSE:-}" ]]; then
11+
sudo hab license accept
12+
else
13+
echo "Habitat license already accepted via HAB_LICENSE environment variable"
14+
fi
1115

1216
get_rustfmt_toolchain() {
1317
# It turns out that every nightly version of rustfmt has slight tweaks from the previous version.

.expeditor/verify.pipeline.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,26 @@ steps:
586586
automatic:
587587
limit: 10 # Addressing current Anka system timeouts due to oversubscription
588588

589+
- label: "[unit] :darwin: multiple components"
590+
env:
591+
HAB_LICENSE: "accept-no-persist"
592+
HOMEBREW_NO_AUTO_UPDATE: 1
593+
command:
594+
- .expeditor/scripts/verify/run_cargo_test.sh common
595+
- .expeditor/scripts/verify/run_cargo_test.sh core
596+
- .expeditor/scripts/verify/run_cargo_test.sh hab
597+
- .expeditor/scripts/verify/run_cargo_test.sh http-client
598+
expeditor:
599+
executor:
600+
macos:
601+
os-version: "12"
602+
inherit-environment-vars: true
603+
timeout_in_minutes: 30
604+
soft_fail: true
605+
retry:
606+
automatic:
607+
limit: 1
608+
589609
#################################################################
590610

591611
# See "[unit] :linux: ignored"; the same approach applies here for windows

0 commit comments

Comments
 (0)