diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 55f46b5..c8d1970 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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