Skip to content

Commit

Permalink
Merge pull request #5 from saxbophone/josh/separate-release-workflow
Browse files Browse the repository at this point in the history
Separate out workflows into CI / build release
  • Loading branch information
saxbophone authored Jan 24, 2021
2 parents b5fbb84 + c213e0d commit 5ee98d6
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 35 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: build-release

on:
release:
types: [published]

jobs:
build:
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
cxx: g++-10
- platform_name: macos
os: macos-10.15
cxx: clang++
# NOTE: CXX seems to be ignored on Windows, but specify it anyway for consistency
- platform_name: windows
os: windows-2019
cxx: msvc

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: build_${{ github.run_number }}_${{ matrix.platform_name }}
path: ${{github.workspace}}/artifacts
48 changes: 13 additions & 35 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,22 @@ name: continuous-integration

on:
push:
release:
types: [published]
branches:
- master
pull_request:

jobs:
build:
runs-on: ${{ matrix.os }}
env:
BUILD_TYPE: Debug
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-20.04]
os: [macos-10.15, ubuntu-20.04]
cxx: [g++-10, clang++]
include:
- os: windows-latest
- os: windows-2019
cxx: msvc

steps:
Expand All @@ -30,48 +33,23 @@ jobs:
# 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=Debug -DCMAKE_INSTALL_PREFIX:PATH=$GITHUB_WORKSPACE/artifacts
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 Debug
run: cmake --build . --config $BUILD_TYPE

- name: Test
working-directory: ${{github.workspace}}/build
shell: bash
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C Debug
run: ctest -C $BUILD_TYPE

- name: Install
- name: Test 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 Debug

# Only run last two steps if this is a release
- name: Release
if: github.event_name == 'release'
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=Release -DCMAKE_INSTALL_PREFIX:PATH=$GITHUB_WORKSPACE/artifacts
cmake --build . --config Release
cmake --install . --config Release
# Only Upload releases
- name: Upload
if: github.event_name == 'release'
uses: actions/upload-artifact@v2
with:
name: build_${{ github.sha }}_${{ matrix.os }}_${{ matrix.cxx }}
path: ${{github.workspace}}/artifacts
# Test install with CMake to the "artifacts" directory
run: cmake --install . --config $BUILD_TYPE

0 comments on commit 5ee98d6

Please sign in to comment.