Skip to content

Commit

Permalink
project: make cpr not a submodule
Browse files Browse the repository at this point in the history
  • Loading branch information
Toni500github committed May 16, 2024
1 parent e2a2111 commit 3d16731
Show file tree
Hide file tree
Showing 171 changed files with 20,034 additions and 5 deletions.
4 changes: 0 additions & 4 deletions .gitmodules

This file was deleted.

1 change: 0 additions & 1 deletion cpr
Submodule cpr deleted from 3b15fa
59 changes: 59 additions & 0 deletions cpr/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
Language: Cpp
# BasedOnStyle: Google
AccessModifierOffset: -2
AlignAfterOpenBracket: true
AlignEscapedNewlinesLeft: true
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AlwaysBreakAfterDefinitionReturnType: false
AlwaysBreakTemplateDeclarations: true
AlwaysBreakBeforeMultilineStrings: true
BreakBeforeBinaryOperators: None
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BinPackParameters: true
BinPackArguments: true
ColumnLimit: 500
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 8
DerivePointerAlignment: false
ExperimentalAutoDetectBinPacking: false
IndentCaseLabels: true
IndentWrappedFunctionNames: false
IndentFunctionDeclarationAfterType: false
MaxEmptyLinesToKeep: 2
KeepEmptyLinesAtTheStartOfBlocks: false
NamespaceIndentation: None
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakString: 1000
PenaltyBreakFirstLessLess: 120
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
SpacesBeforeTrailingComments: 1
Cpp11BracedListStyle: true
Standard: Auto
IndentWidth: 4
TabWidth: 8
UseTab: Never
BreakBeforeBraces: Attach
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpacesInAngles: false
SpaceInEmptyParentheses: false
SpacesInCStyleCastParentheses: false
SpaceAfterCStyleCast: true
SpacesInContainerLiterals: true
SpaceBeforeAssignmentOperators: true
ContinuationIndentWidth: 8
CommentPragmas: '^ IWYU pragma:'
SpaceBeforeParens: ControlStatements
...
41 changes: 41 additions & 0 deletions cpr/.clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
Checks: '*,
-cppcoreguidelines-pro-type-static-cast-downcast,
-fuchsia-default-arguments-calls,
-fuchsia-default-arguments,
-fuchsia-default-arguments-declarations,
-fuchsia-overloaded-operator,
-fuchsia-statically-constructed-objects,
-hicpp-use-auto,
-modernize-use-auto,
-modernize-use-trailing-return-type,
-readability-implicit-bool-conversion,
-readability-const-return-type,
-google-runtime-references,
-misc-non-private-member-variables-in-classes,
-llvm-include-order,
-cppcoreguidelines-non-private-member-variables-in-classes,
-cppcoreguidelines-pro-type-vararg,
-hicpp-vararg,
-cppcoreguidelines-owning-memory,
-llvmlibc-callee-namespace,
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
-hicpp-no-array-decay,
-modernize-pass-by-value,
-cppcoreguidelines-pro-bounds-constant-array-index,
-hicpp-signed-bitwise,
-llvmlibc-implementation-in-namespace,
-llvmlibc-restrict-system-libc-headers,
-readability-function-cognitive-complexity,
-readability-identifier-length,
-altera-unroll-loops,
-altera-id-dependent-backward-branch,
-bugprone-easily-swappable-parameters,
-modernize-return-braced-init-list,
-cppcoreguidelines-avoid-magic-numbers,
-readability-magic-numbers,
-cppcoreguidelines-avoid-do-while
'
WarningsAsErrors: '*'
HeaderFilterRegex: 'src/*.hpp'
FormatStyle: file
58 changes: 58 additions & 0 deletions cpr/.github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: "🐛 Bug report"
description: Something in cpr is not working as expected? Create a report to help us improve.
labels: ["Needs Investigation :mag:", "Bug :bug:"]
body:
- type: markdown
attributes:
value: |
Provide a general summary of the issue in the Title above.
Use Markdown to highlight and format your code!
[https://guides.github.com/pdfs/markdown-cheatsheet-online.pdf](https://guides.github.com/pdfs/markdown-cheatsheet-online.pdf)
[https://developers.google.com/blockly/guides/modify/contribute/write_a_good_issue](https://developers.google.com/blockly/guides/modify/contribute/write_a_good_issue)
⚠️⚠️ If you do not use this template, we will simply close your issue. There are no exceptions for this! These steps, especially the part at the end, are very important to solve your problem quickly and efficiently. Please remember that we are not paid to solve or even answer your issues, so we do all this work in OUR free time. ⚠️⚠️
- type: textarea
attributes:
label: Description
description: A clear and concise description of what the bug is.
placeholder: What happened? Also tell us, what did you expect to happen?
validations:
required: true
- type: textarea
attributes:
label: Example/How to Reproduce
description: "Provide a link to a live example, or an unambiguous set of steps to reproduce this bug. Include code to reproduce, if relevant."
value: |
1. Create a `cpr::Session`
2. Set option ...
3. Perform the request
4. See error
validations:
required: true
- type: textarea
attributes:
label: Possible Fix
description: A possible fix for your issue.
placeholder: Not obligatory, but suggest a fix or reason for the bug.
validations:
required: false
- type: dropdown
attributes:
label: Where did you get it from?
multiple: true
options:
- GitHub (branch e.g. master)
- vcpkg
- conan
- NuGet
- Other (specify in "Additional Context/Your Environment")
validations:
required: true
- type: textarea
attributes:
label: Additional Context/Your Environment
description: Provide some additional context for your issue and your environment your are trying to use cpr in.
value: |
- OS:
- Version:
validations:
required: true
36 changes: 36 additions & 0 deletions cpr/.github/ISSUE_TEMPLATE/feature-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: "✨ Feature request"
description: Suggest an idea for this project.
labels: ["Needs Investigation :mag:", "Feature :sparkles:"]
body:
- type: markdown
attributes:
value: |
Provide a general summary of the feature in the Title above.
Use Markdown to highlight and format your code!
[https://guides.github.com/pdfs/markdown-cheatsheet-online.pdf](https://guides.github.com/pdfs/markdown-cheatsheet-online.pdf)
[https://developers.google.com/blockly/guides/modify/contribute/write_a_good_issue](https://developers.google.com/blockly/guides/modify/contribute/write_a_good_issue)
⚠️⚠️ If you do not use this template, we will simply close your feature request. There are no exceptions for this! These steps are very important to solve your problem quickly and efficiently. Please remember that we are not paid to solve or even answer your feature requests, so we do all this work in OUR free time. ⚠️⚠️
- type: markdown
attributes:
value: |
Thanks for suggesting new features or pointing our missing functionality.
Please describe your request in detail so we can understand your ideas. Feel free to upload additional material such as mockups, diagrams, or sketches.
- type: textarea
attributes:
label: Is your feature request related to a problem?
description: Please describe. A clear and concise description of what the problem is.
placeholder: Ex. I'm always frustrated when ...
- type: textarea
attributes:
label: Possible Solution
description: Describe the solution you'd like.
validations:
required: true
- type: textarea
attributes:
label: Alternatives
description: A clear and concise description of any alternative solutions or features you've considered.
- type: textarea
attributes:
label: Additional Context
description: Add any other context or screenshots about the feature request here.
6 changes: 6 additions & 0 deletions cpr/.github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
36 changes: 36 additions & 0 deletions cpr/.github/workflows/build-deb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Build Debian Package
on:
push:
tags: [ '[0-9]+.[0-9]+.[0-9]+' ]
pull_request:

jobs:
package-ubuntu-latest-amd64:
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v3
with:
submodules: true
path: cpr

# Install packages necessary for building libcpr and package
- name: "Update package list"
run: sudo apt update
- name: "Install cpr dependencies"
run: sudo apt install -y libssl-dev libcurl4-openssl-dev
- name: "Install building tools"
run: sudo apt install -y cmake debmake devscripts debhelper

# Build package of runtime library
- name: "Package build of runtime library"
env:
VERSION: ${{ github.ref_name }}
run: bash cpr/package-build/build-package.sh cpr

- name: "Upload deb-packages"
uses: actions/upload-artifact@v3
with:
name: artifact-deb
path: ./*.deb

115 changes: 115 additions & 0 deletions cpr/.github/workflows/build-nuget.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
name: Build NuGet Package
on:
push:
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
no_publish:
description: 'Prevent publishing the NuGet package. Just build it and then upload it as an artifact.'
type: boolean
default: false

jobs:
package-windows-latest:
runs-on: windows-latest
steps:
- name: Set version based on input
if: ${{ inputs.version }}
run: echo "RELEASE_VERSION=${{ inputs.version }}" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8
- name: Set version based on ref
if: ${{ !inputs.version }}
run: echo "RELEASE_VERSION=$($env:GITHUB_REF -replace 'refs/.*/', '')" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8
- name: Print Version
run: echo "NuGet version will be '${{ env.RELEASE_VERSION }}'"
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- name: Setup NuGet.exe
uses: nuget/setup-nuget@v1
- name: "[Release_x86] Build & Install"
env:
CMAKE_GENERATOR: "Visual Studio 17 2022"
uses: ashutoshvarma/action-cmake-build@master
with:
build-dir: ${{github.workspace}}/build
source-dir: ${{github.workspace}}
build-type: Release
target: ALL_BUILD
run-test: false
configure-options: -DBUILD_SHARED_LIBS=ON -DCURL_ZLIB=OFF -A Win32
install-build: true
install-options: --prefix ${{github.workspace}}\install --config Release
- name: "[Release_x86] Copy install files for Release_x86"
run: xcopy /e /i /y ${{github.workspace}}\install ${{github.workspace}}\nuget\build\native\x86\Release && xcopy /e /i /y ${{github.workspace}}\install ${{github.workspace}}\nuget\build\native\Win32\Release
- name: "[Release_x86] Clean build"
run: rm -r -fo ${{github.workspace}}/build
- name: "[Debug_x86] Build & Install"
env:
CMAKE_GENERATOR: "Visual Studio 17 2022"
uses: ashutoshvarma/action-cmake-build@master
with:
build-dir: ${{github.workspace}}/build
source-dir: ${{github.workspace}}
build-type: Debug
target: ALL_BUILD
run-test: false
configure-options: -DBUILD_SHARED_LIBS=ON -DCURL_ZLIB=OFF -A Win32
install-build: true
install-options: --prefix ${{github.workspace}}\install --config Debug
- name: "[Debug_x86] Copy install files for Debug_x86"
run: xcopy /e /i /y ${{github.workspace}}\install ${{github.workspace}}\nuget\build\native\x86\Debug && xcopy /e /i /y ${{github.workspace}}\install ${{github.workspace}}\nuget\build\native\Win32\Debug
- name: "[Debug_x86] Clean build"
run: rm -r -fo ${{github.workspace}}/build
- name: "[Release_x64] Build & Install"
env:
CMAKE_GENERATOR: "Visual Studio 17 2022"
uses: ashutoshvarma/action-cmake-build@master
with:
build-dir: ${{github.workspace}}/build
source-dir: ${{github.workspace}}
build-type: Release
target: ALL_BUILD
run-test: false
configure-options: -DBUILD_SHARED_LIBS=ON -DCURL_ZLIB=OFF -A x64
install-build: true
install-options: --prefix ${{github.workspace}}\install --config Release
- name: "[Release_x64] Copy install files for Release_x64"
run: xcopy /e /i /y ${{github.workspace}}\install ${{github.workspace}}\nuget\build\native\x64\Release
- name: "[Release_x64] Clean build"
run: rm -r -fo ${{github.workspace}}/build
- name: "[Debug_x64] Build & Install"
env:
CMAKE_GENERATOR: "Visual Studio 17 2022"
uses: ashutoshvarma/action-cmake-build@master
with:
build-dir: ${{github.workspace}}/build
source-dir: ${{github.workspace}}
build-type: Debug
target: ALL_BUILD
run-test: false
configure-options: -DBUILD_SHARED_LIBS=ON -DCURL_ZLIB=OFF -A x64
install-build: true
install-options: --prefix ${{github.workspace}}\install --config Debug
- name: "[Debug_x64] Copy install files for Debug_x64"
run: xcopy /e /i /y ${{github.workspace}}\install ${{github.workspace}}\nuget\build\native\x64\Debug
- name: "Copy Readme.md"
run: xcopy /y ${{github.workspace}}\README.md ${{github.workspace}}\nuget
- name: "Create NuGet package"
env:
VERSION: ${{ env.RELEASE_VERSION }}
COMMIT_HASH: ${{ github.sha }}
run: nuget pack ${{github.workspace}}\nuget\libcpr.nuspec -OutputDirectory ${{github.workspace}} -Properties "VERSION=$ENV:VERSION;COMMIT_HASH=$ENV:COMMIT_HASH"
- name: "Upload artifact"
uses: actions/upload-artifact@v3
with:
name: artifact-nuget
path: ${{github.workspace}}\*.nupkg
- name: "Publish package to NuGet.org"
if: ${{ !inputs.no_publish }}
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
run: nuget push ${{github.workspace}}\*.nupkg $ENV:NUGET_API_KEY -Source https://api.nuget.org/v3/index.json
Loading

0 comments on commit 3d16731

Please sign in to comment.