Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test environment (using conan) #235

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
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
65 changes: 65 additions & 0 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: build-and-test
on: [ push, workflow_dispatch ]

jobs:
job:
name: ${{ matrix.os }}-${{ github.workflow }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
include:
- os: windows-latest
triplet: x64-windows
- os: ubuntu-latest
triplet: x64-linux
- os: macos-latest
triplet: x64-osx

steps:
- uses: actions/checkout@v2
with:
submodules: true

- uses: actions/setup-python@v2
with:
python-version: '3.x' # Version range or exact version of a Python version to use, using SemVer's version range syntax
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified

- name: Prepare Docker.
uses: docker-practice/actions-setup-docker@master

- name: Prepare Tools.
run: |
pip install conan
if [ "$RUNNER_OS" != "Windows" ]; then
docker pull crossbario/crossbar
fi
shell: bash

- uses: msys2/setup-msys2@v2
if: matrix.os == 'windows-latest'

- name: Restore Dependency Cache.
uses: actions/cache@v2
with:
path: |
/home/runner/.conan/data
# The key is composed in a way that it gets properly invalidated: this must happen whenever vcpkg's Git commit id changes, or the list of packages changes. In this case a cache miss must happen and a new entry with a new key with be pushed to GitHub the cache service.
# The key includes: hash of the vcpkg.json file, the hash of the vcpkg Git commit id, and the used vcpkg's triplet. The vcpkg's commit id would suffice, but computing an hash out it does not harm.
# Note: given a key, the cache content is immutable. If a cache entry has been created improperly, in order the recreate the right content the key must be changed as well, and it must be brand new (i.e. not existing already).
key: |
${{ hashFiles( 'conanfile.py' ) }}-${{ matrix.triplet }}

# Run CMake to generate Ninja project files, using the vcpkg's toolchain file to resolve and install the dependencies as specified in vcpkg.json.
- name: Build and Test.
run: |
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make
if [ "$RUNNER_OS" != "Windows" ]; then
ctest
fi
shell: bash
88 changes: 0 additions & 88 deletions .github/workflows/ci-linux.yaml

This file was deleted.

50 changes: 0 additions & 50 deletions .github/workflows/ci-windows.yaml

This file was deleted.

3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "vcpkg"]
path = vcpkg
url = https://github.com/microsoft/vcpkg
39 changes: 33 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,40 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.21)

project(autobahn-cpp)

if (NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake")
message(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan")
file(DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/develop/conan.cmake"
"${CMAKE_BINARY_DIR}/conan.cmake"
TLS_VERIFY ON)
endif ()

file(COPY ${CMAKE_SOURCE_DIR}/conanfile.py DESTINATION ${CMAKE_BINARY_DIR})

include(${CMAKE_BINARY_DIR}/conan.cmake)

set(CMAKE_CXX_STANDARD 17)

option(AUTOBAHN_BUILD_EXAMPLES "Build examples" ON)
option(AUTOBAHN_BUILD_EXAMPLES_BOTAN "Build Botan cryptosign example" OFF)
option(AUTOBAHN_USE_LIBCXX "Use libc++ instead of libstdc++ when building with Clang" ON)
option(AUTOBAHN_TESTS "Test" ON)

include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Includes/CMakeLists.txt)
conan_cmake_run(CONANFILE ${CMAKE_SOURCE_DIR}/conanfile.py
BASIC_SETUP CMAKE_TARGETS
BUILD missing)

if(AUTOBAHN_BUILD_EXAMPLES)
conan_cmake_autodetect(settings)

conan_cmake_install(PATH_OR_REFERENCE .
BUILD missing
REMOTE conancenter
SETTINGS ${settings})

include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Includes/CMakeLists.txt)
if (AUTOBAHN_BUILD_EXAMPLES)
add_subdirectory(examples)
endif(AUTOBAHN_BUILD_EXAMPLES)
endif (AUTOBAHN_BUILD_EXAMPLES)

if (AUTOBAHN_TESTS)
include(CTest)
add_subdirectory(test)
endif ()
8 changes: 1 addition & 7 deletions autobahn/wamp_auth_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,7 @@ inline std::string compute_wcs(
HMAC_Final(&hmac, hash, &len);
HMAC_CTX_cleanup(&hmac);
#else
HMAC_CTX *hmac = HMAC_CTX_new();
if (!hmac)
return "";
HMAC_Init_ex(hmac, key.data(), (int) key.length(), EVP_sha256(), NULL);
HMAC_Update(hmac, ( unsigned char* ) challenge.data(), challenge.length());
HMAC_Final(hmac, hash, &len);
HMAC_CTX_free(hmac);
HMAC(EVP_sha256(), key.data(), static_cast<int>(key.length()), reinterpret_cast<const unsigned char *>(challenge.data()), challenge.length(), hash, &len);
#endif

std::string str_out;
Expand Down
Loading