diff --git a/.github/workflows/analysis.yaml b/.github/workflows/analysis.yaml new file mode 100644 index 00000000..aa23de7b --- /dev/null +++ b/.github/workflows/analysis.yaml @@ -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 diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 4c76c465..5aed7305 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -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 @@ -28,4 +29,4 @@ jobs: ./configure --enable-coverage - name: run tests - run: make ci + run: make test diff --git a/Makefile.am b/Makefile.am index 0ee77e68..d00c7463 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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)" ] || \ @@ -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 diff --git a/source/connection.cc b/source/connection.cc index e0dcbb7a..1a8e75e6 100644 --- a/source/connection.cc +++ b/source/connection.cc @@ -8,11 +8,12 @@ #include +#include #include -#include #include #include #include +#include #include #include "restclient-cpp/restclient.h" @@ -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* @@ -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* diff --git a/source/helpers.cc b/source/helpers.cc index aa51bf58..e9b13fd6 100644 --- a/source/helpers.cc +++ b/source/helpers.cc @@ -7,6 +7,7 @@ #include "restclient-cpp/helpers.h" #include +#include #include "restclient-cpp/restclient.h" diff --git a/source/restclient.cc b/source/restclient.cc index ed0fe861..30ee3953 100644 --- a/source/restclient.cc +++ b/source/restclient.cc @@ -17,6 +17,8 @@ #if __cplusplus >= 201402L #include #endif +#include + #include "restclient-cpp/version.h" #include "restclient-cpp/connection.h"