diff --git a/.build/install-gtest b/.build/install-gtest new file mode 100755 index 0000000..03902b1 --- /dev/null +++ b/.build/install-gtest @@ -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 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5c4ad8a..2843ba5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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" @@ -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 }}