Skip to content

Commit ed33a6b

Browse files
Add test workflow for library
1 parent 8ce492c commit ed33a6b

File tree

2 files changed

+36
-3
lines changed

2 files changed

+36
-3
lines changed

.github/workflows/testLibrary.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: test library
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
linux-test:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
cxx: [g++, clang++]
17+
stdcxx: ['c++14', 'c++17', 'c++20']
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
- name: Install dependencies
22+
run: sudo apt update && sudo apt install g++ clang make libgtest-dev -y
23+
- name: Build
24+
run: |
25+
cd library
26+
make
27+
env:
28+
CXX: ${{ matrix.cxx }}
29+
STDCXX: ${{ matrix.stdcxx }}
30+
- name: Test
31+
run: |
32+
cd library
33+
./test.exe

library/makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1+
STDCXX ?= c++14
12

2-
CXX = g++
3+
CXX ?= g++
34

4-
CXXFLAGS = -Wall -Wextra -g -I. -MMD
5+
CXXFLAGS = -Wall -Wextra -g -I. -MMD -std=$(STDCXX)
56

67
TARGET = test.exe
78

89
GTEST_LIBS = -lgtest -lgtest_main -pthread
910

10-
1111
LDFLAGS = $(GTEST_LIBS)
1212

1313
SRCS = test/main.cpp

0 commit comments

Comments
 (0)