Skip to content

Commit 77434c6

Browse files
authored
chore: fix mac os ci (#286)
* chore: fix mac os ci Update the runner to macos 13 following this issue actions/runner-images#9997 --------- Signed-off-by: Roman Gershman <romange@gmail.com> Signed-off-by: Roman Gershman <roman@dragonflydb.io>
1 parent 0e7051e commit 77434c6

File tree

3 files changed

+34
-19
lines changed

3 files changed

+34
-19
lines changed

.github/workflows/mac-os.yml

+11-14
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ name: mac-os-ci
33
on:
44
push:
55
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
68
workflow_dispatch:
79

810
concurrency:
@@ -15,34 +17,29 @@ env:
1517

1618
jobs:
1719
build-macos:
18-
runs-on: macos-12
20+
runs-on: macos-13
1921
timeout-minutes: 30 # ✨✨✨✨
2022
steps:
2123
- uses: actions/checkout@v4
2224
- run: |
23-
brew uninstall --formula node kotlin harfbuzz sbt selenium-server imagemagick \
24-
gradle maven openjdk postgresql r ant mongodb-community@5.0 mongosh \
25-
node@18 php composer
26-
27-
# Prevent updating these packages that sometimes break the update
28-
brew pin azure-cli jpeg-xl aom lima pipx gcc
29-
30-
brew update && brew install --force ninja boost openssl automake libtool
25+
brew update && brew install ninja boost automake
3126
- name: Configure CMake
3227
run: |
3328
cmake --version
34-
gcc-13 --version
29+
gcc-12 --version
3530
uname -a
3631
cmake -B ${{github.workspace}}/build \
3732
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
3833
-GNinja \
39-
-DCMAKE_C_COMPILER="gcc-13" \
40-
-DCMAKE_CXX_COMPILER="g++-13"
34+
-DCMAKE_C_COMPILER=gcc-12 \
35+
-DCMAKE_CXX_COMPILER=g++-12 \
36+
-DCMAKE_CXX_FLAGS="-Wl,-ld_classic" # due to a linker bug on macos, see https://github.com/Homebrew/homebrew-core/issues/145991
37+
4138
- name: Build & Test
4239
run: |
4340
cd ${{github.workspace}}/build
44-
ninja gperf_project || cat third_party/src/gperf_project-stamp/gperf_project-patch-*.log
45-
41+
ninja gperf_project || cat third_party/src/gperf_project-stamp/gperf_project-install-*.log
42+
ninja cares_project || cat third_party/src/cares_project-stamp/cares_project-build-*.log
4643
ninja -k 5 base/all io/all strings/all util/all echo_server ping_iouring_server \
4744
https_client_cli s3_demo
4845
./fibers_test --logtostderr --gtest_repeat=10

cmake/third_party.cmake

+9-2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ file(MAKE_DIRECTORY ${THIRD_PARTY_LIB_DIR})
2727
set(THIRD_PARTY_CXX_FLAGS "-std=c++14 -O3 -DNDEBUG -fPIC -fno-stack-protector \
2828
-fno-stack-clash-protection")
2929

30+
if (APPLE)
31+
set(THIRD_PARTY_CXX_FLAGS "${THIRD_PARTY_CXX_FLAGS} -Wl,-ld_classic")
32+
endif()
33+
3034
find_package(Threads REQUIRED)
3135

3236
function(add_third_party name)
@@ -275,7 +279,10 @@ add_third_party(
275279
URL https://github.com/gperftools/gperftools/archive/gperftools-2.15.tar.gz
276280

277281
# GIT_SHALLOW TRUE
278-
PATCH_COMMAND autoreconf -i # update runs every time for some reason
282+
# Remove building the unneeded programs (they fail on macos)
283+
PATCH_COMMAND echo sed -i "/^noinst_PROGRAMS +=/d;/binary_trees binary_trees_shared/d"
284+
<SOURCE_DIR>/Makefile.am
285+
COMMAND autoreconf -i # update runs every time for some reason
279286
# CMAKE_PASS_FLAGS "-DGPERFTOOLS_BUILD_HEAP_PROFILER=OFF -DGPERFTOOLS_BUILD_HEAP_CHECKER=OFF \
280287
# -DGPERFTOOLS_BUILD_DEBUGALLOC=OFF -DBUILD_TESTING=OFF \
281288
# -Dgperftools_build_benchmark=OFF"
@@ -372,7 +379,7 @@ endif()
372379

373380
add_third_party(
374381
cares
375-
URL https://github.com/c-ares/c-ares/releases/download/cares-1_29_0/c-ares-1.29.0.tar.gz
382+
URL https://codeload.github.com/c-ares/c-ares/tar.gz/refs/tags/v1.31.0
376383
CMAKE_PASS_FLAGS "-DCARES_SHARED:BOOL=OFF -DCARES_STATIC:BOOL=ON -DCARES_STATIC_PIC:BOOL=ON \
377384
-DCMAKE_INSTALL_LIBDIR=lib"
378385
)

util/accept_server_test.cc

+14-3
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,15 @@ TEST_F(AcceptServerTest, Migrate) {
267267
TEST_F(AcceptServerTest, Shutdown) {
268268
listener_->SetMaxClients(1 << 16);
269269
auto* proactor = client_sock_->proactor();
270-
proactor->Await([this, proactor] {
270+
271+
272+
proactor->Await([proactor, this] {
273+
#ifdef __linux__
274+
constexpr auto kHupMask = POLLHUP | POLLRDHUP;
275+
#else
276+
constexpr auto kHupMask = POLLHUP;
277+
#endif
278+
271279
vector<unique_ptr<FiberSocketBase>> socks;
272280
constexpr unsigned kNumSocks = 2000;
273281
unsigned called = 0;
@@ -277,7 +285,10 @@ TEST_F(AcceptServerTest, Shutdown) {
277285
error_code ec = socks.back()->Connect(ep_);
278286
EXPECT_FALSE(ec);
279287

280-
socks.back()->RegisterOnErrorCb([&](int) { ++called; });
288+
socks.back()->RegisterOnErrorCb([&](int err) {
289+
EXPECT_EQ(err, kHupMask);
290+
++called;
291+
});
281292
}
282293

283294
for (unsigned i = 0; i < socks.size(); ++i) {
@@ -290,7 +301,7 @@ TEST_F(AcceptServerTest, Shutdown) {
290301
// exchange FIN packets. With real world scenarios it's not guaranteed that Shutdown
291302
// will trigger POLLHUP delivery, because it depends on the other size sending FIN as well.
292303
// See https://man7.org/linux/man-pages/man2/poll.2.html for more details.
293-
EXPECT_EQ(called, socks.size());
304+
EXPECT_GE(called, socks.size());
294305
for (unsigned i = 0; i < socks.size(); ++i) {
295306
std::ignore = socks[i]->Close();
296307
}

0 commit comments

Comments
 (0)