feat build: prefere static libs when possible #4971
Workflow file for this run
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: Docker | |
'on': | |
pull_request: | |
push: | |
branches: | |
- master | |
- develop | |
- feature/** | |
jobs: | |
tests: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- cmake-flags: >- | |
-DCMAKE_CXX_STANDARD=17 | |
-DCPM_SOURCE_CACHE=~/.cache/CPM | |
-DUSERVER_NO_WERROR=0 | |
-DUSERVER_BUILD_SAMPLES=1 | |
-DUSERVER_BUILD_TESTS=1 | |
-DUSERVER_FEATURE_CORE=1 | |
-DUSERVER_FEATURE_CHAOTIC=0 | |
gtest-filter: '' | |
image: ubuntu-22.04-userver-base | |
info: ubuntu + gcc + cxx17 + core | |
id: ubuntu_clang_cxx17_core | |
- cmake-flags: >- | |
-DCMAKE_C_COMPILER=clang-16 | |
-DCMAKE_CXX_COMPILER=clang++-16 | |
-DCMAKE_CXX_STANDARD=17 | |
-DCPM_SOURCE_CACHE=~/.cache/CPM | |
-DUSERVER_USE_STATIC_LIBS=1 | |
-DUSERVER_NO_WERROR=0 | |
-DUSERVER_BUILD_ALL_COMPONENTS=1 | |
-DUSERVER_BUILD_SAMPLES=1 | |
-DUSERVER_BUILD_TESTS=1 | |
gtest-filter: '' | |
image: ubuntu-22.04-userver-base-ci | |
info: ubuntu + clang + cxx17 | |
id: ubuntu_clang_cxx17 | |
- cmake-flags: >- | |
-DCMAKE_C_COMPILER=gcc-11 | |
-DCMAKE_CXX_COMPILER=g++-11 | |
-DCMAKE_CXX_STANDARD=17 | |
-DCPM_SOURCE_CACHE=~/.cache/CPM | |
-DUSERVER_USE_LD=gold | |
-DUSERVER_NO_WERROR=0 | |
-DUSERVER_BUILD_ALL_COMPONENTS=1 | |
-DUSERVER_BUILD_SAMPLES=1 | |
-DUSERVER_BUILD_TESTS=1 | |
gtest-filter: '' | |
image: ubuntu-22.04-userver-base-ci | |
info: ubuntu + gcc + cxx17 | |
id: ubuntu_gcc_cxx17 | |
- cmake-flags: >- | |
-DCMAKE_C_COMPILER=clang-16 | |
-DCMAKE_CXX_COMPILER=clang++-16 | |
-DCMAKE_CXX_STANDARD=20 | |
-DCPM_SOURCE_CACHE=~/.cache/CPM | |
-DUSERVER_USE_STATIC_LIBS=1 | |
-DUSERVER_BUILD_ALL_COMPONENTS=1 | |
-DUSERVER_BUILD_SAMPLES=1 | |
-DUSERVER_BUILD_TESTS=1 | |
gtest-filter: -YdbExecuteTpl/1.SimpleWriteReadBinary | |
image: ubuntu-22.04-userver-base-ci | |
info: ubuntu + clang + cxx20 | |
id: ubuntu_clang_cxx20 | |
- cmake-flags: >- | |
-DCMAKE_C_COMPILER=gcc-11 | |
-DCMAKE_CXX_COMPILER=g++-11 | |
-DCMAKE_CXX_STANDARD=20 | |
-DCPM_SOURCE_CACHE=~/.cache/CPM | |
-DUSERVER_USE_LD=gold | |
-DUSERVER_NO_WERROR=0 | |
-DUSERVER_BUILD_ALL_COMPONENTS=1 | |
-DUSERVER_BUILD_SAMPLES=1 | |
-DUSERVER_BUILD_TESTS=1 | |
gtest-filter: '' | |
image: ubuntu-22.04-userver-base-ci | |
info: ubuntu + gcc + cxx20 | |
id: ubuntu_gcc_cxx20 | |
runs-on: ubuntu-latest | |
name: '${{ matrix.info }}' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install packages | |
run: | | |
sudo apt install -y docker-compose | |
- name: Restore cached directories | |
id: restore-cache | |
uses: actions/cache/restore@v4 | |
with: | |
path: | | |
.ccache | |
.cache/CPM | |
key: 'docker-cache-dir ${{matrix.id}} ${{github.ref}} run-${{github.run_number}}' | |
restore-keys: | | |
docker-cache-dir ${{matrix.id}} ${{github.ref}} | |
docker-cache-dir ${{matrix.id}} | |
- name: Free disk space | |
run: | | |
df -h | |
# See https://stackoverflow.com/questions/75536771/github-runner-out-of-disk-space-after-building-docker-image | |
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /usr/lib/php* /opt/ghc \ | |
/usr/local/share/powershell /usr/share/swift /usr/local/.ghcup || true | |
df -h | |
- name: Setup ccache | |
run: docker-compose -f .github/docker-compose.yml run --rm ${{ matrix.image | |
}} bash -c 'ccache -M 2.0GB && ccache -s -v' | |
- name: CMake | |
run: >- | |
docker-compose -f .github/docker-compose.yml | |
run --rm ${{ matrix.image }} bash -c | |
'cd /userver && cmake -DUSERVER_GOOGLE_COMMON_PROTOS=/app/api-common-protos | |
${{ matrix.cmake-flags }} -B./build -S./' | |
- name: Build | |
run: >- | |
docker-compose -f .github/docker-compose.yml | |
run --rm ${{ matrix.image }} bash -c | |
'cd /userver && cmake --build build -j $(nproc)' | |
- name: Save cached directories | |
uses: actions/cache/save@v4 | |
with: | |
path: | | |
.ccache | |
.cache/CPM | |
key: ${{ steps.restore-cache.outputs.cache-primary-key }} | |
- name: Run ydb | |
if: matrix.id == 'ubuntu_clang_cxx20' | |
run: docker-compose -f .github/docker-compose.yml run -d --rm run-ydb | |
- name: Watch ydb | |
if: matrix.id == 'ubuntu_clang_cxx20' | |
run: >- | |
docker-compose -f .github/docker-compose.yml | |
run --rm ${{ matrix.image}} bash -c | |
'curl --retry 15 --retry-all-errors --retry-delay 5 -s -o /dev/null | |
http://run-ydb:8765/monitoring/ -v' | |
- name: Run tests | |
run: >- | |
docker-compose -f .github/docker-compose.yml | |
run --rm ${{ matrix.image}} bash -c | |
'cd /userver/build && ulimit -n 4096 && GTEST_FILTER="${{ matrix.gtest-filter | |
}}" ctest -V' |