Skip to content

Commit

Permalink
Add .deb and .tar.gz releases to the release pipeline
Browse files Browse the repository at this point in the history
Add CPack Configuration to CMakeLists.txt
New package build stage in release.yml
Minor fixes in the Arch PKGBUILD script
  • Loading branch information
fabian-jung committed Aug 9, 2023
1 parent 399900d commit 46fa80b
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 11 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ctest_pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
sudo apt-get install -y software-properties-common
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get install -y gcc-11 g++-11 clang-14 libclang-cpp14-dev libclang-14-dev ninja-build
sudo apt-get install curl zip unzip tar pkg-config python3.10-venv flex bison
sudo apt-get install -y curl zip unzip tar pkg-config python3.10-venv flex bison
- name: Checkout repository
uses: actions/checkout@v3
Expand Down Expand Up @@ -75,8 +75,8 @@ jobs:
sudo apt-get install -y software-properties-common
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get install -y gcc-11 g++-11 clang-14 libclang-cpp14-dev libclang-14-dev ninja-build
sudo apt-get install curl zip unzip tar pkg-config python3.10-venv flex bison git
sudo apt-get install -y curl zip unzip tar pkg-config python3.10-venv flex bison git
- name: Set SHA to fetch
run: echo "SHA=${{github.event.pull_request.head.sha}}" >> $GITHUB_ENV
if: ${{ github.event_name == 'pull_request'}}
Expand Down
38 changes: 37 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,40 @@ jobs:
- name: publish release
run: gh release create v${{github.event.inputs.version}} -t v${{github.event.inputs.version}} --target ${{github.event.inputs.branch}} --notes "${{github.event.inputs.changelog}}" --latest
run: gh release create v${{github.event.inputs.version}} -t v${{github.event.inputs.version}} --target ${{github.event.inputs.branch}} --notes "${{github.event.inputs.changelog}}" --latest

package:
runs-on: ubuntu-22.04
needs: release
steps:
- name: install deps
run: |
sudo apt-get update -y
sudo apt-get install -y software-properties-common
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get install -y clang-14 libclang-cpp14-dev libclang-14-dev ninja-build
sudo apt-get install -y curl zip unzip tar pkg-config python3.10-venv flex bison
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: 'recursive'

- name: Restore artifacts, or setup vcpkg (do not install any package)
uses: lukka/run-vcpkg@v10
with:
vcpkgDirectory: '${{ github.workspace }}/vendor/vcpkg'

- name: Run CMake consuming CMakePreset.json and vcpkg.json by mean of vcpkg.
uses: lukka/run-cmake@v10
with:
cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'
configurePreset: 'clang-fetch_content-release'
buildPreset: 'clang-fetch_content-release'

- name: Upload artifacts to the release
run: |
cd tsmp/build-fetch_content
cpack
gh release upload v${{github.event.inputs.version}} tsmp-${{github.event.inputs.version}}-Linux.tgz tsmp-${{github.event.inputs.version}}-Linux.deb --clobber
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,16 @@ if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
install(TARGETS introspect_tool RUNTIME DESTINATION bin)
install(FILES cmake/tsmpConfig.cmake DESTINATION lib/cmake/tsmp)
install(DIRECTORY include/tsmp DESTINATION include FILES_MATCHING PATTERN "*.h*")

include(InstallRequiredSystemLibraries)
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
set(CPACK_PACKAGE_VERSION_MAJOR "${tsmp_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${tsmp_VERSION_MINOR}")
set(CPACK_PACKAGE_CONTACT "Fabian Jung<git@fabian-jung.net>")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "")
set(CPACK_GENERATOR "DEB;TGZ")
include(CPack)

else()
message(STATUS "Detected configuration of tsmp as part of a larger project. Not building examples and tests. Manually set optimisation level to 3 for the introspection tool.")
if(MSVC)
Expand All @@ -59,4 +69,5 @@ else()
target_compile_options(introspect_lib PRIVATE "-O3")
target_compile_options(introspect_tool PRIVATE "-O3")
endif()

endif()
9 changes: 2 additions & 7 deletions scripts/package/arch/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,12 @@ pkgdesc='C++ Reflection Library'
arch=('x86_64')
url='https://github.com/fabian-jung/tsmp'
license=('MIT')
depends=('gcc' 'fmt')
depends=('gcc' 'fmt' 'clang' 'llvm-libs' 'range-v3' 'nlohmann-json')
checkdepends=('catch2')
optdepends=()

build() {
cmake \
-B build \
-S ../../.. \
-DCMAKE_BUILD_TYPE:STRING='RelWithDebInfo' \
-DCMAKE_CXX_COMPILER=g++ \
-DCMAKE_C_COMPILER=gcc
cmake -B build -S ../../../.. -DCMAKE_BUILD_TYPE:STRING='RelWithDebInfo' -DCMAKE_CXX_COMPILER=clang++
cmake --build build --parallel 32 --target all
}

Expand Down

0 comments on commit 46fa80b

Please sign in to comment.