Skip to content

neeed improve on the signal generator to identify alphas #8

neeed improve on the signal generator to identify alphas

neeed improve on the signal generator to identify alphas #8

Workflow file for this run

name: CI/CD Pipeline
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
env:
RUST_BACKTRACE: 1
CARGO_TERM_COLOR: always
jobs:
# Python tests
python-tests:
name: Python Tests
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.11', '3.12']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Install dependencies
run: |
uv venv
source .venv/bin/activate
uv pip install -e ".[dev]"
- name: Run pytest with coverage
run: |
source .venv/bin/activate
pytest tests/unit/python tests/integration/python tests/property \
--cov=src \
--cov-report=xml \
--cov-report=html \
--cov-report=term-missing \
--junitxml=junit/test-results-${{ matrix.python-version }}.xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
flags: python
name: python-${{ matrix.python-version }}
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: pytest-results-${{ matrix.python-version }}
path: junit/test-results-${{ matrix.python-version }}.xml
# Rust tests
rust-tests:
name: Rust Tests
runs-on: ubuntu-latest
strategy:
matrix:
rust: [stable, beta]
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
components: rustfmt, clippy
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v4
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/cache@v4
with:
path: rust/target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- name: Run cargo test
working-directory: ./rust
run: cargo test --all-features --workspace --verbose
- name: Run cargo test with coverage
working-directory: ./rust
run: |
cargo install cargo-tarpaulin
cargo tarpaulin --all-features --workspace --timeout 120 --out Xml --output-dir ./coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: ./rust/coverage/cobertura.xml
flags: rust
name: rust-${{ matrix.rust }}
# Code quality
code-quality:
name: Code Quality
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install uv and dependencies
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
uv venv
source .venv/bin/activate
uv pip install -e ".[dev]"
- name: Run black (code formatting)
run: |
source .venv/bin/activate
black --check src tests
- name: Run flake8 (linting)
run: |
source .venv/bin/activate
flake8 src tests --max-line-length=100
- name: Run mypy (type checking)
run: |
source .venv/bin/activate
mypy src tests --ignore-missing-imports
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt, clippy
- name: Run rustfmt
working-directory: ./rust
run: cargo fmt -- --check
- name: Run clippy
working-directory: ./rust
run: cargo clippy --all-targets --all-features -- -D warnings
# Benchmark tests
benchmarks:
name: Performance Benchmarks
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Run Rust benchmarks
working-directory: ./rust
run: cargo bench --workspace
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
uv venv
source .venv/bin/activate
uv pip install -e ".[dev]"
- name: Run Python benchmarks
run: |
source .venv/bin/activate
pytest tests/benchmarks --benchmark-only --benchmark-json=benchmark-results.json
- name: Upload benchmark results
uses: actions/upload-artifact@v4
with:
name: benchmark-results
path: benchmark-results.json
# Security audit
security:
name: Security Audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Run cargo audit
working-directory: ./rust
run: |
cargo install cargo-audit
cargo audit
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
uv venv
source .venv/bin/activate
uv pip install -e ".[dev]"
- name: Run safety (Python dependency audit)
run: |
source .venv/bin/activate
pip install safety
safety check
- name: Run bandit (Python security linter)
run: |
source .venv/bin/activate
pip install bandit
bandit -r src -f json -o bandit-report.json
- name: Upload security reports
uses: actions/upload-artifact@v4
if: always()
with:
name: security-reports
path: bandit-report.json
# Integration tests (requires running services)
integration-tests:
name: Integration Tests
runs-on: ubuntu-latest
services:
redis:
image: redis:7-alpine
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- name: Install ZeroMQ
run: |
sudo apt-get update
sudo apt-get install -y libzmq3-dev
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
uv venv
source .venv/bin/activate
uv pip install -e ".[dev]"
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Build Rust components
working-directory: ./rust
run: cargo build --release
- name: Run integration tests
run: |
source .venv/bin/activate
pytest tests/integration tests/e2e -v --tb=short
# Coverage report
coverage-report:
name: Coverage Report
needs: [python-tests, rust-tests]
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v4
- name: Download coverage reports
uses: actions/download-artifact@v4
- name: Display coverage summary
run: |
echo "## Coverage Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Coverage reports have been uploaded to Codecov" >> $GITHUB_STEP_SUMMARY
echo "View detailed reports at: https://codecov.io/${{ github.repository }}" >> $GITHUB_STEP_SUMMARY