Skip to content

Commit

Permalink
Revise GitHub workflow to use Makefile for building prerequisites
Browse files Browse the repository at this point in the history
  • Loading branch information
twestley committed Sep 19, 2024
1 parent 94d8d7c commit 18f2318
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 33 deletions.
27 changes: 7 additions & 20 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,21 @@ jobs:
- name: Build and install Google Test
if: always()
run: make gtest install-gtest
- name: Install abseil library
run: |
git clone https://github.com/abseil/abseil-cpp.git
cd abseil-cpp
mkdir build && cd build
sudo apt install cmake
cmake ..
sudo cmake --build . --target install
- name: Build and install Abseil
if: always()
run: make abseil install-abseil
- name: Cache protobuf library
id: cache-protobuf
uses: actions/cache@v1
with:
path: protobuf
key: ${{ runner.os }}-protobuf
- name: Build protobuf library
if: steps.cache-protobuf.outputs.cache-hit != 'true'
run: |
git clone https://github.com/protocolbuffers/protobuf.git
cd protobuf
git submodule update --init --recursive
cmake . -DCMAKE_CXX_STANDARD=14
cmake --build .
- name: Build Protobuf
if: always()
run: make protobuf
- name: Install protobuf library
if: always()
run: |
cd protobuf
sudo make install
sudo ldconfig
run: make install-protobuf
- name: Build and test ADAK
if: always()
run: make build-and-test USE_CORES=1
Expand Down
24 changes: 11 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,17 @@ lint :
# --------------
# Build protobuf
# --------------
PROTOBUF_INSTALL_DIR = ~/protobuf
protobuf : clean-protobuf
git clone https://github.com/protocolbuffers/protobuf.git
cd protobuf && \
git submodule update --init --recursive
cd protobuf && cmake . -DCMAKE_CXX_STANDARD=14 \
-DCMAKE_INSTALL_PREFIX=$(PROTOBUF_INSTALL_DIR) \
-Dprotobuf_ABSL_PROVIDER=package \
-DCMAKE_PREFIX_PATH=$(ABSEIL_INSTALL_DIR)
cd protobuf && cmake . -DCMAKE_CXX_STANDARD=14
cd protobuf && cmake --build . -j $(USE_CORES)
mkdir -p $(PROTOBUF_INSTALL_DIR)
cd protobuf && make install

clean-protobuf :
install-protobuf : FORCE
cd protobuf && sudo make install && sudo ldconfig

clean-protobuf : FORCE
rm -rf protobuf $(PROTOBUF_INSTALL_DIR)

# ------------------------------
Expand All @@ -89,16 +86,17 @@ clean-gtest : FORCE
# -------------------------------------------------------------------
# Build abseil rather than depending on whatever is already installed
# -------------------------------------------------------------------
ABSEIL_INSTALL_DIR = ~/abseil
abseil : clean-abseil
git clone https://github.com/abseil/abseil-cpp.git
cd abseil-cpp && mkdir build
cd abseil-cpp/build && cmake -DABSL_BUILD_TESTING=ON -DABSL_USE_GOOGLETEST_HEAD=ON \
-DCMAKE_CXX_STANDARD=14 -DCMAKE_INSTALL_PREFIX=$(ABSEIL_INSTALL_DIR) ..
cd abseil-cpp/build && cmake -DABSL_BUILD_TESTING=ON -DABSL_USE_GOOGLETEST_HEAD=ON -DCMAKE_CXX_STANDARD=14 ..
cd abseil-cpp/build && cmake --build . -j $(USE_CORES)

install-abseil : FORCE
cd abseil-cpp/build && cmake --build . --target install -j $(USE_CORES)

clean-abseil :
rm -rf abseil-cpp $(ABSEIL_INSTALL_DIR)
clean-abseil : FORCE
rm -rf abseil-cpp

# ----------------------------------------------
# This is the most comprehensive automated
Expand Down

0 comments on commit 18f2318

Please sign in to comment.