Skip to content

Commit

Permalink
CI: build GoogleTest 1.14 from source (was 1.11 via apt install)
Browse files Browse the repository at this point in the history
  • Loading branch information
generalmimon committed May 3, 2024
1 parent cd14531 commit ce0f601
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
26 changes: 26 additions & 0 deletions .build/install-gtest
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash
set -ef

# Build GoogleTest from source and install it
#
# See https://github.com/google/googletest/blob/d83fee138a9ae6cb7c03688a2d08d4043a39815d/googletest/README.md#build-with-cmake

gtest_version_tag=v1.14.0

temp_dir=$(mktemp -d)
function cleanup {
rm -rf -- "$temp_dir"
}
trap 'cleanup' EXIT

# Download
git clone --depth 1 -b "$gtest_version_tag" -- https://github.com/google/googletest.git "$temp_dir"
cd -- "$temp_dir"
mkdir build
cd build
# Configure - build only GoogleTest, not GoogleMock
cmake .. -DBUILD_GMOCK=OFF
# Build
make
# Install
sudo make install
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: install GoogleTest
run: |
sudo apt-get update
sudo apt-get install -y libgtest-dev
run: .build/install-gtest
- name: install include-what-you-use (iwyu)
# NB: https://packages.ubuntu.com/jammy/iwyu apparently doesn't declare the `libclang-common-XXX-dev` package it
# needs as a dependency (without it, `include-what-you-use` fails with "fatal error: 'stddef.h' file not found"
Expand All @@ -32,7 +30,9 @@ jobs:
# want to update to it, we'll have to change this hardcoded version manually and update the
# `libclang-common-XXX-dev` version accordingly (see
# https://github.com/include-what-you-use/include-what-you-use/blob/master/README.md#clang-compatibility).
run: sudo apt-get install -y iwyu=8.17-1 libclang-common-13-dev
run: |
sudo apt-get update
sudo apt-get install -y iwyu=8.17-1 libclang-common-13-dev
- name: build
env:
CPP_STANDARD: ${{ matrix.cpp-standard }}
Expand Down

0 comments on commit ce0f601

Please sign in to comment.