[WIP] Version 0.3 #251
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Run Tests | |
| on: | |
| push: | |
| branches: [ main, dev* ] | |
| pull_request: | |
| 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 | |
| uses: actions/checkout@v2 | |
| - name: Set up Python | |
| uses: actions/setup-python@v3 | |
| with: | |
| python-version: '3.10' | |
| - name: Cache Python dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ hashFiles('tests/requirements-core.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip- | |
| - name: Install core dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r tests/requirements-core.txt | |
| pip install coverage | |
| - 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}' | |
| 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 -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 | |
| - name: Set up Python | |
| uses: actions/setup-python@v3 | |
| with: | |
| python-version: '3.10' | |
| - name: Cache Python dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ hashFiles('tests/requirements-comparison.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip- | |
| - name: Install comparison dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r tests/requirements-comparison.txt | |
| - name: Run comparison tests with dependencies | |
| run: | | |
| python -m unittest tests/comparison/test_*.py |