Github Actions Gtest Example Save

Use gtest with github actions. Quickly example how to add a workflow / action to github that executes your gtest tests.

Project README

General

github_actions_gtest_example-Release github_actions_gtest_example-Debug

Example on how to integrate gtest test into github actions.

While there exist other links in the www on how to use it (which did not work for my setup), this repo quickly shows how to add a workflow / action to github that executes your gtest tests and responses with a simple ok / not-ok to highlight on github.

It is plain and simple, but maybe it helps you.

Setup Actions

the workflow file you need (e.g. in you repo under .github/workflows/release.yml) could look like this

name: my-workflow-name

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - name: Install gtest manually
      run: sudo apt-get install libgtest-dev && cd /usr/src/gtest && sudo cmake CMakeLists.txt && sudo make && sudo cp lib/*.a /usr/lib && sudo ln -s /usr/lib/libgtest.a /usr/local/lib/libgtest.a && sudo ln -s /usr/lib/libgtest_main.a /usr/local/lib/libgtest_main.a
    - uses: actions/checkout@v1
    - name: configure
      run: mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-Werror" ..
    - name: make
      run: cd build && make
    - name: Run Test
      run: /home/runner/work/github_actions_gtest_example/github_actions_gtest_example/build/test/github_actions_gtest_example.test

The important part is the "Install gtest manually" section. This is the plain and simple way to add it.

Result

After some time (depending on you project and test complexity) you see the results like this:

actions_build_example_01 actions_build_example_02_detail actions_build_example_03_overview

Build local

git clone [email protected]:bastianhjaeger/github_actions_gtest_example.git
cd github_actions_gtest_example
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j8
Open Source Agenda is not affiliated with "Github Actions Gtest Example" Project. README Source: bastianhjaeger/github_actions_gtest_example
Stars
28
Open Issues
1
Last Commit
1 year ago
License
MIT

Open Source Agenda Badge

Open Source Agenda Rating