feat build: prefer static libs when possible #917
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: MacOS | |
'on': | |
pull_request: | |
push: | |
branches: | |
- master | |
- develop | |
- feature/** | |
env: | |
CCACHE_DIR: /Users/runner/Library/Caches/ccache | |
CCACHE_NOHASHDIR: true | |
CPM_SOURCE_CACHE: /Users/runner/Library/Caches/CPM | |
jobs: | |
macos: | |
strategy: | |
fail-fast: false | |
name: macos-latest (build only) | |
runs-on: macos-latest | |
env: | |
CMAKE_FLAGS: >- | |
-GNinja | |
-DCMAKE_BUILD_TYPE=Debug | |
-DUSERVER_USE_STATIC_LIBS=1 | |
-DUSERVER_NO_WERROR=1 | |
-DUSERVER_BUILD_ALL_COMPONENTS=1 | |
-DUSERVER_BUILD_SAMPLES=1 | |
-DUSERVER_BUILD_TESTS=1 | |
-DUSERVER_FEATURE_REDIS_HI_MALLOC=1 | |
-DUSERVER_FEATURE_CRYPTOPP_BLAKE2=0 | |
-DUSERVER_FEATURE_MONGODB=1 | |
-DUSERVER_FEATURE_CLICKHOUSE=1 | |
-DUSERVER_USE_LD=lld | |
-DUSERVER_FORCE_DOWNLOAD_ABSEIL=1 | |
-DUSERVER_FORCE_DOWNLOAD_PROTOBUF=1 | |
-DUSERVER_FORCE_DOWNLOAD_GRPC=1 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Restore cached directories | |
id: restore-cache | |
uses: actions/cache/restore@v4 | |
with: | |
path: | | |
${{env.CCACHE_DIR}} | |
${{env.CPM_SOURCE_CACHE}} | |
key: 'macos-cache-dir ${{github.ref}} run-${{github.run_number}}' | |
restore-keys: | | |
macos-cache-dir ${{github.ref}} | |
macos-cache-dir | |
- name: Install brew packages | |
run: | | |
export SDKROOT="`xcrun --show-sdk-path`" | |
brew update | |
brew install $(cat scripts/docs/en/deps/macos.md) | |
brew install clang-format | |
brew install [email protected] | |
brew install lld | |
brew link postgresql@16 # postgresql is keg-only | |
brew link --force zlib # keg-only + need for static linkage | |
brew link --force icu4c@76 # keg-only + need for static boost linkage | |
brew link --force curl # keg-only | |
brew link --force cyrus-sasl # keg-only | |
brew link --force openldap # keg-only | |
brew remove --ignore-dependencies abseil | |
- name: Setup ccache | |
run: | | |
ccache -M 2.0GB | |
ccache -s -v | |
- name: Run cmake | |
run: | | |
cmake -S./ -B./build_debug -DUSERVER_PYTHON_PATH=$(brew --prefix)/bin/python3.11 $CMAKE_FLAGS | |
- name: Compile | |
run: | | |
cmake --build build_debug -j$(nproc) -- -k 1 | |
- name: Save cached directories | |
uses: actions/cache/save@v4 | |
with: | |
path: | | |
${{env.CCACHE_DIR}} | |
${{env.CPM_SOURCE_CACHE}} | |
key: ${{ steps.restore-cache.outputs.cache-primary-key }} | |
- name: Show cache stats | |
run: | | |
du -h -d 1 ${{env.CCACHE_DIR}} | |
du -h -d 1 ${{env.CPM_SOURCE_CACHE}} | |
ccache -s -v |