Skip to content

Commit d3a403d

Browse files
authored
Merge pull request #193 from mrtazz/add-actions-build
add unit test actions workflow
2 parents f3ce532 + ed8a1b2 commit d3a403d

File tree

329 files changed

+84688
-76740
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

329 files changed

+84688
-76740
lines changed

.github/workflows/tests.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: test
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
types: [opened, synchronize]
7+
8+
9+
jobs:
10+
unit:
11+
name: unit
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v3
16+
17+
- name: install dependencies
18+
run: |
19+
pip install cpplint
20+
sudo apt-get install -qq valgrind libcurl4-openssl-dev
21+
22+
- name: build googletest
23+
run: ./utils/build_gtest.sh
24+
25+
- name: build
26+
run: |
27+
./autogen.sh
28+
./configure --enable-coverage
29+
30+
- name: run tests
31+
run: make ci

.travis.yml

Lines changed: 0 additions & 44 deletions
This file was deleted.

Makefile.am

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,21 @@ BUILT_SOURCES = include/restclient-cpp/version.h
66

77
test_program_SOURCES = vendor/jsoncpp-0.10.5/dist/jsoncpp.cpp test/tests.cpp test/test_helpers.cc test/test_restclient.cc test/test_connection.cc
88
test_program_LDADD = .libs/librestclient-cpp.a
9-
test_program_LDFLAGS=-Lvendor/gtest-1.7.0/lib/.libs -lgtest
10-
test_program_CPPFLAGS=-std=c++11 -Iinclude -Ivendor/gtest-1.7.0/include -Ivendor/jsoncpp-0.10.5/dist
9+
test_program_LDFLAGS=-Lvendor/googletest-1.14.0/lib -lgtest
10+
test_program_CPPFLAGS=-std=c++14 -Iinclude -Ivendor/googletest-1.14.0/googletest/include -Ivendor/jsoncpp-0.10.5/dist
1111

1212
lib_LTLIBRARIES=librestclient-cpp.la
1313
librestclient_cpp_la_SOURCES=source/restclient.cc source/connection.cc source/helpers.cc
14-
librestclient_cpp_la_CXXFLAGS=-fPIC -std=c++11
14+
librestclient_cpp_la_CXXFLAGS=-fPIC -std=c++14
1515
librestclient_cpp_la_LDFLAGS=-version-info 2:1:1
1616

1717
dist_doc_DATA = README.md
1818

1919
.PHONY: test check clean-coverage-files coverage-html include/restclient-cpp/version.h lint ci docker-services clean-docker-services
2020

2121
include/restclient-cpp/version.h:
22-
m4 -I ${top_srcdir}/m4 -DM4_RESTCLIENT_VERSION=$(PACKAGE_VERSION) version.h.m4 > ${top_srcdir}/$@
23-
22+
m4 -I ${top_srcdir}/m4 -DM4_RESTCLIENT_VERSION=$(PACKAGE_VERSION) version.h.m4 > ${top_srcdir}/$@
23+
2424

2525

2626
test: check docker-services

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# REST client for C++
2-
[![Build Status](https://travis-ci.org/mrtazz/restclient-cpp.svg?branch=master)](https://travis-ci.org/mrtazz/restclient-cpp)
2+
![build status](https://github.com/mrtazz/restclient-cpp/actions/workflows/tests.yaml/badge.svg)
33
[![Coverage Status](https://coveralls.io/repos/mrtazz/restclient-cpp/badge.svg?branch=master&service=github)](https://coveralls.io/github/mrtazz/restclient-cpp?branch=master)
44
[![Packagecloud](https://img.shields.io/badge/packagecloud-available-brightgreen.svg)](https://packagecloud.io/mrtazz/restclient-cpp)
55
[![doxygen](https://img.shields.io/badge/doxygen-reference-blue.svg)](http://code.mrtazz.com/restclient-cpp/ref/)
@@ -161,7 +161,7 @@ reuse connections][curl_keepalive] made with that handle.
161161

162162
### Progress callback
163163

164-
Two wrapper functions are provided to setup the progress callback for uploads/downloads.
164+
Two wrapper functions are provided to setup the progress callback for uploads/downloads.
165165

166166
Calling `conn->SetFileProgressCallback(callback)` with a callback parameter matching the prototype `int progress_callback(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow)` will setup the progress callback.
167167

test/test_restclient.cc

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ TEST_F(RestClientTest, TestRestClientDELETEFailureCode)
5252
{
5353
std::string u = RestClient::TestNonExistantUrl;
5454
RestClient::Response res = RestClient::del(u);
55-
// 6 = CURLE_COULDNT_RESOLVE_HOST
55+
// 6 = CURLE_COULDNT_RESOLVE_HOST
5656
EXPECT_EQ(6, res.code);
5757
}
5858

@@ -71,8 +71,9 @@ TEST_F(RestClientTest, TestRestClientGETCode)
7171

7272
TEST_F(RestClientTest, TestRestClientGETHTTP2Code)
7373
{
74-
RestClient::Response res = RestClient::get("https://http2.golang.org/reqinfo");
75-
EXPECT_EQ(200, res.code);
74+
// the endpoint does a redirect now
75+
RestClient::Response res = RestClient::get("https://http2.golang.org");
76+
EXPECT_EQ(302, res.code);
7677
}
7778

7879
TEST_F(RestClientTest, TestRestClientGETBodyCode)
@@ -92,7 +93,7 @@ TEST_F(RestClientTest, TestRestClientGETFailureCode)
9293
std::string u = RestClient::TestNonExistantUrl;
9394
RestClient::Response res = RestClient::get(u);
9495
EXPECT_EQ("Couldn't resolve host name", res.body);
95-
// 6 = CURLE_COULDNT_RESOLVE_HOST
96+
// 6 = CURLE_COULDNT_RESOLVE_HOST
9697
EXPECT_EQ(6, res.code);
9798
}
9899

@@ -126,7 +127,7 @@ TEST_F(RestClientTest, TestRestClientPOSTFailureCode)
126127
{
127128
std::string u = RestClient::TestNonExistantUrl;
128129
RestClient::Response res = RestClient::post(u, "text/text", "data");
129-
// 6 = CURLE_COULDNT_RESOLVE_HOST
130+
// 6 = CURLE_COULDNT_RESOLVE_HOST
130131
EXPECT_EQ(6, res.code);
131132
}
132133

@@ -160,7 +161,7 @@ TEST_F(RestClientTest, TestRestClientPUTFailureCode)
160161
{
161162
std::string u = RestClient::TestNonExistantUrl;
162163
RestClient::Response res = RestClient::put(u, "text/text", "data");
163-
// 6 = CURLE_COULDNT_RESOLVE_HOST
164+
// 6 = CURLE_COULDNT_RESOLVE_HOST
164165
EXPECT_EQ(6, res.code);
165166
}
166167

@@ -194,7 +195,7 @@ TEST_F(RestClientTest, TestRestClientPATCHFailureCode)
194195
{
195196
std::string u = RestClient::TestNonExistantUrl;
196197
RestClient::Response res = RestClient::patch(u, "text/text", "data");
197-
// 6 = CURLE_COULDNT_RESOLVE_HOST
198+
// 6 = CURLE_COULDNT_RESOLVE_HOST
198199
EXPECT_EQ(6, res.code);
199200
}
200201

@@ -209,6 +210,7 @@ TEST_F(RestClientTest, TestRestClientPATCHHeaders)
209210
// Disabled as httpbin does not support options requests for now
210211
TEST_F(RestClientTest, TestRestClientOPTIONSCode)
211212
{
213+
GTEST_SKIP();
212214
RestClient::Response res = RestClient::options("https://api.reqbin.com/api/v1/requests");
213215
EXPECT_EQ(200, res.code);
214216
}
@@ -218,7 +220,7 @@ TEST_F(RestClientTest, TestRestClientOPTIONSFailureCode)
218220
{
219221
std::string u = RestClient::TestNonExistantUrl;
220222
RestClient::Response res = RestClient::options(u);
221-
// 6 = CURLE_COULDNT_RESOLVE_HOST
223+
// 6 = CURLE_COULDNT_RESOLVE_HOST
222224
EXPECT_EQ(6, res.code);
223225
}
224226

utils/build_gtest.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
#!/bin/sh
2-
cd vendor/gtest-1.7.0
3-
autoreconf -i
4-
./configure
5-
2+
cd vendor/googletest-1.14.0
3+
cmake .
64
which -s gmake && gmake || make
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Run manually to reformat a file:
2+
# clang-format -i --style=file <file>
3+
Language: Cpp
4+
BasedOnStyle: Google
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Bug Report
2+
description: Let us know that something does not work as expected.
3+
title: "[Bug]: Please title this bug report"
4+
body:
5+
- type: textarea
6+
id: what-happened
7+
attributes:
8+
label: Describe the issue
9+
description: What happened, and what did you expect to happen?
10+
validations:
11+
required: true
12+
- type: textarea
13+
id: steps
14+
attributes:
15+
label: Steps to reproduce the problem
16+
description: It is important that we are able to reproduce the problem that you are experiencing. Please provide all code and relevant steps to reproduce the problem, including your `BUILD`/`CMakeLists.txt` file and build commands. Links to a GitHub branch or [godbolt.org](https://godbolt.org/) that demonstrate the problem are also helpful.
17+
validations:
18+
required: true
19+
- type: textarea
20+
id: version
21+
attributes:
22+
label: What version of GoogleTest are you using?
23+
description: Please include the output of `git rev-parse HEAD` or the GoogleTest release version number that you are using.
24+
validations:
25+
required: true
26+
- type: textarea
27+
id: os
28+
attributes:
29+
label: What operating system and version are you using?
30+
description: If you are using a Linux distribution please include the name and version of the distribution as well.
31+
validations:
32+
required: true
33+
- type: textarea
34+
id: compiler
35+
attributes:
36+
label: What compiler and version are you using?
37+
description: Please include the output of `gcc -v` or `clang -v`, or the equivalent for your compiler.
38+
validations:
39+
required: true
40+
- type: textarea
41+
id: buildsystem
42+
attributes:
43+
label: What build system are you using?
44+
description: Please include the output of `bazel --version` or `cmake --version`, or the equivalent for your build system.
45+
validations:
46+
required: true
47+
- type: textarea
48+
id: additional
49+
attributes:
50+
label: Additional context
51+
description: Add any other context about the problem here.
52+
validations:
53+
required: false
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Feature request
2+
description: Propose a new feature.
3+
title: "[FR]: Please title this feature request"
4+
labels: "enhancement"
5+
body:
6+
- type: textarea
7+
id: version
8+
attributes:
9+
label: Does the feature exist in the most recent commit?
10+
description: We recommend using the latest commit from GitHub in your projects.
11+
validations:
12+
required: true
13+
- type: textarea
14+
id: why
15+
attributes:
16+
label: Why do we need this feature?
17+
description: Ideally, explain why a combination of existing features cannot be used instead.
18+
validations:
19+
required: true
20+
- type: textarea
21+
id: proposal
22+
attributes:
23+
label: Describe the proposal.
24+
description: Include a detailed description of the feature, with usage examples.
25+
validations:
26+
required: true
27+
- type: textarea
28+
id: platform
29+
attributes:
30+
label: Is the feature specific to an operating system, compiler, or build system version?
31+
description: If it is, please specify which versions.
32+
validations:
33+
required: true
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: Get Help
4+
url: https://github.com/google/googletest/discussions
5+
about: Please ask and answer questions here.

0 commit comments

Comments
 (0)