diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index d07c51f7..00000000 --- a/.dockerignore +++ /dev/null @@ -1,14 +0,0 @@ -*.cmake -.cache -.vscode -.git -.clangformat -LICENSE -*.md -**/build*/ -**/*secret.json -data/log -data/secret -!data/secret/secret_test.json -monitoring -resources diff --git a/.github/workflows/ubuntu-clang-tidy.yml b/.github/workflows/ubuntu-clang-tidy.yml index 8222480d..2e2b684c 100644 --- a/.github/workflows/ubuntu-clang-tidy.yml +++ b/.github/workflows/ubuntu-clang-tidy.yml @@ -21,7 +21,8 @@ jobs: - name: Install dependencies run: | - sudo apt update && sudo apt install libcurl4-gnutls-dev ninja-build + sudo apt update + sudo apt install libcurl4-gnutls-dev ninja-build - name: Install clang (with clang-tidy) run: | diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 17e3f653..28eb6740 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -15,12 +15,12 @@ jobs: buildmode: [Debug, Release] steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Install dependencies - uses: crazy-max/ghaction-chocolatey@v1 + uses: crazy-max/ghaction-chocolatey@v3 with: - args: install curl openssl + args: install openssl curl -y --no-progress - name: Add cURL directory in the path run: | @@ -28,11 +28,19 @@ jobs: echo "C:\ProgramData\chocolatey\lib\curl\tools\${curlPath}\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append echo "C:\ProgramData\chocolatey\lib\curl\tools\${curlPath}\lib" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + dir "C:\ProgramData\chocolatey\lib\curl\tools\${curlPath}\include" + + $Env:CURL_LIBRARY = "C:\ProgramData\chocolatey\lib\curl\tools\${curlPath}\bin\libcurl-x64.dll" + $Env:CURL_INCLUDE_DIR = "C:\ProgramData\chocolatey\lib\curl\tools\${curlPath}\include" + - name: Create Build Environment run: cmake -E make_directory ${{github.workspace}}/build - name: Configure CMake - run: cmake -S . -B build -DCMAKE_BUILD_TYPE=${{matrix.buildmode}} + run: | + echo "CURL_LIBRARY = $CURL_LIBRARY" + echo "CURL_INCLUDE_DIR = $CURL_INCLUDE_DIR" + cmake -S . -B build -DCMAKE_BUILD_TYPE=${{matrix.buildmode}} -DCURL_LIBRARY="C:\ProgramData\chocolatey\lib\curl\tools\curl-8.6.0_1-win64-mingw\bin\libcurl-x64.dll" -DCURL_INCLUDE_DIR="C:\ProgramData\chocolatey\lib\curl\tools\curl-8.6.0_1-win64-mingw\bin\libcurl-x64.dll" - name: Build working-directory: ${{github.workspace}}/build diff --git a/CMakeLists.txt b/CMakeLists.txt index dc63a7a1..9fb0906d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,7 +52,6 @@ set(CMAKE_CXX_STANDARD 20) include(FetchContent) find_package(amc CONFIG) - if(amc_FOUND) set(LINK_AMC FALSE) else() @@ -83,7 +82,7 @@ if(CCT_ENABLE_TESTS) enable_testing() endif() -# nlohmann_json - coincenter json library +# nlohmann_json - json library find_package(nlohmann_json CONFIG) if(NOT nlohmann_json_FOUND) FetchContent_Declare( @@ -95,18 +94,13 @@ if(NOT nlohmann_json_FOUND) FetchContent_MakeAvailable(nlohmann_json) endif() -# spdlog - coincenter logging library -find_package(spdlog CONFIG) -if(NOT spdlog_FOUND) - FetchContent_Declare( - spdlog - GIT_REPOSITORY https://github.com/gabime/spdlog.git - GIT_TAG v1.13.0 - ) +# openssl for requests +find_package(OpenSSL REQUIRED) - FetchContent_MakeAvailable(spdlog) -endif() +# curl - request library +include(FindCURL) +# prometheus for monitoring support if(CCT_BUILD_PROMETHEUS_FROM_SRC) # Disable Prometheus testing set(ENABLE_TESTING OFF) @@ -135,6 +129,18 @@ else() endif() endif() +# spdlog - logging library +find_package(spdlog CONFIG) +if(NOT spdlog_FOUND) + FetchContent_Declare( + spdlog + GIT_REPOSITORY https://github.com/gabime/spdlog.git + GIT_TAG v1.13.0 + ) + + FetchContent_MakeAvailable(spdlog) +endif() + # Unit Tests #[[ Create an executable diff --git a/Dockerfile b/Dockerfile index 73202ad0..0e233b5e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,16 +4,22 @@ FROM ubuntu:22.04 AS build # Install base & build dependencies, needed certificates for curl to work with https RUN apt update && \ apt upgrade -y && \ - apt install build-essential curl libcurl4-gnutls-dev libssl-dev cmake git ca-certificates gzip -y && \ - curl -L -o /usr/local/bin/ninja.gz https://github.com/ninja-build/ninja/releases/latest/download/ninja-linux.zip && \ - gunzip /usr/local/bin/ninja.gz && \ - chmod a+x /usr/local/bin/ninja + apt install build-essential ninja-build libcurl4-gnutls-dev libssl-dev cmake git ca-certificates gzip -y --no-install-recommends + +# Copy source files +WORKDIR /app/src +COPY src . -# Set default directory for application WORKDIR /app +COPY CMakeLists.txt *.md ./ + +# Copy only the test secrets +WORKDIR /app/data/secret +COPY data/secret/secret_test.json . -# Copy all files, excluding the ones in '.dockerignore' -COPY . . +# Copy mandatory static configuration files +WORKDIR /app/data/static +COPY data/static/currency_prefix_translator.json data/static/currencyacronymtranslator.json data/static/stablecoins.json data/static/withdrawfees.json ./ # Create and go to 'bin' directory WORKDIR /app/bin diff --git a/alpine.Dockerfile b/alpine.Dockerfile index b52cab0b..2b7a1e9a 100644 --- a/alpine.Dockerfile +++ b/alpine.Dockerfile @@ -2,13 +2,22 @@ FROM alpine:3.19.1 AS build # Install base & build dependencies, needed certificates for curl to work with https -RUN apk add --update --upgrade --no-cache g++ libc-dev curl-dev cmake ninja git ca-certificates +RUN apk add --update --upgrade --no-cache g++ libc-dev openssl-dev curl-dev cmake ninja git ca-certificates + +# Copy source files +WORKDIR /app/src +COPY src . -# Set default directory for application WORKDIR /app +COPY CMakeLists.txt *.md ./ + +# Copy only the test secrets +WORKDIR /app/data/secret +COPY data/secret/secret_test.json . -# Copy all files, excluding the ones in '.dockerignore' -COPY . . +# Copy mandatory static configuration files +WORKDIR /app/data/static +COPY data/static/currency_prefix_translator.json data/static/currencyacronymtranslator.json data/static/stablecoins.json data/static/withdrawfees.json ./ # Create and go to 'bin' directory WORKDIR /app/bin diff --git a/src/engine/CMakeLists.txt b/src/engine/CMakeLists.txt index 3e5f241e..4871e58b 100644 --- a/src/engine/CMakeLists.txt +++ b/src/engine/CMakeLists.txt @@ -22,14 +22,19 @@ add_unit_test( coincenter_engine ) -add_unit_test( - commandlineoptionsparser_test - test/commandlineoptionsparser_test.cpp - DEFINITIONS - CCT_DISABLE_SPDLOG - LIBRARIES - coincenter_tech -) +# As of MSVC 19.38.33135.0, it fails to compile commandlineoptionsparser_test: +# commandlineoptionsparser_test.cpp(333,79): fatal error C1001: Internal compiler error + +if(NOT MSVC) + add_unit_test( + commandlineoptionsparser_test + test/commandlineoptionsparser_test.cpp + DEFINITIONS + CCT_DISABLE_SPDLOG + LIBRARIES + coincenter_tech + ) +endif() add_unit_test( exchangesorchestrator_private_test diff --git a/src/http-request/CMakeLists.txt b/src/http-request/CMakeLists.txt index d80b2c67..2732feec 100644 --- a/src/http-request/CMakeLists.txt +++ b/src/http-request/CMakeLists.txt @@ -10,8 +10,6 @@ if (MSVC) add_compile_definitions(CURL_STATICLIB) endif() -include(FindCURL) - target_link_libraries(coincenter_http-request PRIVATE CURL::libcurl) target_include_directories(coincenter_http-request PUBLIC include) @@ -30,7 +28,6 @@ add_unit_test( coincenter_http-request ) - add_unit_test( permanentcurloptions_test test/permanentcurloptions_test.cpp