Skip to content

Commit e52e5ab

Browse files
committed
Update Github Actions CI job runner script to run all possible tests, along with examples
Signed-off-by: Anjan Roy <hello@itzmeanjan.in>
1 parent 7944f20 commit e52e5ab

File tree

1 file changed

+47
-20
lines changed

1 file changed

+47
-20
lines changed

.github/workflows/test_ci.yml

+47-20
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,52 @@ jobs:
1212
strategy:
1313
matrix:
1414
os: [ubuntu-latest, macos-latest]
15+
compiler: [g++, clang++]
16+
build_type: [debug, release]
17+
test_type: [standard, asan, ubsan]
18+
max-parallel: 4
1519

1620
steps:
17-
- uses: actions/checkout@v4
18-
- name: Setup Google-Test
19-
run: |
20-
pushd ~
21-
git clone https://github.com/google/googletest.git -b v1.14.0
22-
pushd googletest
23-
mkdir build
24-
pushd build
25-
cmake .. -DBUILD_GMOCK=OFF
26-
make -j
27-
sudo make install -j
28-
popd
29-
popd
30-
popd
31-
- name: Execute Tests on ${{matrix.os}}
32-
run: make -j
33-
- name: Execute Tests with AddressSanitizer on ${{matrix.os}}
34-
run: make asan_test -j
35-
- name: Execute Tests with UndefinedBehaviourSanitizer on ${{matrix.os}}
36-
run: make ubsan_test -j
21+
- uses: actions/checkout@v4
22+
23+
- name: Setup Google Test
24+
uses: Bacondish2023/setup-googletest@v1
25+
with:
26+
tag: v1.15.2
27+
28+
29+
- name: Build and Test (${{ matrix.compiler }}, ${{ matrix.build_type }}, ${{ matrix.test_type }})
30+
run: |
31+
CXX=${{ matrix.compiler }}
32+
if [[ ${{ matrix.test_type }} == "standard" ]]; then
33+
make test -j 2>&1 | tee build.log
34+
else
35+
make ${{ matrix.build_type }}_${{ matrix.test_type }}_test -j 2>&1 | tee build.log
36+
fi
37+
if [ $? -ne 0 ]; then
38+
echo "Build or Test Failed! See build.log for details."
39+
exit 1
40+
fi
41+
42+
- name: Upload Build Log
43+
uses: actions/upload-artifact@v3
44+
with:
45+
name: build-log-${{ matrix.compiler }}-${{ matrix.build_type }}-${{ matrix.test_type }}
46+
path: build.log
47+
48+
49+
- name: Run Examples
50+
if: ${{ matrix.test_type == 'standard' && matrix.build_type == 'release' }}
51+
run: |
52+
CXX=${{ matrix.compiler }} make example -j 2>&1 | tee example.log
53+
if [ $? -ne 0 ]; then
54+
echo "Example execution Failed! See example.log for details."
55+
exit 1
56+
fi
57+
58+
- name: Upload Example Log (if failed)
59+
if: ${{ steps.Run_Examples.outcome != 'success' && matrix.test_type == 'standard' && matrix.build_type == 'release' }}
60+
uses: actions/upload-artifact@v3
61+
with:
62+
name: example-log-${{ matrix.compiler }}
63+
path: example.log

0 commit comments

Comments
 (0)