Skip to content

Add random sampling to strategy optimizer (100 samples/strategy default) #13

Add random sampling to strategy optimizer (100 samples/strategy default)

Add random sampling to strategy optimizer (100 samples/strategy default) #13

Workflow file for this run

name: APEX CI
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
workflow_dispatch:
permissions:
contents: read
defaults:
run:
working-directory: TFT-main
jobs:
lint:
name: Lint & Type Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install black flake8 mypy yamllint
- name: Check formatting (black)
run: black --check . --exclude '/(\.git|__pycache__|venv|\.venv|lightning_logs)/'
- name: Lint (flake8)
continue-on-error: true
run: flake8 . --max-line-length 120 --exclude .git,__pycache__,venv,.venv,lightning_logs,advanced_copilot_prompts.py
- name: Type check (mypy) — warning only
continue-on-error: true
run: mypy . --ignore-missing-imports --no-error-summary --exclude '(venv|\.venv|lightning_logs)'
- name: YAML lint
continue-on-error: true
run: |
yamllint -d "{extends: default, rules: {line-length: {max: 200}, truthy: disable}}" \
.github/workflows/*.yml \
monitoring/prometheus/*.yml \
monitoring/grafana/datasources/*.yml \
docker-compose.yml
test:
name: Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest pytest-cov
- name: Run tests with coverage
run: |
pytest tests/ -v --tb=short --junitxml=test-results.xml \
--ignore=tests/test_api_playwright.py \
--ignore=tests/test_dashboard_browser.py \
--ignore=tests/test_chaos.py \
--ignore=tests/test_database_full.py \
--cov=models --cov=strategies --cov=trading --cov=services \
--cov-report=term-missing --cov-report=xml:coverage.xml \
--cov-fail-under=40
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results
path: |
TFT-main/test-results.xml
TFT-main/coverage.xml
retention-days: 30
security:
name: Security Scan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pip-audit detect-secrets
- name: Check for vulnerable dependencies
continue-on-error: true
run: pip-audit --strict
- name: Scan for leaked secrets
continue-on-error: true
run: detect-secrets scan . --exclude-files '\.env$' --exclude-files '\.env\.example$'
docker:
name: Docker Build
runs-on: ubuntu-latest
continue-on-error: true
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
needs: [lint, test]
steps:
- uses: actions/checkout@v4
- name: Create external network
run: docker network create tft_network || true
- name: Build images
run: docker compose build --no-cache
- name: Verify containers start
run: |
docker compose up -d
sleep 10
EXITED=$(docker compose ps --filter "status=exited" -q | wc -l)
if [ "$EXITED" -gt 0 ]; then
echo "::warning::$EXITED container(s) exited unexpectedly"
docker compose logs --tail=20
fi
docker compose down