summaryrefslogtreecommitdiff
path: root/.github/workflows/ci.yml
diff options
context:
space:
mode:
Diffstat (limited to '.github/workflows/ci.yml')
-rw-r--r--.github/workflows/ci.yml74
1 files changed, 74 insertions, 0 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..c07541b
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,74 @@
+name: CI
+
+on:
+ push:
+ branches: [master]
+ pull_request:
+ branches: [master]
+
+jobs:
+ lint:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/setup-python@v5
+ with:
+ python-version: "3.12"
+ - run: pip install ruff
+ - run: ruff check .
+ - run: ruff format --check .
+
+ test:
+ runs-on: ubuntu-latest
+ services:
+ redis:
+ image: redis:7-alpine
+ ports: [6379:6379]
+ options: >-
+ --health-cmd "redis-cli ping"
+ --health-interval 5s
+ --health-timeout 3s
+ --health-retries 5
+ postgres:
+ image: postgres:16-alpine
+ env:
+ POSTGRES_USER: trading
+ POSTGRES_PASSWORD: trading
+ POSTGRES_DB: trading
+ ports: [5432:5432]
+ options: >-
+ --health-cmd pg_isready
+ --health-interval 5s
+ --health-timeout 3s
+ --health-retries 5
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/setup-python@v5
+ with:
+ python-version: "3.12"
+ - run: |
+ pip install -e shared/[dev]
+ pip install -e services/strategy-engine/[dev]
+ pip install -e services/data-collector/[dev]
+ pip install -e services/order-executor/[dev]
+ pip install -e services/portfolio-manager/[dev]
+ pip install -e services/news-collector/[dev]
+ pip install -e services/api/[dev]
+ pip install -e services/backtester/[dev]
+ pip install pytest-cov
+ - run: pytest -v --cov=shared/src --cov=services --cov-report=xml --cov-report=term-missing
+ env:
+ DATABASE_URL: postgresql+asyncpg://trading:trading@localhost:5432/trading
+ REDIS_URL: redis://localhost:6379
+ - uses: actions/upload-artifact@v4
+ with:
+ name: coverage-report
+ path: coverage.xml
+
+ docker:
+ runs-on: ubuntu-latest
+ needs: [lint, test]
+ if: github.ref == 'refs/heads/master'
+ steps:
+ - uses: actions/checkout@v4
+ - run: docker compose build --quiet