Skip to content
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
51 changes: 51 additions & 0 deletions .github/workflows/analysis.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: analysis

on:
workflow_dispatch:
pull_request:
types: [opened, synchronize]


jobs:
cpplint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: install dependencies
run: |
pip install cpplint
sudo apt-get update
sudo apt-get install -qq valgrind libcurl4-openssl-dev

- name: build
run: |
./autogen.sh
./configure --enable-coverage

- name: run cpplint
run: make lint

valgrind:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: install dependencies
run: |
pip install cpplint
sudo apt-get update
sudo apt-get install -qq valgrind libcurl4-openssl-dev

- name: build googletest
run: ./utils/build_gtest.sh

- name: build
run: |
./autogen.sh
./configure --enable-coverage

- name: run valgrind
run: make valgrind
3 changes: 2 additions & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
- name: install dependencies
run: |
pip install cpplint
sudo apt-get update
sudo apt-get install -qq valgrind libcurl4-openssl-dev

- name: build googletest
Expand All @@ -28,4 +29,4 @@ jobs:
./configure --enable-coverage

- name: run tests
run: make ci
run: make test
11 changes: 7 additions & 4 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,16 @@ include/restclient-cpp/version.h:
test: check docker-services
./test-program

valgrind: check
valgrind: check docker-services
valgrind --leak-check=full --error-exitcode=1 ./test-program

# Filter reasons:
# legal/copyright: it's just maintenance overhead to have license headers
# in all files
# whitespace/indent_namespace: it makes code less readable if indentations
# in namespaces are not allowed
lint:
cpplint --filter=-legal/copyright --root=$(CURDIR) include/restclient-cpp/*.h source/*.cc
cpplint --filter="-legal/copyright,-whitespace/indent_namespace" --root=$(CURDIR) include/restclient-cpp/*.h source/*.cc

docker-services:
[ -n "$$(docker ps --quiet --filter name=restclient-cpp-httpbin)" ] || \
Expand All @@ -44,8 +49,6 @@ clean-docker-services:
docker rm --force restclient-cpp-httpbin 2>/dev/null || true
docker rm --force restclient-cpp-squid 2>/dev/null || true

ci: test valgrind

clean-local:
find . -name "*.gcda" -print0 | xargs -0 rm

Expand Down
7 changes: 4 additions & 3 deletions source/connection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@

#include <curl/curl.h>

#include <algorithm>
#include <cstring>
#include <string>
#include <iostream>
#include <map>
#include <stdexcept>
#include <string>
#include <utility>

#include "restclient-cpp/restclient.h"
Expand Down Expand Up @@ -378,7 +379,7 @@ RestClient::Connection::performCurlRequest(const std::string& uri) {
*
* @param uri URI to query
* @param ret Reference to the response struct that should be filled
*
*
* @return reference to response struct for chaining
*/
RestClient::Response*
Expand Down Expand Up @@ -571,7 +572,7 @@ RestClient::Connection::get(const std::string& url) {
*
* @param url to query
* @param response struct
*
*
* @return response struct ref for chaining
*/
RestClient::Response*
Expand Down
1 change: 1 addition & 0 deletions source/helpers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "restclient-cpp/helpers.h"

#include <cstring>
#include <string>

#include "restclient-cpp/restclient.h"

Expand Down
2 changes: 2 additions & 0 deletions source/restclient.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#if __cplusplus >= 201402L
#include <memory>
#endif
#include <string>


#include "restclient-cpp/version.h"
#include "restclient-cpp/connection.h"
Expand Down