Skip to content

Merge pull request #13 from ucchejbb/master #43

Merge pull request #13 from ucchejbb/master

Merge pull request #13 from ucchejbb/master #43

# This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform.
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml
name: Build and Test MSX
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
name: Build, Unit Testing, and Regression Testing
environment: testing
env:
BuildVersion: 2.0.0
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
include:
- os: windows-latest
cmake_generator: -G "Visual Studio 17 2022" -A "x64"
continue-on-error: false
alias: win64
- os: ubuntu-latest
cmake_generator: -G "Unix Makefiles"
continue-on-error: false
alias: Linux
- os: macos-latest
cmake_generator: -G "Xcode"
continue-on-error: false
alias: Darwin
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.continue-on-error }}
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
submodules: true
- name: Build OpenMP Binaries for MacOS via Homebrew
if: ${{ matrix.os == 'macos-latest' }}
run: |
brew reinstall --build-from-source --formula ./shell/apple/libomp.rb
- name: Build
# 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 build ${{ matrix.cmake_generator }} .
cmake --build build --config Release --target package
- name: Run Example on Windows
# 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
if: ${{ matrix.os == 'windows-latest' }}
run: |
./build/_CPack_Packages/${{ matrix.alias }}/ZIP/EPANETMSX-${{ env.BuildVersion }}-${{ matrix.alias }}/bin/runepanetmsx ./Examples/example.inp ./Examples/example.msx ./Examples/example.rpt ./Examples/example.out
- name: Run Example on Linux and MacOS
# 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
if: ${{ matrix.os != 'windows-latest' }}
run: |
chmod +x ./build/_CPack_Packages/${{ matrix.alias }}/ZIP/EPANETMSX-${{ env.BuildVersion }}-${{ matrix.alias }}/bin/runepanet
chmod +x ./build/_CPack_Packages/${{ matrix.alias }}/ZIP/EPANETMSX-${{ env.BuildVersion }}-${{ matrix.alias }}/bin/runepanetmsx
./build/_CPack_Packages/${{ matrix.alias }}/ZIP/EPANETMSX-${{ env.BuildVersion }}-${{ matrix.alias }}/bin/runepanetmsx ./Examples/example.inp ./Examples/example.msx ./Examples/example.rpt ./Examples/example.out
- name: Upload artifacts
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: build-test-artifacts
path: |
build/*.zip
build/*.tar.gz