Skip to content

Commit

Permalink
Merge pull request #136 from jgaa/staging
Browse files Browse the repository at this point in the history
Staging
  • Loading branch information
jgaa authored Aug 7, 2022
2 parents cdccaaf + 8d2a816 commit 4dc9c78
Show file tree
Hide file tree
Showing 21 changed files with 492 additions and 130 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ if (DEFINED ENV{RESTC_CPP_VERSION})
endif()

if (NOT DEFINED RESTC_CPP_VERSION)
set(RESTC_CPP_VERSION 0.93.0)
set(RESTC_CPP_VERSION 0.94.0)
endif()

if(NOT DEFINED RESTC_BOOST_VERSION)
Expand Down Expand Up @@ -62,7 +62,7 @@ option(RESTC_CPP_LOG_JSON_SERIALIZATION "Enable trace logging for json serializa

option(RESTC_CPP_WITH_ZLIB "Use zlib" ON)

option(RESTC_CPP_USE_CPP17 "Use the C++17 standard" OFF)
option(RESTC_CPP_USE_CPP17 "Use the C++17 standard" ON)

option(RESTC_CPP_THREADED_CTX "Allow asio contextx with multiple therads. Enables thread-safe internal access." OFF)

Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,8 @@ Please refer to the [tutorial](doc/Tutorial.md) for more examples.
- Override RequestBody to let the library pull for data when required.
- Write directly to the outgoing DataWriter when data is required.
- Just provide a C++ object and let the library serialize it directly to the wire.
- HTTP Proxy support
- SOCKS5 Proxy support (naive implementatin for now, no support for authentication).

# Current Status
The project has been in public BETA since April 11th 2017.
Expand All @@ -263,13 +265,13 @@ These are the operating systems where my Continues Integration (Jenkins) servers
- Ubuntu Bionic (LTS)

Support for MacOS has been removed after Apples announcement that their love for privacy was just
a marketing gimmic.
a marketing gimmick.

Fedora is currently disabled in my CI because of failures to start their Docker containers. (Work in progress). Ubuntu Hippo don't work with the Docker version I use on my build machine / CI pipeline, so I have no reliable way to test it. Windows 11 cannot be run on my KVM /QEMU system, because it don't support "secure" boot, so I have no way to test it.
Fedora is currently disabled in my CI because of failures to start their Docker containers. (Work in progress). Ubuntu Jammy don't work in docker with my Jenkins CI pipeline, so I have no reliable way to test it. Windows 11 cannot be run on my KVM /QEMU system, because it don't support "secure" boot, so I have no way to test it.

The Jenkins setup is [here](ci/jenkins).

I currently use my own CI infrastructure running on my own hardware. I use Jenkins on a VM with Debian Bullseye, and three slaves for Docker on Linux VM's, one slave running on a VM with Microsoft Windows 10 Pro. Using Docker to build with different Linux distributions gives me flexibility. It also immediately catches mistakes that break the build or test(s) on a specific Linux distribution or platform.
I currently use my own CI infrastructure running on my own hardware. I use Jenkins on a VM with Debian Bullseye, and three slaves for Docker on Linux VM's, one slave running on a VM with Microsoft Windows 10 Pro. Using Docker to build with different Linux distributions gives me flexibility. It also immediately catches mistakes that break the build or test(s) on a specific Linux distribution or platform. Using my own infrastructure improves the security, as I don't share any credentials with 3rd party services or allow external access into my LAN.

# Blog-posts about the project:
- [About version 0.90](https://lastviking.eu/restc_cpp_90.html)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM ubuntu:21.04
FROM ubuntu:22.04

MAINTAINER Jarle Aase <[email protected]>

RUN apt-get -q update \
apt-get -y -q --no-install-recommends upgrade &&\
apt-get -y -q install openssh-server g++ git gpgv \
RUN DEBIAN_FRONTEND="noninteractive" apt-get -q update &&\
DEBIAN_FRONTEND="noninteractive" apt-get -y -q --no-install-recommends upgrade &&\
DEBIAN_FRONTEND="noninteractive" apt-get install -y -q openssh-server g++ git gpgv \
automake autoconf build-essential \
zlib1g-dev g++ cmake make libboost-all-dev libssl-dev \
default-jdk &&\
Expand All @@ -13,7 +13,8 @@ RUN apt-get -q update \

# Set user jenkins to the image
RUN useradd -m -d /home/jenkins -s /bin/sh jenkins &&\
echo "jenkins:jenkins" | chpasswd
echo "jenkins:jenkins" | chpasswd &&\
mkdir -p /home/jenkins/build/workspace/restc-staging

# Standard SSH port
EXPOSE 22
Expand Down
128 changes: 33 additions & 95 deletions ci/jenkins/Jenkinsfile.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pipeline {
agent { label 'master' }

environment {
RESTC_CPP_VERSION = "0.93.0"
RESTC_CPP_VERSION = "0.94.0"

// It is not possible to get the current IP number when running in the sandbox, and
// Jenkinsfiles always runs in the sandbox.
Expand All @@ -23,25 +23,27 @@ pipeline {

stage('Build') {
parallel {
// # Unfortunately, Ubuntu Hippo cannot run 'apt update' using docker from the
// # current Debian release version. So fuck Ubuntu Hippo.
//
// stage('Ubuntu Hippo') {
// Broken: java.io.IOException: Failed to run image '692f7cce9b970633dba347a9aaf12846429c073f'. Error: docker: Error // response from daemon: OCI runtime create failed: container_linux.go:367: starting container process caused: chdir to cwd ("/home/jenkins/build/workspace/restc-staging") set in config.json failed: permission denied: unknown.
// stage('Ubuntu Jammy') {
// agent {
// dockerfile {
// filename 'Dockefile.ubuntu-hippo'
// filename 'Dockefile.ubuntu-jammy'
// dir 'ci/jenkins'
// label 'docker'
// }
// }
//
// options {
// timeout(time: 30, unit: "MINUTES")
// }
//
// steps {
// echo "Building on ubuntu-bionic-AMD64 in ${WORKSPACE}"
// echo "Building on ubuntu-jammy-AMD64 in ${WORKSPACE}"
// checkout scm
// sh 'pwd; ls -la'
// sh 'rm -rf build'
// sh 'mkdir build'
// sh 'cd build && cmake -DCMAKE_BUILD_TYPE=Release .. && make -j $(nproc)'
// sh 'cd build && cmake -DCMAKE_BUILD_TYPE=Release -DRESTC_CPP_USE_CPP17=ON .. && make -j $(nproc)'
//
// echo 'Getting ready to run tests'
// script {
Expand All @@ -55,23 +57,26 @@ pipeline {
// }
// }
//
//
// stage('Ubuntu Hippo C++17') {
// stage('Ubuntu Jammy MT CTX') {
// agent {
// dockerfile {
// filename 'Dockefile.ubuntu-hippo'
// filename 'Dockefile.ubuntu-jammy'
// dir 'ci/jenkins'
// label 'docker'
// }
// }
//
// options {
// timeout(time: 30, unit: "MINUTES")
// }
//
// steps {
// echo "Building on ubuntu-bionic-AMD64 in ${WORKSPACE}"
// echo "Building on ubuntu-jammy-AMD64 in ${WORKSPACE}"
// checkout scm
// sh 'pwd; ls -la'
// sh 'rm -rf build'
// sh 'mkdir build'
// sh 'cd build && cmake -DCMAKE_BUILD_TYPE=Release -DRESTC_CPP_USE_CPP17=ON .. && make -j $(nproc)'
// sh 'cd build && cmake -DRESTC_CPP_THREADED_CTX=ON -DCMAKE_BUILD_TYPE=Release -DRESTC_CPP_USE_CPP17=ON .. && make -j $(nproc)'
//
// echo 'Getting ready to run tests'
// script {
Expand All @@ -84,7 +89,7 @@ pipeline {
// }
// }
// }

stage('Ubuntu Bionic') {
agent {
dockerfile {
Expand All @@ -104,7 +109,7 @@ pipeline {
sh 'pwd; ls -la'
sh 'rm -rf build'
sh 'mkdir build'
sh 'cd build && cmake -DCMAKE_BUILD_TYPE=Release .. && make -j $(nproc)'
sh 'cd build && cmake -DCMAKE_BUILD_TYPE=Release -DRESTC_CPP_USE_CPP17=OFF .. && make -j $(nproc)'

echo 'Getting ready to run tests'
script {
Expand Down Expand Up @@ -138,7 +143,7 @@ pipeline {
sh 'pwd; ls -la'
sh 'rm -rf build'
sh 'mkdir build'
sh 'cd build && cmake -DRESTC_CPP_THREADED_CTX=ON -DCMAKE_BUILD_TYPE=Release .. && make -j $(nproc)'
sh 'cd build && cmake -DRESTC_CPP_THREADED_CTX=ON -DCMAKE_BUILD_TYPE=Release -DRESTC_CPP_USE_CPP17=OFF .. && make -j $(nproc)'

echo 'Getting ready to run tests'
script {
Expand Down Expand Up @@ -237,12 +242,12 @@ pipeline {
sh 'pwd; ls -la'
sh 'rm -rf build'
sh 'mkdir build'
sh 'cd build && cmake -DCMAKE_BUILD_TYPE=Release .. && make -j $(nproc)'
sh 'cd build && cmake -DCMAKE_BUILD_TYPE=Release -DRESTC_CPP_USE_CPP17=OFF .. && make -j $(nproc)'

echo 'Getting ready to run tests'
script {
try {
sh 'cd build && ctest -E HTTPS_FUNCTIONAL_TESTS --no-compress-output -T Test'
sh 'cd build && ctest -E "HTTPS_FUNCTIONAL_TESTS|PROXY_TESTS" --no-compress-output -T Test'
} catch (exc) {

unstable(message: "${STAGE_NAME} - Testing failed")
Expand Down Expand Up @@ -270,12 +275,12 @@ pipeline {
sh 'pwd; ls -la'
sh 'rm -rf build'
sh 'mkdir build'
sh 'cd build && cmake -DRESTC_CPP_THREADED_CTX=ON -DCMAKE_BUILD_TYPE=Release .. && make -j $(nproc)'
sh 'cd build && cmake -DRESTC_CPP_THREADED_CTX=ON -DCMAKE_BUILD_TYPE=Release -DRESTC_CPP_USE_CPP17=OFF .. && make -j $(nproc)'

echo 'Getting ready to run tests'
script {
try {
sh 'cd build && ctest -E HTTPS_FUNCTIONAL_TESTS --no-compress-output -T Test'
sh 'cd build && ctest -E "HTTPS_FUNCTIONAL_TESTS|PROXY_TESTS" --no-compress-output -T Test'
} catch (exc) {

unstable(message: "${STAGE_NAME} - Testing failed")
Expand Down Expand Up @@ -303,12 +308,12 @@ pipeline {
sh 'pwd; ls -la'
sh 'rm -rf build'
sh 'mkdir build'
sh 'cd build && cmake -DCMAKE_BUILD_TYPE=Release .. && make -j $(nproc)'
sh 'cd build && cmake -DCMAKE_BUILD_TYPE=Release -DRESTC_CPP_USE_CPP17=OFF .. && make -j $(nproc)'

echo 'Getting ready to run tests'
script {
try {
sh 'cd build && ctest -E HTTPS_FUNCTIONAL_TESTS --no-compress-output -T Test'
sh 'cd build && ctest -E "HTTPS_FUNCTIONAL_TESTS|PROXY_TESTS" --no-compress-output -T Test'
} catch (exc) {

unstable(message: "${STAGE_NAME} - Testing failed")
Expand Down Expand Up @@ -336,12 +341,12 @@ pipeline {
sh 'pwd; ls -la'
sh 'rm -rf build'
sh 'mkdir build'
sh 'cd build && cmake -DRESTC_CPP_THREADED_CTX=ON -DCMAKE_BUILD_TYPE=Release .. && make -j $(nproc)'
sh 'cd build && cmake -DRESTC_CPP_THREADED_CTX=ON -DCMAKE_BUILD_TYPE=Release -DRESTC_CPP_USE_CPP17=OFF .. && make -j $(nproc)'

echo 'Getting ready to run tests'
script {
try {
sh 'cd build && ctest -E HTTPS_FUNCTIONAL_TESTS --no-compress-output -T Test'
sh 'cd build && ctest -E "HTTPS_FUNCTIONAL_TESTS|PROXY_TESTS" --no-compress-output -T Test'
} catch (exc) {

unstable(message: "${STAGE_NAME} - Testing failed")
Expand All @@ -350,73 +355,6 @@ pipeline {
}
}

stage('Debian Buster') {
agent {
dockerfile {
filename 'Dockefile.debian-buster'
dir 'ci/jenkins'
label 'docker'
}
}

options {
timeout(time: 30, unit: "MINUTES")
}

steps {
echo "Building on debian-buster-AMD64 in ${WORKSPACE}"
checkout scm
sh 'pwd; ls -la'
sh 'rm -rf build'
sh 'mkdir build'
sh 'cd build && cmake -DCMAKE_BUILD_TYPE=Release .. && make -j $(nproc)'

echo 'Getting ready to run tests'
script {
try {
sh 'cd build && ctest --no-compress-output -T Test'
} catch (exc) {

unstable(message: "${STAGE_NAME} - Testing failed")
}
}
}
}

stage('Debian Buster MT CTX') {
agent {
dockerfile {
filename 'Dockefile.debian-buster'
dir 'ci/jenkins'
label 'docker'
}
}

options {
timeout(time: 30, unit: "MINUTES")
}

steps {
echo "Building on debian-buster-AMD64 in ${WORKSPACE}"
checkout scm
sh 'pwd; ls -la'
sh 'rm -rf build'
sh 'mkdir build'
sh 'cd build && cmake -DRESTC_CPP_THREADED_CTX=ON -DCMAKE_BUILD_TYPE=Release .. && make -j $(nproc)'

echo 'Getting ready to run tests'
script {
try {
sh 'cd build && ctest --no-compress-output -T Test'
} catch (exc) {

unstable(message: "${STAGE_NAME} - Testing failed")
}
}
}
}


stage('Debian Buster C++17') {
agent {
dockerfile {
Expand Down Expand Up @@ -550,7 +488,7 @@ pipeline {
}
}

stage('Debian Testing') {
stage('Debian Testing C++17') {
agent {
dockerfile {
filename 'Dockefile.debian-testing'
Expand Down Expand Up @@ -583,7 +521,7 @@ pipeline {
}
}

stage('Debian Testing MT CTX') {
stage('Debian Testing MT CTX C++17') {
agent {
dockerfile {
filename 'Dockefile.debian-testing'
Expand Down Expand Up @@ -674,7 +612,7 @@ pipeline {
// }
// }

stage('Windows X64 with vcpkg') {
stage('Windows X64 with vcpkg C++17') {

agent {label 'windows'}

Expand Down Expand Up @@ -717,7 +655,7 @@ pipeline {
}
}

stage('Windows X64 with vcpkg MT CTX') {
stage('Windows X64 with vcpkg MT CTX C++17') {

agent {label 'windows'}

Expand Down
8 changes: 8 additions & 0 deletions ci/mock-backends/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,11 @@ services:
links:
- "nginx:api.example.com"

socks:
image: jgaafromnorth/shinysocks
environment:
- LOG_LEVEL=trace
ports:
- "3004:1080"
links:
- "nginx:api.example.com"
1 change: 1 addition & 0 deletions create-and-run-containers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ else
exit -1
fi

docker-compose stop
docker-compose build
docker-compose up -d
docker ps
Expand Down
4 changes: 2 additions & 2 deletions include/restc-cpp/IoTimer.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class IoTimer : public std::enable_shared_from_this<IoTimer>
using ptr_t = std::shared_ptr<IoTimer>;
using close_t = std::function<void ()>;

#if (BOOST_VERSION/100000) >= 1 && ((BOOST_VERSION/100)%1000) > 69
#if (BOOST_VERSION >= 106900)
using asio_premature_deprecation_workaround_t = boost::asio::ip::tcp::socket::executor_type;
#else
using asio_premature_deprecation_workaround_t = boost::asio::io_service;
Expand Down Expand Up @@ -115,7 +115,7 @@ class IoTimer : public std::enable_shared_from_this<IoTimer>
return std::make_unique<Wrapper>(Create(
timerName,
milliseconds_timeout,
#if (BOOST_VERSION/100000) >= 1 && ((BOOST_VERSION/100)%1000) > 69
#if (BOOST_VERSION >= 106900)
connection->GetSocket().GetSocket().get_executor(),
#else
connection->GetSocket().GetSocket().get_io_service(),
Expand Down
1 change: 1 addition & 0 deletions include/restc-cpp/SerializeJson-cpp17.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <set>
#include <stack>
#include <type_traits>
#include <optional>

#include "restc-cpp/RapidJsonReader.h"
#include "restc-cpp/RapidJsonWriter.h"
Expand Down
Loading

0 comments on commit 4dc9c78

Please sign in to comment.