From 2ad98c573a2b75991269030327e8d26bf3eb7bd3 Mon Sep 17 00:00:00 2001 From: Francesco Borzì Date: Fri, 21 Aug 2020 12:19:02 +0200 Subject: feat(CI): add macOS to our CI (#3321) Co-Authored-By: Meerd --- .github/workflows/core_build.yml | 22 ++++++++++++++++++++++ CMakeLists.txt | 3 +++ apps/ci/mac/ci-compile.sh | 29 +++++++++++++++++++++++++++++ apps/ci/mac/ci-install.sh | 4 ++++ 4 files changed, 58 insertions(+) create mode 100755 apps/ci/mac/ci-compile.sh create mode 100755 apps/ci/mac/ci-install.sh diff --git a/.github/workflows/core_build.yml b/.github/workflows/core_build.yml index 43110a1d77..65fae08ec7 100644 --- a/.github/workflows/core_build.yml +++ b/.github/workflows/core_build.yml @@ -52,6 +52,28 @@ jobs: - name: Run unit tests run: source ./apps/ci/ci-run-unit-tests.sh + mac-build: + strategy: + fail-fast: false + runs-on: macos-10.15 + name: macos-10.15 + steps: + - uses: actions/checkout@v2 + - name: Cache + uses: actions/cache@v1.1.2 + with: + path: /Users/runner/.ccache + key: ccache:macos-10.15:${{ github.ref }}:${{ github.sha }} + restore-keys: | + ccache:macos-10.15:${{ github.ref }} + ccache:macos-10.15 + - name: Configure OS + run: source ./apps/ci/mac/ci-install.sh + - name: Build + run: source ./apps/ci/mac/ci-compile.sh + - name: Run unit tests + run: source ./apps/ci/ci-run-unit-tests.sh + docker-build: strategy: fail-fast: true diff --git a/CMakeLists.txt b/CMakeLists.txt index 9c5696ff81..7473c64661 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -98,6 +98,9 @@ set(ACE_EXPECTED_VERSION 6.0.3) find_package(PCHSupport) find_package(ACE REQUIRED) +if(CMAKE_SYSTEM_NAME MATCHES "Darwin") + add_definitions(-DACE_LACKS_AUTO_PTR=1) +endif() find_package(MySQL REQUIRED) if(UNIX AND WITH_PERFTOOLS) diff --git a/apps/ci/mac/ci-compile.sh b/apps/ci/mac/ci-compile.sh new file mode 100755 index 0000000000..fc0a008b5a --- /dev/null +++ b/apps/ci/mac/ci-compile.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +export CCACHE_CPP2=true +export CCACHE_MAXSIZE='500MB' +ccache -s + +mkdir var/build/obj && cd var/build/obj; + +time cmake ../../../ \ +-DTOOLS=1 \ +-DUNIT_TESTS=1 \ +-DSCRIPTS=1 \ +-DCMAKE_BUILD_TYPE=Debug \ +-DMYSQL_ADD_INCLUDE_PATH=/usr/local/include \ +-DMYSQL_LIBRARY=/usr/local/lib/libmysqlclient.dylib \ +-DREADLINE_INCLUDE_DIR=/usr/local/opt/readline/include \ +-DREADLINE_LIBRARY=/usr/local/opt/readline/lib/libreadline.dylib \ +-DOPENSSL_INCLUDE_DIR=/usr/local/opt/openssl/include \ +-DOPENSSL_SSL_LIBRARIES=/usr/local/opt/openssl/lib/libssl.dylib \ +-DOPENSSL_CRYPTO_LIBRARIES=/usr/local/opt/openssl/lib/libcrypto.dylib \ +-DCMAKE_C_FLAGS="-Werror" \ +-DCMAKE_CXX_FLAGS="-Werror" \ +-DCMAKE_C_COMPILER_LAUNCHER=ccache \ +-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ +; + +time make -j $(($(sysctl -n hw.ncpu ) + 2)) + +ccache -s diff --git a/apps/ci/mac/ci-install.sh b/apps/ci/mac/ci-install.sh new file mode 100755 index 0000000000..8b1d20aa87 --- /dev/null +++ b/apps/ci/mac/ci-install.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +time brew update +time brew install openssl readline ace coreutils bash bash-completion mysql ccache -- cgit v1.2.3