Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Test OpenAlgo

on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]

jobs:
test:
runs-on: ubuntu-latest
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "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: Cache pip packages
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest pytest-cov pytest-timeout

- name: Create sample.env for testing
run: |
cp .sample.env .sample.env.backup || true

- name: Run tests with coverage
run: |
pytest test/test_env_check.py -v --cov=utils --cov-report=xml --cov-report=term-missing
- name: Upload coverage artifact
uses: actions/upload-artifact@v4
with:
name: coverage-xml
path: coverage.xml
# Note: Codecov upload removed to avoid requiring CODECOV_TOKEN on forks.
# Coverage XML is still uploaded as an artifact coverage-xml for reviewers to download.
27 changes: 27 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[pytest]
testpaths = test
python_files = test_*.py
python_classes = Test*
python_functions = test_*
addopts =
-v
--strict-markers
--tb=short
markers =
slow: marks tests as slow (deselect with '-m "not slow"')
integration: marks tests as integration tests
unit: marks tests as unit tests

[coverage:run]
source = utils
omit =
*/tests/*
*/test/*
*/__pycache__/*
*/venv/*
*/env/*

[coverage:report]
precision = 2
show_missing = True
skip_covered = False
Loading