Skip to content

Merge pull request #1913 from gforney/master #27

Merge pull request #1913 from gforney/master

Merge pull request #1913 from gforney/master #27

Workflow file for this run

name: CMake Build
on: [push, pull_request]
env:
CACHE_NUMBER: 2
COMPILER_VERSION: 2022.0.3
BUILD_TYPE: Release
jobs:
build_unix_gcc:
# Set the name of this build, variable depending on the OS and whether it
# includes the lua engine
name: build ${{ matrix.os }} - lua=${{ matrix.lua }} - gcc
strategy:
fail-fast: false
# The matrix sets all the different combinations of builds, e.g. platforms
# and build configurations
matrix:
os:
- ubuntu-latest
- macos-latest
lua:
- on
- off
# Set the platform to build on
runs-on: ${{ matrix.os }}
steps:
# Check out the smv repo
- name: Checkout code
uses: actions/checkout@v3
# If we are currently building on Linux (ubuntu) install all the native
# pre-requisites
- name: Install linux deps
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install build-essential freeglut3-dev libx11-dev libxmu-dev libxi-dev libglew-dev libgd-dev liblua5.4-dev libjson-c-dev
# If we are building on macos configure the environment to use gcc11 as
# the compiler
- name: set macos gcc
if: runner.os == 'macOS'
shell: bash
run: |
echo "CC=gcc-11" >> $GITHUB_ENV
echo "CXX=g++-11" >> $GITHUB_ENV
brew install glew lua gd zlib json-c
# If we are building on linux configure the environment to use gcc as the
# compiler
- name: set linux gcc
if: runner.os == 'Linux'
shell: bash
run: |
echo "CC=gcc" >> $GITHUB_ENV
echo "CXX=g++" >> $GITHUB_ENV
# Download a snaphot of the fig repo and use that as test data.
- name: Download test data
working-directory: ${{github.workspace}}/Tests
run: ./get_test_data.sh
# Remove Visualization data on macos as we can't render currently.
- name: Download test data
if: runner.os == 'macOS'
run: rm -rf Verification/Visualization/*.smv
# Run cmake to build smokeview
- name: Build
shell: bash
run: |
cmake -B ${{github.workspace}}/cbuild -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DLUA=${{ matrix.lua }}
cmake --build ${{github.workspace}}/cbuild -j4
cp ${{github.workspace}}/cbuild/smokeview smokeview
# Run the CMake-based tests on MacOS
- name: Test
if: runner.os == 'macOS'
shell: bash
run: |
ctest --test-dir cbuild -j10 --output-on-failure -V
# Run the CMake-based tests on Linux
- name: Test
if: runner.os == 'Linux'
shell: bash
run: |
xvfb-run ctest --test-dir cbuild -j10 --output-on-failure -V
# Set a suffix based on whether lua is included
- name: Set exec suffix
if: ${{ matrix.lua }}
run: echo "exec_suffix=-lua" >> $GITHUB_ENV
# Archive the smokeview executable
- name: Archive production artifacts
uses: actions/upload-artifact@v3
with:
name: smokeview-${{ runner.os }}-${{ env.exec_suffix }}
path: smokeview
build_unix_rpm_gcc:
name: build (rpm) ${{ matrix.os }} - lua=${{ matrix.lua }} - gcc
runs-on: ubuntu-latest
container: centos:7
strategy:
fail-fast: false
matrix:
lua:
- on
- off
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install linux deps
run: |
yum -y install epel-release
yum -y install cmake3
yum -y install make gcc-c++ mesa-libGL-devel glut-devel libjpeg-devel libpng-devel gd-devel glew-devel libXmu-devel libXi-devel lua-devel json-c-devel
yum -y install wget unzip git
- name: set gcc
shell: bash
run: |
echo "CC=gcc" >> $GITHUB_ENV
echo "CXX=g++" >> $GITHUB_ENV
- name: Build
shell: bash
run: |
pkg-config --cflags json-c
cmake3 -B ${{github.workspace}}/cbuild -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DLUA=${{ matrix.lua }}
cmake3 --build ${{github.workspace}}/cbuild -j4
cp ${{github.workspace}}/cbuild/smokeview smokeview
# - name: Download test data
# working-directory: ${{github.workspace}}/Tests
# run: ./get_test_data.sh
# - name: Test
# shell: bash
# working-directory: ${{github.workspace}}/cbuild
# run: |
# ctest -j10 --output-on-failure -V
- name: Set exec suffix
if: ${{ matrix.lua }}
run: echo "exec_suffix=-lua" >> $GITHUB_ENV
- name: Archive production artifacts
uses: actions/upload-artifact@v3
with:
name: smokeview-${{ runner.os }}-${{ env.exec_suffix }}
path: smokeview
build_windows_msvc:
name: build ${{ matrix.os }} - lua=${{ matrix.lua }} - msvc
strategy:
fail-fast: false
matrix:
os:
- windows-2022
lua:
- on
- off
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Pin vcpkg version
run: |
cd C:\vcpkg
git fetch
git checkout 2024.03.25
- name: build smokeview
shell: cmd
run: |
cmake --version
cmake -B ${{github.workspace}}\cbuild -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DLUA_UTIL_LIBS=ON -DLUA=${{ matrix.lua }} -DLUA_BUILD_BINARY=${{ matrix.lua }} -DVCPKG_TARGET_TRIPLET=x64-windows-static -DCMAKE_TOOLCHAIN_FILE=%VCPKG_INSTALLATION_ROOT%/scripts/buildsystems/vcpkg.cmake -DLUA_BUILD_BINARY=ON
cmake --build ${{github.workspace}}\cbuild -j4 --config ${{env.BUILD_TYPE}}
copy ${{github.workspace}}\cbuild\Release\smokeview.exe smokeview.exe
- name: Download test data
working-directory: ${{github.workspace}}/Tests
shell: pwsh
run: .\get_test_data.ps1
- name: Test
shell: bash
working-directory: ${{github.workspace}}/cbuild
env:
LUA: ${{ matrix.lua }}
run: |
ctest -j10 -C ${{env.BUILD_TYPE}} --output-on-failure
- name: Set exec suffix
if: ${{ matrix.lua }}
run: echo "exec_suffix=-lua" >> $GITHUB_ENV
- name: Archive production artifacts
uses: actions/upload-artifact@v3
with:
name: smokeview-windows-msvc-${{ env.exec_suffix }}
path: smokeview.exe