Skip to content

Commit

Permalink
Revise the GitHub Action to perform building and testing
Browse files Browse the repository at this point in the history
Signed-off-by: Juan Cruz Viotti <[email protected]>
  • Loading branch information
jviotti committed Jun 10, 2024
1 parent 25de286 commit 797e2f3
Showing 1 changed file with 36 additions and 2 deletions.
38 changes: 36 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ inputs:
runs:
using: composite
steps:
#############################################
# Dependencies
#############################################

# ClangFormat
- if: runner.os == 'windows' && inputs.step == 'dependencies'
shell: pwsh
Expand All @@ -38,15 +42,17 @@ runs:
shell: pwsh
run: choco install shellcheck

# CMake
#############################################
# Configure
#############################################

- if: runner.os == 'windows' && inputs.step == 'configure'
run: cmake --version
shell: pwsh
- if: runner.os != 'windows' && inputs.step == 'configure'
run: cmake --version
shell: bash

# Configure
- if: runner.os == 'windows' && inputs.step == 'configure' && inputs.mode == 'static'
shell: pwsh
run: >
Expand Down Expand Up @@ -79,3 +85,31 @@ runs:
-DBUILD_SHARED_LIBS:BOOL=ON
-DCMAKE_COMPILE_WARNING_AS_ERROR:BOOL=ON
${{ inputs.options }}
#############################################
# Build
#############################################

- if: runner.os == 'windows' && inputs.step == 'build'
shell: pwsh
run: cmake --build ./build --config Release --parallel 4
- if: runner.os != 'windows' && inputs.step == 'build'
shell: bash
run: cmake --build ./build --config Release --parallel 4

#############################################
# Test
#############################################

# Not every CTest version supports the --test-dir option. If such option
# is not recognized, `ctest` will successfully exit finding no tests.
# Better to be sure and `cd` all the time here.
- if: runner.os == 'windows' && inputs.step == 'test'
shell: pwsh
run: cd ./build && ctest --build-config Release --output-on-failure --parallel
- if: runner.os != 'windows' && inputs.step == 'test'
shell: bash
run: cd ./build && ctest --build-config Release --output-on-failure --parallel
env:
# See https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html
UBSAN_OPTIONS: print_stacktrace=1

0 comments on commit 797e2f3

Please sign in to comment.