Skip to content

Commit

Permalink
Merge pr #3: added tests using MSVC and macOS targets
Browse files Browse the repository at this point in the history
Added Windows CI test with MSVC
  • Loading branch information
mikucionisaau authored Jan 31, 2023
2 parents 0774119 + 5c3bc2e commit 0760000
Showing 1 changed file with 32 additions and 16 deletions.
48 changes: 32 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,38 +7,54 @@ on:
branches: [ "main" ]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
BUILD_TYPE: Debug

# Example:
# https://levelup.gitconnected.com/utilizing-github-actions-to-build-and-test-on-multiple-platforms-a7fe3aa6ce2a
jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-latest
Test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
include:
- os: ubuntu-latest
cmake-options: -DUBSAN=ON -DASAN=ON
target: Linux
- os: windows-latest
cmake-options:
target: Windows
- os: macos-latest
cmake-options: -DUBSAN=ON -DASAN=ON
target: macOS

steps:
- uses: actions/checkout@v3

- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DUBSAN=ON -DASAN=ON
- name: Configure
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} ${{matrix.cmake-options}}

- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}

- name: Test
working-directory: ${{github.workspace}}/build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{env.BUILD_TYPE}}
run: ctest -C ${{env.BUILD_TYPE}} --output-on-failure

- name: Compare outputs with pre-recorded results
- name: Compare Unix results with pre-recorded outputs
if: ${{ matrix.os != 'windows-latest' }}
working-directory: ${{github.workspace}}/build
run: |
./tracer ../cat-and-mouse.if ../cat-and-mouse-1.xtr > cat-and-mouse-1.txt
diff ../cat-and-mouse-1.txt cat-and-mouse-1.txt
./tracer ../cat-and-mouse.if ../cat-and-mouse-1.xtr > cat-and-mouse-cheese.txt
diff ../cat-and-mouse-cheese.txt cat-and-mouse-cheese.txt
- name: Compare Windows results with pre-recorded outputs
if: ${{ matrix.os == 'windows-latest' }}
working-directory: ${{github.workspace}}/build
run: |
${{env.BUILD_TYPE}}\tracer.exe ..\cat-and-mouse.if ..\cat-and-mouse-1.xtr > cat-and-mouse-1.txt
fc.exe /L ..\cat-and-mouse-1.txt cat-and-mouse-1.txt
${{env.BUILD_TYPE}}\tracer.exe ..\cat-and-mouse.if ..\cat-and-mouse-1.xtr > cat-and-mouse-cheese.txt
fc.exe /L ..\cat-and-mouse-cheese.txt cat-and-mouse-cheese.txt

0 comments on commit 0760000

Please sign in to comment.