Merge pull request #15 from dbhart/patch-1 #48
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
# 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-13, 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 | |
run_alias: Linux | |
- os: macos-13 | |
cmake_generator: -G "Xcode" | |
continue-on-error: false | |
alias: intel-mac | |
run_alias: Darwin | |
- os: macos-latest | |
cmake_generator: -G "Xcode" | |
continue-on-error: false | |
alias: apple-silicon | |
run_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' || matrix.os == 'macos-13' }} | |
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.run_alias }}/ZIP/EPANETMSX-${{ env.BuildVersion }}-${{ matrix.run_alias }}/bin/runepanet | |
chmod +x ./build/_CPack_Packages/${{ matrix.run_alias }}/ZIP/EPANETMSX-${{ env.BuildVersion }}-${{ matrix.run_alias }}/bin/runepanetmsx | |
./build/_CPack_Packages/${{ matrix.run_alias }}/ZIP/EPANETMSX-${{ env.BuildVersion }}-${{ matrix.run_alias }}/bin/runepanetmsx ./Examples/example.inp ./Examples/example.msx ./Examples/example.rpt ./Examples/example.out | |
- name: Qualify darwin artifacts with os versions | |
if: matrix.os == 'macos-13' || matrix.os == 'macos-14' | |
run: | | |
cd build | |
for file in *.zip; do mv "$file" "${file%.zip}-${{ matrix.alias }}.zip"; done | |
for file in *.tar.gz; do mv "$file" "${file%.tar.gz}-${{ matrix.alias }}.tar.gz"; done | |
cd .. | |
- name: Upload artifacts | |
if: ${{ always() }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build-test-artifacts | |
path: | | |
build/*.zip | |
build/*.tar.gz |