Skip to content

Commit 29d12ec

Browse files
committed
Update README
1 parent 400d79c commit 29d12ec

File tree

1 file changed

+25
-14
lines changed

1 file changed

+25
-14
lines changed

README.md

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
![github_actions_gtest_example-Release](https://github.com/bastianhjaeger/github_actions_gtest_example/workflows/github_actions_gtest_example-Release/badge.svg?branch=master)
33
![github_actions_gtest_example-Debug](https://github.com/bastianhjaeger/github_actions_gtest_example/workflows/github_actions_gtest_example-Debug/badge.svg?branch=master)
44

5-
Example on how to integrate gtest test into [github actions](https://github.com/features/actions).
5+
Example on how to integrate gtest test into [github actions](https://github.com/features/actions).
66

77

88

99
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.
1010

11-
It is plain and simple, but maybe it helps you.
11+
It is plain and simple, but maybe it helps you.
1212

1313
# Setup Actions
1414

@@ -27,18 +27,25 @@ jobs:
2727
build:
2828
runs-on: ubuntu-latest
2929
steps:
30-
- name: Install gtest manually
31-
run: sudo apt-get install libgtest-dev && cd /usr/src/gtest && sudo cmake CMakeLists.txt && sudo make && sudo cp *.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
32-
- uses: actions/checkout@v1
33-
- name: configure
34-
run: mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-Werror" ..
35-
- name: make
36-
run: cd build && make
37-
- name: Run Test
38-
run: /home/runner/work/github_actions_gtest_example/github_actions_gtest_example/build/test/github_actions_gtest_example.test
39-
```
40-
41-
The important part is the *"Install gtest manually"* section. This is the plain and simple way to add it.
30+
- name: Download, configure and install gtest
31+
run: |
32+
wget https://github.com/google/googletest/archive/release-1.10.0.tar.gz
33+
tar xf release-1.10.0.tar.gz
34+
cd googletest-release-1.10.0
35+
cmake -DBUILD_SHARED_LIBS=OFF .
36+
sudo make install
37+
- name: Checkout the project
38+
uses: actions/checkout@v1
39+
- name: Do some tests
40+
run: |
41+
mkdir build
42+
cd build
43+
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-Werror" ..
44+
make
45+
/home/runner/work/github_actions_gtest_example/github_actions_gtest_example/build/test/github_actions_gtest_example.test
46+
```
47+
48+
The important part is the *"Download, configure and install gtest"* section. This is the plain and simple way to add it.
4249
4350
# Result
4451
@@ -59,3 +66,7 @@ mkdir build && cd build
5966
cmake -DCMAKE_BUILD_TYPE=Release ..
6067
make -j8
6168
```
69+
70+
# If you only want to use Makefile
71+
72+
You can `pkg-config --libs gtest gmock` and `pkg-config --cflags gtest gmock`.

0 commit comments

Comments
 (0)