fix(backtest): deadlock in printDataStatistics (#61) #119
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build | |
| on: | |
| pull_request: | |
| branches: [ main ] | |
| push: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| jobs: | |
| build-and-test: | |
| name: Build and Test | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| build_type: [Debug, Release] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Setup dependencies (Ubuntu) | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y cmake build-essential libboost-all-dev libssl-dev nlohmann-json3-dev libgtest-dev libbenchmark-dev libwebsocketpp-dev | |
| - name: Setup dependencies (macOS) | |
| if: runner.os == 'macOS' | |
| run: | | |
| brew install cmake boost openssl nlohmann-json googletest google-benchmark websocketpp | |
| - name: Configure CMake | |
| run: | | |
| cmake -B build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DBUILD_TESTS=ON -DBUILD_BENCHMARKS=ON -DCMAKE_CXX_FLAGS="-fno-omit-frame-pointer -fsanitize=address" | |
| - name: Build | |
| run: | | |
| cmake --build build --config ${{ matrix.build_type }} -j$(nproc || sysctl -n hw.ncpu) | |
| - name: Run Unit Tests | |
| env: | |
| JOURNAL_PATH: /tmp/journals | |
| run: | | |
| cd build | |
| ./orderbook_tests | |
| ./lockfree_orderbook_tests | |
| ./strategy_tests | |
| ./execution_tests | |
| ./fix_basic_test | |
| ./routing_test | |
| - name: Run Performance Benchmarks (Release only) | |
| if: matrix.build_type == 'Release' | |
| env: | |
| JOURNAL_PATH: /tmp/journals | |
| run: | | |
| cd build | |
| ./latency_benchmark --benchmark_min_time=1s | |
| ./throughput_benchmark --benchmark_min_time=1s | |
| ./orderbook_benchmark --benchmark_min_time=1s | |
| ./routing_benchmark --benchmark_min_time=1s | |
| - name: Test Credential Setup | |
| run: | | |
| cd build | |
| echo "test123" | ./pinnaclemm --setup-credentials | |
| ls -la ../config/secure_config.json | |
| - name: Upload build artifacts | |
| if: matrix.build_type == 'Release' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: pinnaclemm-${{ runner.os }}-release | |
| path: | | |
| build/pinnaclemm | |
| build/*_benchmark | |
| build/*_test* | |
| security-scan: | |
| name: Security Scan | |
| runs-on: ubuntu-latest | |
| permissions: | |
| actions: read | |
| contents: read | |
| security-events: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Run CodeQL Analysis | |
| uses: github/codeql-action/init@v4 | |
| with: | |
| languages: cpp | |
| - name: Setup dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y cmake build-essential libboost-all-dev libssl-dev nlohmann-json3-dev | |
| - name: Build for analysis | |
| run: | | |
| cmake -B build -DCMAKE_BUILD_TYPE=Release | |
| cmake --build build -j$(nproc) | |
| - name: Perform CodeQL Analysis | |
| uses: github/codeql-action/analyze@v4 | |
| docker-build: | |
| name: Docker Build and Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v4 | |
| - name: Build Docker image | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: . | |
| file: ./Dockerfile | |
| push: false | |
| tags: pinnaclemm:test | |
| load: true | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Test Docker image - Simulation mode | |
| run: | | |
| docker run --rm pinnaclemm:test --mode simulation --symbol BTC-USD & | |
| CONTAINER_PID=$! | |
| sleep 5 | |
| kill $CONTAINER_PID || true | |
| - name: Test Docker image - Help command | |
| run: | | |
| docker run --rm pinnaclemm:test --help | |
| - name: Test Docker image - Credential setup | |
| run: | | |
| docker run --rm -i pinnaclemm:test --setup-credentials <<< "test123" | |
| - name: Export Docker image for release | |
| if: github.ref == 'refs/heads/main' | |
| run: | | |
| docker save pinnaclemm:test | gzip > pinnaclemm-docker-image.tar.gz | |
| - name: Upload Docker image artifact | |
| if: github.ref == 'refs/heads/main' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: docker-image | |
| path: pinnaclemm-docker-image.tar.gz | |
| retention-days: 30 | |
| code-quality: | |
| name: Code Quality | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Setup Python for pre-commit | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.x' | |
| - name: Run pre-commit checks | |
| uses: pre-commit/action@v3.0.0 |