File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # Copyright (c) 2023 Intercreate, Inc.
2+ # SPDX-License-Identifier: Apache-2.0
3+ #
4+ # Authors: J.P. Hutchins <jp@intercreate.io>
5+
6+ name : Release
7+ permissions :
8+ contents : write
9+
10+ on :
11+ release :
12+ types : [published]
13+
14+ jobs :
15+ release :
16+ runs-on : ubuntu-latest
17+ steps :
18+ - uses : actions/checkout@v3
19+
20+ - name : Configure & run examples
21+ run : cmake -B build
22+
23+ - name : Package source code
24+ run : cmake --build build --target package
25+
26+ - name : Add packaged source code to release
27+ uses : svenstaro/upload-release-action@v2
28+ with :
29+ repo_token : ${{ secrets.GITHUB_TOKEN }}
30+ file : build/test_cmake.zip
31+ tag : ${{ github.ref }}
Original file line number Diff line number Diff line change 1+ build
Original file line number Diff line number Diff line change 1+ # Copyright (c) 2023 Intercreate, Inc.
2+ # SPDX-License-Identifier: Apache-2.0
3+ #
4+ # Authors: J.P. Hutchins <jp@intercreate.io>
5+
6+ cmake_minimum_required (VERSION 3.20 )
7+ project (test_cmake)
8+
9+ if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR )
10+ # We're in the root, define additional targets for developers.
11+
12+ add_subdirectory (examples )
13+
14+ # generate a package for distribution
15+ # reference: https://www.foonathan.net/2022/06/cmake-fetchcontent/
16+ set (package_files test_cmake.cmake LICENSE)
17+ add_custom_command (
18+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR } /${PROJECT_NAME}.zip
19+ COMMAND ${CMAKE_COMMAND } -E tar
20+ c ${CMAKE_CURRENT_BINARY_DIR } /${PROJECT_NAME}.zip
21+ --format=zip
22+ -- ${package_files}
23+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR }
24+ DEPENDS ${package_files}
25+ )
26+ add_custom_target (package
27+ DEPENDS ${CMAKE_CURRENT_BINARY_DIR } /${PROJECT_NAME}.zip
28+ )
29+ endif ()
Original file line number Diff line number Diff line change 1+ # Copyright (c) 2023 Intercreate, Inc.
2+ # SPDX-License-Identifier: Apache-2.0
3+ #
4+ # Authors: J.P. Hutchins <jp@intercreate.io>
5+
6+ cmake_minimum_required (VERSION 3.20 )
7+ project (test_cmake_examples)
8+
9+ include (${CMAKE_CURRENT_SOURCE_DIR } /../test_cmake.cmake )
10+
11+ # Collect example folders
12+ file (GLOB examples RELATIVE ${CMAKE_CURRENT_SOURCE_DIR } ${CMAKE_CURRENT_SOURCE_DIR } /*/tests.cmake )
13+ message (STATUS "Collected examples [ ${examples} ]" )
14+
15+ # Run each example
16+ foreach (example ${examples} )
17+ execute_process (
18+ COMMAND cmake "-P" "${CMAKE_CURRENT_SOURCE_DIR } /${example} "
19+ RESULT_VARIABLE res
20+ )
21+ assert (${res} EQUAL 0 )
22+ endforeach ()
You can’t perform that action at this time.
0 commit comments