Skip to content

Commit ba4cea0

Browse files
committed
feat: done.
1 parent c4df1b1 commit ba4cea0

4 files changed

Lines changed: 142 additions & 14 deletions

File tree

.vscode/settings.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
{
22
"C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools",
33
"C_Cpp.default.compileCommands": "${workspaceFolder}/build/Debug/compile_commands.json",
4-
"editor.formatOnSave": true
4+
"editor.formatOnSave": true,
5+
"sonarlint.connectedMode.project": {
6+
"connectionId": "milsanore",
7+
"projectKey": "milsanore_trader.cpp"
8+
},
9+
"sonarlint.pathToCompileCommands": "${workspaceFolder}/build/Debug/compile_commands.json"
510
}

Dockerfile_build

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
#############################################
2+
# milss/tradercppbuild:v1.5
3+
# Build container for tradercpp
4+
# Published to dockerhub in order to accelerate github actions
5+
# Uses:
6+
# - Ubuntu 24.04
7+
# - CMake 4
8+
# - Conan 2 (incl. Python3)
9+
# - GCC 13
10+
# - LLVM 18 (clang-format and clang-tidy)
11+
# - make
12+
# - ninja-build
13+
# - perl (compilation dependency for conan packages)
14+
#############################################
15+
16+
17+
FROM ubuntu:24.04 AS build_container
18+
19+
# Set noninteractive mode to avoid prompts during install
20+
ENV DEBIAN_FRONTEND=noninteractive
21+
22+
RUN apt-get update && \
23+
apt-get install -y software-properties-common && \
24+
add-apt-repository universe && \
25+
apt-get update
26+
27+
28+
# Install CMake
29+
30+
RUN apt install -y --no-install-recommends \
31+
gnupg \
32+
lsb-release \
33+
software-properties-common \
34+
wget
35+
36+
RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | \
37+
gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null && \
38+
echo "deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ $(lsb_release -cs) main" | \
39+
tee /etc/apt/sources.list.d/kitware.list >/dev/null
40+
41+
RUN apt install -y --no-install-recommends cmake
42+
43+
44+
# Install Conan
45+
46+
RUN apt install -y --no-install-recommends python3 python3-pip python3-venv
47+
48+
RUN python3 -m venv /opt/conan-venv && \
49+
/opt/conan-venv/bin/pip install --upgrade pip && \
50+
/opt/conan-venv/bin/pip install "conan>=2.0"
51+
52+
ENV PATH="/opt/conan-venv/bin:$PATH"
53+
54+
RUN mkdir -p /root/.conan2/profiles && printf \
55+
"[settings]\n\
56+
arch=x86_64\n\
57+
build_type=Release\n\
58+
compiler=gcc\n\
59+
compiler.cppstd=gnu17\n\
60+
compiler.libcxx=libstdc++11\n\
61+
compiler.version=13\n\
62+
os=Linux\n" \
63+
> /root/.conan2/profiles/default
64+
65+
66+
# Install GCC 13
67+
68+
RUN add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
69+
apt-get update && \
70+
apt-get install -y --no-install-recommends \
71+
cmake \
72+
g++-13 \
73+
gcc-13
74+
75+
76+
# Install LLVM (clang-format and clang-tidy)
77+
78+
RUN apt-get install -y \
79+
gnupg \
80+
lsb-release \
81+
software-properties-common \
82+
wget
83+
84+
RUN wget -qO - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
85+
86+
RUN echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main" > /etc/apt/sources.list.d/llvm18.list
87+
88+
RUN apt-get update && \
89+
apt-get install -y clang-format-18 clang-tidy-18
90+
91+
RUN update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-18 100 && \
92+
update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-18 100
93+
94+
95+
# Install build tools
96+
97+
RUN apt-get install -y --no-install-recommends \
98+
build-essential \
99+
curl \
100+
git \
101+
lcov \
102+
make \
103+
ninja-build \
104+
perl \
105+
unzip \
106+
&& rm -rf /var/lib/apt/lists/*
107+
108+
# END: CLEAR CACHE
109+
RUN rm -rf /var/lib/apt/lists/*

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ init:
3030
conan install . --build=missing -s build_type=Debug
3131
cmake --preset=debug
3232

33+
## init-build-container: 🚢 create the docker container for building the app (hosted on dockerhub)
34+
.PHONY: init-build-container
35+
init-build-container:
36+
docker build -f Dockerfile_build -t milss/tradercppbuild:latest .
37+
3338
## build-debug: 🔨 compile (debug)
3439
.PHONY: build-debug
3540
build-debug:

README.md

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
1-
# trader.cpp
2-
a proof-of-concept, showcasing some c++ coding combined with some fintech concepts
1+
2+
[![codecov](https://codecov.io/gh/your-username/your-repo/branch/main/graph/badge.svg?token=YOUR_TOKEN)](https://codecov.io/gh/your-username/your-repo)
3+
[![Build](https://github.com/milsanore/trader.cpp/actions/workflows/build.yml/badge.svg)](https://github.com/milsanore/trader.cpp/actions/workflows/build.yml)
4+
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=milsanore_trader.cpp&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=milsanore_trader.cpp)
35

46
<img src="https://static.wikia.nocookie.net/surrealmemes/images/8/80/2f0.png"
57
alt="stonks"
68
width="250" />
79

8-
[![codecov](https://codecov.io/gh/milsanore/trader.cpp/branch/main/graph/badge.svg)](https://codecov.io/gh/milsanore/trader.cpp)
10+
# trader.cpp
11+
a proof-of-concept, showcasing some c++ coding combined with some fintech concepts
912

10-
## REQUIREMENTS
13+
## RUN REQUIREMENTS
1114
- a Binance account, with an Ed25519 token that has FIX read permissions enabled
15+
- `stunnel` or a local proxy, for TLS encryption
16+
17+
## BUILD REQUIREMENTS
1218
- C++20
1319
- `Conan` (and a conan profile)
1420
- `CMake`
15-
- `stunnel` or a local proxy, for TLS encryption
1621

1722
## DEV REQUIREMENTS
1823
- `clang-tidy`
@@ -60,23 +65,27 @@ a proof-of-concept, showcasing some c++ coding combined with some fintech concep
6065
- basic schema (severity, correlationId)
6166
- ✅ dependency injection
6267
- ✅ single-threaded to start with, then re-architect (and mermaid diagram)
63-
- nix virtual environment
68+
- ✅ code formatting / clang-format
69+
- ✅ git hooks
70+
- ✅ integrated into build pipeline
71+
- ✅ coverage badge
72+
- ✅ custom docker build image with all dependencies (for faster pipelines)
73+
- ✅ static code analysis
74+
- ✅ sonarcloud integrated into build pipeline
75+
- clang-tidy
6476
- decimal type
6577
- sparse arrays
6678
- release binaries on github
6779
- ccache.dev
6880
- zeromq + protobufs?
6981
- valgrind/cachegrind
70-
- code formatting / auto-formatter
71-
- ✅ clang-format
72-
- ✅ git hooks
73-
- ✅integrated into build pipeline
74-
- clang-tidy
7582
- github releases
76-
- custom docker build image with all dependencies
83+
- local github action runner
84+
- sonarqube integration
85+
- nix virtual environment
7786

7887
# STANDARDS
79-
- high unit-test coverage + badge
88+
- high unit-test coverage
8089
- static code analysis
8190
- configure debugging
8291
- git use

0 commit comments

Comments
 (0)