Skip to content

Fix Binance Spot SBE quotes stream #984

Fix Binance Spot SBE quotes stream

Fix Binance Spot SBE quotes stream #984

Workflow file for this run

name: performance
permissions: # Principle of least privilege
contents: read
actions: read
on:
push:
branches: [nightly]
jobs:
performance-benchmarks:
runs-on: ubuntu-latest
env:
BUILD_MODE: release
RUST_BACKTRACE: 1
SCCACHE_CACHE_SIZE: 1G
# yamllint disable rule:line-length
services:
redis:
image: public.ecr.aws/docker/library/redis:7.4.5-alpine3.21@sha256:bb186d083732f669da90be8b0f975a37812b15e913465bb14d845db72a4e3e08
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
postgres:
image: public.ecr.aws/docker/library/postgres:16.4-alpine@sha256:5660c2cbfea50c7a9127d17dc4e48543eedd3d7a41a595a2dfa572471e37e64c
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: pass
POSTGRES_DB: nautilus
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
# yamllint enable rule:line-length
steps:
# https://github.com/step-security/harden-runner
- uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
with:
egress-policy: audit
- name: Checkout repository
# https://github.com/actions/checkout
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
persist-credentials: false
fetch-depth: 1
- name: Aggressive disk cleanup (pre-setup)
if: runner.os == 'Linux'
run: |
set -euxo pipefail
sudo rm -rf /usr/share/dotnet /opt/ghc /usr/local/share/boost || true
sudo rm -rf /usr/local/lib/android /usr/lib/jvm /usr/lib/mono || true
sudo rm -rf /opt/hostedtoolcache/go /opt/hostedtoolcache/node || true
if [ -n "${AGENT_TOOLSDIRECTORY:-}" ] && [ -d "$AGENT_TOOLSDIRECTORY" ]; then
# Remove big toolcache components but keep Python intact
sudo rm -rf "$AGENT_TOOLSDIRECTORY/CodeQL" \
"$AGENT_TOOLSDIRECTORY/Go" \
"$AGENT_TOOLSDIRECTORY/Node" \
"$AGENT_TOOLSDIRECTORY/node" \
"$AGENT_TOOLSDIRECTORY/Ruby" \
"$AGENT_TOOLSDIRECTORY/PyPy" \
"$AGENT_TOOLSDIRECTORY/R" \
"$AGENT_TOOLSDIRECTORY"/Java* || true
fi
sudo apt-get clean
sudo apt-get autoremove -y
sudo rm -rf /var/lib/apt/lists/* /usr/share/man /usr/share/doc || true
df -h
- name: Common setup
uses: ./.github/actions/common-setup
with:
python-version: "3.12"
free-disk-space: "true"
- name: Prune unused Docker images
if: runner.os == 'Linux'
run: |
docker image prune -a -f || true
- name: Install Nautilus CLI
env:
NAUTILUS_CLI_FORCE_SOURCE: ${{ github.ref == 'refs/heads/nightly' && '1' || '0' }}
run: bash scripts/ci/install-nautilus-cli.sh
- name: Init postgres schema
run: nautilus database init --schema ${{ github.workspace }}/schema/sql
env:
POSTGRES_HOST: localhost
POSTGRES_PORT: 5432
POSTGRES_USERNAME: postgres
POSTGRES_PASSWORD: pass
POSTGRES_DATABASE: nautilus
- name: Run Rust tests
run: make cargo-test
# TODO: Add nautilus-persistence once required test data available
- name: Run Rust benchmarks crate-by-crate
env:
# Shrink bench artifacts to reduce disk usage
RUSTFLAGS: -Cdebuginfo=0
CARGO_PROFILE_BENCH_DEBUG: 0
CARGO_PROFILE_BENCH_INCREMENTAL: false
run: make cargo-ci-benches
- name: Build and install wheel
uses: ./.github/actions/common-wheel-build
with:
python-version: "3.12"
github_ref: ${{ github.ref }}
- name: Cleanup build artifacts and caches
if: runner.os == 'Linux'
run: |
set -euxo pipefail
rm -rf target || true
rm -rf ~/.cargo/registry ~/.cargo/git || true
uv cache prune || true
rm -rf dist build || true
# Run codspeed once only
- name: Run benchmarks
# https://github.com/CodSpeedHQ/action
uses: CodSpeedHQ/action@6d34d2c6e7a86f627c3a13da9549139a12af9023 # v4.4.1
with:
token: ${{ secrets.CODSPEED_TOKEN }}
mode: instrumentation
run: uv run --no-sync pytest tests/performance_tests --benchmark-disable-gc --codspeed