Update CMakeLists.txt #10
This file contains hidden or 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: C++ CI with Google Test | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build-and-test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up C++ environment | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y build-essential cmake g++ libgtest-dev | |
- name: Build and install Google Test | |
run: | | |
cd /usr/src/gtest | |
sudo cmake . | |
sudo make | |
sudo cp lib/*.a /usr/lib | |
- name: Create build directory | |
run: mkdir -p build | |
- name: Configure CMake | |
run: cmake -S . -B build | |
- name: Build the project | |
run: cmake --build build | |
- name: Run tests | |
run: cd build && ctest --output-on-failure |