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
67 changes: 54 additions & 13 deletions .github/workflows/run-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@ name: Run Tests

on:
push:
branches: [ main ]
branches: [ main, dev* ]
pull_request:
branches: [ main ]
branches: [ main, dev* ]

jobs:
test-core:
runs-on: ubuntu-latest

# 1. Set global environment variables to prevent threading crashes
env:
OMP_NUM_THREADS: '1'
MKL_NUM_THREADS: '1'
OPENBLAS_NUM_THREADS: '1'

steps:
- name: Check out repository
Expand All @@ -35,23 +41,59 @@ jobs:

- name: Run core tests with coverage
run: |
pip uninstall numba -y
python -m coverage run --source=bm25s -m unittest discover tests/core

COVERAGE_OUTPUT=$(python -m coverage report --omit="*/tests/*,*/numba/*")
echo "$COVERAGE_OUTPUT"
echo "Coverage percentage:"
echo "$COVERAGE_OUTPUT" | tail -1 | awk '{print "Total Coverage: " $4}'

- name: Install Numba
run: |
pip install "numba>=0.60.0"
echo "$COVERAGE_OUTPUT" | tail -1 | awk '{print "Total Coverage: " $4}'

test-numba:
runs-on: ubuntu-latest
env:
DISABLE_TQDM: '1'
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.10'
- name: Install Numba dependencies
run: |
pip install "numba>=0.62.0"
pip install -r tests/requirements-core.txt
# Ensure we don't have conflicting versions
pip install --upgrade numpy
- name: Run numba tests
run: |
python -m unittest tests/numba/test_*.py
test-comparison:
python -X faulthandler -m unittest discover tests/numba

test-high-level:
runs-on: ubuntu-latest
env:
OMP_NUM_THREADS: '1'
MKL_NUM_THREADS: '1'
OPENBLAS_NUM_THREADS: '1'
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.10'
- name: Install high-level dependencies
run: |
pip install "numba>=0.62.0"
pip install -r tests/requirements-core.txt
pip install --upgrade numpy
- name: Run high-level tests
run: |
python -X faulthandler -m unittest discover tests/high_level

test-comparison:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v2
Expand All @@ -60,8 +102,7 @@ jobs:
uses: actions/setup-python@v3
with:
python-version: '3.10'



- name: Cache Python dependencies
uses: actions/cache@v4
with:
Expand All @@ -77,4 +118,4 @@ jobs:

- name: Run comparison tests with dependencies
run: |
python -m unittest tests/comparison/test_*.py
python -m unittest tests/comparison/test_*.py
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -179,4 +179,7 @@ elasticsearch-*/
# inference benchmarks
benchmark/inference/models/
comparison_results
bm25s_indices/
bm25s_indices/
# Ignore test indices
test_index/
test_index_mcp/
Loading
Loading