Build #12
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
name: Build | |
on: | |
push: | |
branches: | |
- "*" | |
paths: | |
# This action only runs on push when C++ files are changed | |
- "**.cpp" | |
- "**.h" | |
- "**.cmake" | |
- "**Lists.txt" | |
workflow_dispatch: | |
env: | |
CPM_SOURCE_CACHE: ${{ github.workspace }}/cpm_modules | |
# Allow one concurrent build | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
name: ${{ matrix.config.name }} | |
runs-on: ${{ matrix.config.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- { | |
name: "Windows Latest - MSVC", | |
os: windows-latest, | |
cc: "cl", | |
cxx: "cl", | |
ext: ".exe", | |
buildtype: "Release", | |
} | |
- { | |
name: "Ubuntu Latest - GCC", | |
os: ubuntu-latest, | |
cc: "gcc", | |
cxx: "g++", | |
ext: "", | |
buildtype: Release, | |
} | |
- { | |
name: "MacOS Latest - Clang", | |
os: macos-latest, | |
cc: "clang", | |
cxx: "clang++", | |
ext: "", | |
buildtype: "Release", | |
} | |
steps: | |
- uses: actions/checkout@v3 | |
# on linux and mac use the ninja generator | |
- name: Install Ninja generator | |
if: runner.os != 'Windows' | |
uses: seanmiddleditch/gha-setup-ninja@master | |
- uses: actions/cache@v2 | |
with: | |
path: "**/cpm_modules" | |
key: ${{ github.workflow }}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }} | |
# Setup caching of build artifacts to reduce total build time (only Linux and MacOS) | |
- name: ccache | |
if: runner.os != 'Windows' | |
uses: hendrikmuhs/ccache-action@v1 | |
with: | |
key: ${{ matrix.config.os }}-${{ matrix.config.buildtype }} | |
- name: Install dependencies (macOS) | |
shell: bash | |
working-directory: ${{github.workspace}} | |
if: runner.os == 'macOS' | |
run: | | |
brew install openvdb | |
- name: Install dependencies (linux) | |
shell: bash | |
working-directory: ${{github.workspace}} | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt install libopenvdb-dev | |
- name: Create Build Environment | |
run: cmake -E make_directory ${{github.workspace}}/build | |
- name: Configure CMake | |
shell: bash | |
working-directory: ${{github.workspace}} | |
if: runner.os != 'Windows' | |
run: | | |
cmake -B ${{github.workspace}}/build/${{ matrix.config.buildtype }} -G Ninja -DCMAKE_BUILD_TYPE=${{ matrix.config.buildtype }} -D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache | |
- name: Configure CMake (Windows) | |
working-directory: ${{github.workspace}} | |
if: runner.os == 'Windows' | |
run: | | |
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{ matrix.config.buildtype }} | |
- name: Build | |
shell: bash | |
working-directory: ${{github.workspace}} | |
if: runner.os != 'Windows' | |
run: cmake --build ${{github.workspace}}/build/${{ matrix.config.buildtype }} --parallel 4 --config ${{ matrix.config.buildtype }} | |
- name: Build (Windows) | |
working-directory: ${{github.workspace}} | |
if: runner.os == 'Windows' | |
run: cmake --build ${{github.workspace}}/build/ --parallel 4 --config ${{ matrix.config.buildtype }} | |
- name: Testing that code runs | |
shell: bash | |
working-directory: ${{github.workspace}} | |
run: | | |
pwd | |
./build/${{ matrix.config.buildtype }}/opentonano${{matrix.ext}} # change this or add to it as we progress through the assignments |