-
Notifications
You must be signed in to change notification settings - Fork 13
67 lines (58 loc) · 2.1 KB
/
unit-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# GH actions
name: unittest
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
BUILD_TYPE: Release
jobs:
build:
runs-on: ${{ matrix.image }}
strategy:
matrix:
image: [ 'windows-latest', 'ubuntu-latest', 'macos-latest' ]
include:
- image: windows-latest
cmake_type: -Dgtest_force_shared_crt=ON -G "Visual Studio 16 2019" -A x64
build_with: -G "Visual Studio 16 2019" -A x64
- image: ubuntu-latest
cmake_type: -G Ninja
build_with: -G Ninja
- image: macos-latest
cmake_type: -G Ninja
build_with: -G Ninja
fail-fast: false
steps:
- name: Clone repository
uses: actions/checkout@v2
- name: Setup Ninja
uses: seanmiddleditch/gha-setup-ninja@v3
- name: cache-googletest
id: cache-googletest
uses: actions/cache@v2.1.7
with:
path: googletest-install-${{ matrix.image }}
key: cache-googletest-${{ matrix.image }}
- name: Install googletest
shell: bash
if: steps.cache-googletest.outputs.cache-hit != 'true'
run: |
git clone https://github.com/google/googletest --depth 1
cd googletest
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DCMAKE_INSTALL_PREFIX='${{ github.workspace }}'/googletest-install-${{ matrix.image }} ${{ matrix.cmake_type }}
cmake --build . --config ${{ env.BUILD_TYPE }} -j 2
cmake --install . --config ${{ env.BUILD_TYPE }}
- name: Configure with CMake
shell: bash
run: |
mkdir build
cd build
cmake ${{ matrix.build_with }} .. -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DSHUFACV_TEST=ON -DGTest_DIR='${{ github.workspace }}'/googletest-install-${{ matrix.image }}/lib/cmake/GTest
- name: Building
run: cmake --build build --config ${{ env.BUILD_TYPE }}
- name: Testing
working-directory: ${{ github.workspace }}/build
run: ctest -C ${{ env.BUILD_TYPE }} --output-on-failure