Skip to content

Commit 5ee98d6

Browse files
authored
Merge pull request #5 from saxbophone/josh/separate-release-workflow
Separate out workflows into CI / build release
2 parents b5fbb84 + c213e0d commit 5ee98d6

File tree

2 files changed

+72
-35
lines changed

2 files changed

+72
-35
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: build-release
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
build:
9+
runs-on: ${{ matrix.os }}
10+
env:
11+
BUILD_TYPE: Release
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
# specify a specific compiler to build with each OS separately
16+
include:
17+
- platform_name: linux
18+
os: ubuntu-20.04
19+
cxx: g++-10
20+
- platform_name: macos
21+
os: macos-10.15
22+
cxx: clang++
23+
# NOTE: CXX seems to be ignored on Windows, but specify it anyway for consistency
24+
- platform_name: windows
25+
os: windows-2019
26+
cxx: msvc
27+
28+
steps:
29+
- uses: actions/checkout@v2
30+
31+
- name: Configure CMake
32+
env:
33+
CXX: ${{ matrix.cxx }}
34+
# Use a bash shell so we can use the same syntax for environment variable
35+
# access regardless of the host operating system
36+
shell: bash
37+
working-directory: ${{github.workspace}}/build
38+
# Note the current convention is to use the -S and -B options here to specify source
39+
# and build directories, but this is only available with CMake 3.13 and higher.
40+
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
41+
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX:PATH=$GITHUB_WORKSPACE/artifacts
42+
43+
- name: Build
44+
working-directory: ${{github.workspace}}/build
45+
shell: bash
46+
# Execute the build. You can specify a specific target with "--target <NAME>"
47+
run: cmake --build . --config $BUILD_TYPE
48+
49+
- name: Install
50+
working-directory: ${{github.workspace}}/build
51+
shell: bash
52+
# Use CMake to "install" build artifacts (only interested in CMake registered targets) to our custom artifacts directory
53+
run: cmake --install . --config $BUILD_TYPE
54+
55+
- name: Upload
56+
uses: actions/upload-artifact@v2
57+
with:
58+
name: build_${{ github.run_number }}_${{ matrix.platform_name }}
59+
path: ${{github.workspace}}/artifacts

.github/workflows/continuous-integration.yml

Lines changed: 13 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,22 @@ name: continuous-integration
22

33
on:
44
push:
5-
release:
6-
types: [published]
5+
branches:
6+
- master
7+
pull_request:
78

89
jobs:
910
build:
1011
runs-on: ${{ matrix.os }}
12+
env:
13+
BUILD_TYPE: Debug
1114
strategy:
1215
fail-fast: false
1316
matrix:
14-
os: [macos-latest, ubuntu-20.04]
17+
os: [macos-10.15, ubuntu-20.04]
1518
cxx: [g++-10, clang++]
1619
include:
17-
- os: windows-latest
20+
- os: windows-2019
1821
cxx: msvc
1922

2023
steps:
@@ -30,48 +33,23 @@ jobs:
3033
# Note the current convention is to use the -S and -B options here to specify source
3134
# and build directories, but this is only available with CMake 3.13 and higher.
3235
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
33-
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX:PATH=$GITHUB_WORKSPACE/artifacts
36+
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX:PATH=$GITHUB_WORKSPACE/artifacts
3437

3538
- name: Build
3639
working-directory: ${{github.workspace}}/build
3740
shell: bash
3841
# Execute the build. You can specify a specific target with "--target <NAME>"
39-
run: cmake --build . --config Debug
42+
run: cmake --build . --config $BUILD_TYPE
4043

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

48-
- name: Install
51+
- name: Test Install
4952
working-directory: ${{github.workspace}}/build
5053
shell: bash
51-
# Use CMake to "install" build artifacts (only interested in CMake registered targets) to our custom artifacts directory
52-
run: cmake --install . --config Debug
53-
54-
# Only run last two steps if this is a release
55-
- name: Release
56-
if: github.event_name == 'release'
57-
env:
58-
CXX: ${{ matrix.cxx }}
59-
# Use a bash shell so we can use the same syntax for environment variable
60-
# access regardless of the host operating system
61-
shell: bash
62-
working-directory: ${{github.workspace}}/build
63-
# Note the current convention is to use the -S and -B options here to specify source
64-
# and build directories, but this is only available with CMake 3.13 and higher.
65-
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
66-
run: |
67-
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=$GITHUB_WORKSPACE/artifacts
68-
cmake --build . --config Release
69-
cmake --install . --config Release
70-
71-
# Only Upload releases
72-
- name: Upload
73-
if: github.event_name == 'release'
74-
uses: actions/upload-artifact@v2
75-
with:
76-
name: build_${{ github.sha }}_${{ matrix.os }}_${{ matrix.cxx }}
77-
path: ${{github.workspace}}/artifacts
54+
# Test install with CMake to the "artifacts" directory
55+
run: cmake --install . --config $BUILD_TYPE

0 commit comments

Comments
 (0)