build(deps): bump seanmiddleditch/gha-setup-ninja from 4 to 5 #42
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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@v5 | |
# - 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 |