Skip to content

Commit 400d79c

Browse files
committed
Fix build for Linux
1 parent e9e177a commit 400d79c

File tree

6 files changed

+40
-25
lines changed

6 files changed

+40
-25
lines changed

.github/workflows/debug.yml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,22 @@ on:
99
branches: [ master ]
1010

1111
jobs:
12-
build:
12+
build-linux:
1313
runs-on: ubuntu-latest
1414
steps:
15-
- name: Install gtest manually
16-
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
17-
- uses: actions/checkout@v1
18-
- name: configure
19-
run: mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-Werror" ..
20-
- name: make
21-
run: cd build && make
22-
- name: Run Test
23-
run: /home/runner/work/github_actions_gtest_example/github_actions_gtest_example/build/test/github_actions_gtest_example.test
15+
- name: Download, configure and install gtest
16+
run: |
17+
wget https://github.com/google/googletest/archive/release-1.10.0.tar.gz
18+
tar xf release-1.10.0.tar.gz
19+
cd googletest-release-1.10.0
20+
cmake -DBUILD_SHARED_LIBS=OFF .
21+
sudo make install
22+
- name: Checkout the project
23+
uses: actions/checkout@v1
24+
- name: Do some tests
25+
run: |
26+
mkdir build
27+
cd build
28+
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-Werror" ..
29+
make
30+
/home/runner/work/github_actions_gtest_example/github_actions_gtest_example/build/test/github_actions_gtest_example.test

.github/workflows/release.yml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,22 @@ on:
99
branches: [ master ]
1010

1111
jobs:
12-
build:
12+
build-linux:
1313
runs-on: ubuntu-latest
1414
steps:
15-
- name: Install gtest manually
16-
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
17-
- uses: actions/checkout@v1
18-
- name: configure
19-
run: mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-Werror" ..
20-
- name: make
21-
run: cd build && make
22-
- name: Run Test
23-
run: /home/runner/work/github_actions_gtest_example/github_actions_gtest_example/build/test/github_actions_gtest_example.test
15+
- name: Download, configure and install gtest
16+
run: |
17+
wget https://github.com/google/googletest/archive/release-1.10.0.tar.gz
18+
tar xf release-1.10.0.tar.gz
19+
cd googletest-release-1.10.0
20+
cmake -DBUILD_SHARED_LIBS=OFF .
21+
sudo make install
22+
- name: Checkout the project
23+
uses: actions/checkout@v1
24+
- name: Do some tests
25+
run: |
26+
mkdir build
27+
cd build
28+
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-Werror" ..
29+
make
30+
/home/runner/work/github_actions_gtest_example/github_actions_gtest_example/build/test/github_actions_gtest_example.test

src/github_actions_gtest_example.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include <github_actions_gtest_example/github_actions_gtest_example.h>
1+
#include "github_actions_gtest_example/github_actions_gtest_example.h"
22

33
namespace githubActionsGtestExample {
44

src/info.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include <github_actions_gtest_example/github_actions_gtest_example.h>
1+
#include "github_actions_gtest_example/github_actions_gtest_example.h"
22

33
#include <iostream>
44

test/AllTests.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#include <gmock/gmock.h>
12
#include <gtest/gtest.h>
23

34
int main(int argc, char **argv) {
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#include <github_actions_gtest_example/github_actions_gtest_example.h>
2-
1+
#include "github_actions_gtest_example/github_actions_gtest_example.h"
2+
#include <gmock/gmock.h>
33
#include <gtest/gtest.h>
44

55
TEST(githubActionsGtestExampleTest, firstTest) {
@@ -10,6 +10,6 @@ TEST(githubActionsGtestExampleTest, addTest) {
1010
const int a = 1;
1111
const int b = 3;
1212
const int result = githubActionsGtestExample::add(a, b);
13-
13+
1414
EXPECT_EQ( result, a + b );
1515
}

0 commit comments

Comments
 (0)