Skip to content

Commit 90769be

Browse files
committed
Devise alternative to conditional env for release-only artifacts
1 parent e0663be commit 90769be

File tree

1 file changed

+22
-14
lines changed

1 file changed

+22
-14
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,6 @@ on:
55
release:
66
types: [published]
77

8-
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
9-
if: ${{ github.event != 'release' }}
10-
env:
11-
BUILD_TYPE: Debug
12-
13-
if: ${{ github.event == 'release' }}
14-
env:
15-
BUILD_TYPE: Release
16-
178
jobs:
189
build:
1910
runs-on: ${{ matrix.os }}
@@ -39,30 +30,47 @@ jobs:
3930
# Note the current convention is to use the -S and -B options here to specify source
4031
# and build directories, but this is only available with CMake 3.13 and higher.
4132
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
42-
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX:PATH=$GITHUB_WORKSPACE/artifacts
33+
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX:PATH=$GITHUB_WORKSPACE/artifacts
4334

4435
- name: Build
4536
working-directory: ${{github.workspace}}/build
4637
shell: bash
4738
# Execute the build. You can specify a specific target with "--target <NAME>"
48-
run: cmake --build . --config $BUILD_TYPE
39+
run: cmake --build . --config Debug
4940

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

5748
- name: Install
5849
working-directory: ${{github.workspace}}/build
5950
shell: bash
6051
# Use CMake to "install" build artifacts (only interested in CMake registered targets) to our custom artifacts directory
61-
run: cmake --install . --config $BUILD_TYPE
52+
run: cmake --install . --config Debug
53+
54+
# Only run last three steps if this is a release
55+
- name: Release
56+
# if: github.event == '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
6270
6371
# Only Upload releases
6472
- name: Upload
65-
if: github.event == 'release'
73+
# if: github.event == 'release'
6674
uses: actions/upload-artifact@v2
6775
with:
6876
name: build_${{ github.sha }}_${{ matrix.os }}_${{ matrix.cxx }}

0 commit comments

Comments
 (0)