-
Notifications
You must be signed in to change notification settings - Fork 12
80 lines (71 loc) · 3.01 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
68
69
70
71
72
73
74
75
76
77
78
79
80
# GH actions
name: unittest
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
BUILD_TYPE: Release
BUILD_DIR: build_ci
ProgramData: "C:\\ProgramData"
jobs:
build:
runs-on: ${{ matrix.image }}
strategy:
matrix:
image: [ 'windows-latest', 'ubuntu-latest', 'macos-latest' ]
fail-fast: false
steps:
- name: Clone repository
uses: actions/checkout@v3
- name: Setup Ninja
uses: seanmiddleditch/gha-setup-ninja@v4
# - name: Install glfw3
# shell: bash
# run: |
# git clone https://github.com/glfw/glfw --depth 1
# cd glfw
# mkdir build && cd build
# if [ '${{runner.os}}' == 'Windows' ]; then
# echo "Yes, this is on Windows"
# cmake .. -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_INSTALL_PREFIX='${{github.workspace}}'/glfw-install -G "Visual Studio 17 2022" -A x64
# else
# echo "Ohh, this is not on Windows"
# cmake .. -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_INSTALL_PREFIX='${{github.workspace}}'/glfw-install -G Ninja
# fi
# cmake --build . --config ${{env.BUILD_TYPE}} -j 2
# cmake --install . --config ${{env.BUILD_TYPE}}
- name: Install googletest
shell: bash
run: |
git clone https://github.com/google/googletest --depth 1
cd googletest
mkdir build && cd build
if [ '${{runner.os}}' == 'Windows' ]; then
echo "Yes, this is on Windows"
cmake .. -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_INSTALL_PREFIX='${{github.workspace}}'/googletest-install -Dgtest_force_shared_crt=ON -G "Visual Studio 17 2022" -A x64
else
echo "Ohh, this is not on Windows"
cmake .. -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_INSTALL_PREFIX='${{github.workspace}}'/googletest-install -G Ninja
fi
cmake --build . --config ${{env.BUILD_TYPE}} -j 2
cmake --install . --config ${{env.BUILD_TYPE}}
- name: Configure with CMake
shell: bash
run: |
mkdir ${{env.BUILD_TYPE}}
cd ${{env.BUILD_TYPE}}
if [ '${{runner.os}}' == 'Windows' ]; then
echo "Yes, this is on Windows"
cmake -G "Visual Studio 17 2022" -A x64 .. -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DSMALLCV_IMSHOW=OFF -DSMALLCV_EXAMPLES=OFF -DSMALLCV_TEST=ON -DGTest_DIR='${{github.workspace}}'/googletest-install/lib/cmake/GTest
else
echo "Ohh, this is not on Windows"
cmake -G Ninja .. -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DSMALLCV_IMSHOW=OFF -DSMALLCV_EXAMPLES=OFF -DSMALLCV_TEST=ON -DGTest_DIR=${{github.workspace}}/googletest-install/lib/cmake/GTest
fi
- name: Building
working-directory: ${{env.BUILD_TYPE}}
run: cmake --build . --config ${{env.BUILD_TYPE}}
- name: Testing
working-directory: ${{env.BUILD_TYPE}}
run: ctest -C ${{env.BUILD_TYPE}} --output-on-failure