roll up things into functions #7
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
# based on https://raw.githubusercontent.com/saxbophone/CPP20-Cross-Platform-Template/master/.github/workflows/build-release.yml | |
name: build-release | |
on: | |
[push, pull_request, release] | |
jobs: | |
build-release: | |
runs-on: ${{ matrix.os }} | |
env: | |
BUILD_TYPE: Release | |
strategy: | |
fail-fast: false | |
matrix: | |
# specify a specific compiler to build with each OS separately | |
include: | |
- platform_name: linux | |
os: ubuntu-20.04 | |
c: gcc | |
- platform_name: macos | |
os: macos-10.15 | |
c: clang | |
- platform_name: windows | |
os: windows-2019 | |
c: cl | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Configure CMake | |
env: | |
CXX: ${{ matrix.cxx }} | |
# Use a bash shell so we can use the same syntax for environment variable | |
# access regardless of the host operating system | |
shell: bash | |
working-directory: ${{github.workspace}}/build | |
# Note the current convention is to use the -S and -B options here to specify source | |
# and build directories, but this is only available with CMake 3.13 and higher. | |
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12 | |
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX:PATH=$GITHUB_WORKSPACE/artifacts | |
- name: Build | |
working-directory: ${{github.workspace}}/build | |
shell: bash | |
# Execute the build. You can specify a specific target with "--target <NAME>" | |
run: cmake --build . --config $BUILD_TYPE | |
- name: Install | |
working-directory: ${{github.workspace}}/build | |
shell: bash | |
# Use CMake to "install" build artifacts (only interested in CMake registered targets) to our custom artifacts directory | |
run: cmake --install . --config $BUILD_TYPE | |
- name: Upload | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ds3mhe_build_${{ github.run_number }}_${{ matrix.platform_name }} | |
path: ${{github.workspace}}/artifacts |