Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deb Build CI #1113

Merged
merged 4 commits into from
Sep 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 22 additions & 5 deletions .github/workflows/build-deb.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
name: Build Debian Package
on:
push:
tags:
- 1.**
pull_request:
tags: [ '[0-9]+.[0-9]+.[0-9]+' ]
workflow_dispatch:
inputs:
version:
description: 'The optional semantic version number. If not supplied the branch/tag will be used.'
type: string

jobs:
package-ubuntu-latest-amd64:
Expand All @@ -22,11 +25,25 @@ jobs:
run: sudo apt install -y libssl-dev libcurl4-openssl-dev
- name: "Install building tools"
run: sudo apt install -y cmake debmake devscripts debhelper

# Set version number
- name: Set version based on input
if: ${{ inputs.version }}
run: echo "RELEASE_VERSION=${{ inputs.version }}" >> "$GITHUB_ENV"
- name: Set version based on ref
if: ${{ !inputs.version }}
run: |
mkdir -p cpr/build
pushd cpr/build
cmake .. -DCPR_BUILD_VERSION_OUTPUT_ONLY=ON
echo "RELEASE_VERSION=$(cat version.txt)" >> $GITHUB_ENV
popd
rm -rf cpr/build
- name: Print Version
run: echo "deb version will be '${{ env.RELEASE_VERSION }}'"
# Build package of runtime library
- name: "Package build of runtime library"
env:
VERSION: ${{ github.ref_name }}
VERSION: ${{ env.RELEASE_VERSION }}
run: bash cpr/package-build/build-package.sh cpr

- name: "Upload deb-packages"
Expand Down
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ cpr_option(CPR_ENABLE_CPPCHECK "Set to ON to enable Cppcheck static analysis. Re
cpr_option(CPR_BUILD_TESTS "Set to ON to build cpr tests." OFF)
cpr_option(CPR_BUILD_TESTS_SSL "Set to ON to build cpr ssl tests" ${CPR_BUILD_TESTS})
cpr_option(CPR_BUILD_TESTS_PROXY "Set to ON to build proxy tests. They fail in case there is no valid proxy server available in proxy_tests.cpp" OFF)
cpr_option(CPR_BUILD_VERSION_OUTPUT_ONLY "Set to ON to only export the version into 'build/version.txt' and exit" OFF)
cpr_option(CPR_SKIP_CA_BUNDLE_SEARCH "Skip searching for Certificate Authority certs. Turn ON for systems like iOS where file access is restricted and prevents https from working." OFF)
cpr_option(CPR_USE_BOOST_FILESYSTEM "Set to ON to use the Boost.Filesystem library. This is useful, on, e.g., Apple platforms, where std::filesystem may not always be available when targeting older OS versions." OFF)
cpr_option(CPR_DEBUG_SANITIZER_FLAG_THREAD "Enables the ThreadSanitizer for debug builds." OFF)
Expand All @@ -75,6 +76,13 @@ cpr_option(CPR_DEBUG_SANITIZER_FLAG_UB "Enables the UndefinedBehaviorSanitizer f
cpr_option(CPR_DEBUG_SANITIZER_FLAG_ALL "Enables all sanitizers for debug builds except the ThreadSanitizer since it is incompatible with the other sanitizers." OFF)
message(STATUS "=======================================================")

# Save the project version as txt file for deb and NuGet builds
if(CPR_BUILD_VERSION_OUTPUT_ONLY)
message(STATUS "Printing version and exiting...")
file(WRITE "${CMAKE_BINARY_DIR}/version.txt" "${PROJECT_VERSION}")
return()
endif()

if (CPR_FORCE_USE_SYSTEM_CURL)
message(WARNING "The variable CPR_FORCE_USE_SYSTEM_CURL is deprecated, please use CPR_USE_SYSTEM_CURL instead")
set(CPR_USE_SYSTEM_CURL ${CPR_FORCE_USE_SYSTEM_CURL})
Expand Down
4 changes: 2 additions & 2 deletions nuget/libcpr.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<projectUrl>https://github.com/libcpr</projectUrl>
<description>C++ Requests: Curl for People, a spiritual port of Python Requests.</description>
<tags>Native, native</tags>
<language>english</language>
<repository type="git" url="https://github.com/libcpr/cpr" branch="master" commit="$COMMIT_HASH$" />
<language>english</language>
<repository type="git" url="https://github.com/libcpr/cpr" branch="master" commit="$COMMIT_HASH$" />
</metadata>
</package>
Loading