Skip to content

Commit deb2a31

Browse files
Fix CI for macOS and docker based runs. (#1308)
* Update brew install on macOS We no longer need to specify `@8.2` to get Redis 8.x * Two small CI fixes * Rework how we detect the redis-server version depending on whether the test will use the system server or one from docker. * Make failing to delete our created temp directory non-fatal. This can fail on GitHub CI due to uid mismatches between docker and the host runner.
1 parent 2947820 commit deb2a31

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

.github/workflows/build.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ jobs:
9797

9898
- name: Install dependencies
9999
run: |
100-
brew install openssl redis@8.0
101-
brew link redis@8.0 --force
100+
brew install openssl redis
101+
brew link redis --force
102102
103103
- name: Build hiredis
104104
run: USE_SSL=1 make
@@ -158,10 +158,10 @@ jobs:
158158
with:
159159
cmake-version: ${{ matrix.cmake-version }}
160160
- name: Install hiredis dependencies
161-
run: |
161+
run: |
162162
sudo apt-get install -y libssl-dev libevent-dev
163163
- name: Build
164164
run: |
165165
mkdir build && cd build
166166
cmake -DENABLE_SSL=ON -DENABLE_SSL_TESTS=ON -DENABLE_ASYNC_TESTS=ON -DENABLE_EXAMPLES=ON ..
167-
make
167+
make

test.sh

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,14 @@ SKIPS_ARG=${SKIPS_ARG:-}
1111
REDIS_DOCKER=${REDIS_DOCKER:-}
1212

1313
# We need to enable the DEBUG command for redis-server >= 7.0.0
14-
REDIS_MAJOR_VERSION="$(${REDIS_SERVER} --version|awk -F'[^0-9]+' '{ print $2 }')"
14+
if [ -n "${REDIS_DOCKER}" ]; then
15+
REDIS_VERSION="$(docker run --rm ${REDIS_DOCKER} ${REDIS_SERVER} --version)"
16+
else
17+
REDIS_VERSION="$(${REDIS_SERVER} --version)"
18+
fi
19+
20+
# Enable debug command for redis >= 7.0.0
21+
REDIS_MAJOR_VERSION="$(echo ${REDIS_VERSION} | awk -F'[^0-9]+' '{ print $2 }')"
1522
if [ "$REDIS_MAJOR_VERSION" -gt "6" ]; then
1623
ENABLE_DEBUG_CMD="enable-debug-command local"
1724
fi
@@ -57,7 +64,11 @@ cleanup() {
5764
set +e
5865
kill $(cat ${PID_FILE})
5966
fi
60-
rm -rf ${tmpdir}
67+
68+
# Make failure to remove the temp dir non-fatal
69+
rm -rf -- "${tmpdir}" 2>/dev/null || {
70+
echo "warning: failed to remove temp dir: ${tmpdir}" >&2
71+
}
6172
}
6273
trap cleanup INT TERM EXIT
6374

0 commit comments

Comments
 (0)