Parallelize examples with joblib (closes #5) #304
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
| # This workflow will install Python dependencies, run tests and lint with a variety of Python versions | |
| # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | |
| name: Ruff and pytest | |
| on: | |
| push: | |
| branches: [ "*" ] | |
| pull_request: | |
| branches: [ "*" ] | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.12" | |
| cache: 'pip' | |
| - name: Install ruff | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install ruff | |
| - name: Lint with ruff (blocking; same gate as old flake8 E9/F63/F7/F82) | |
| run: ruff check . --select=E9,F63,F7,F82 | |
| - name: Lint with ruff (full ruleset from ruff.toml; informational only) | |
| run: ruff check . --exit-zero | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] | |
| # Run once without Numba (JIT path skipped via ImportError) and once with | |
| # Numba installed (JIT path exercised, including IRV/Coombs rank scans). | |
| extras: ["test", "test,fast"] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: 'pip' | |
| # You can test your matrix by printing the current Python version | |
| - name: Display Python version | |
| run: python -c "import sys; print(sys.version)" | |
| - name: Install package | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e ".[${{ matrix.extras }}]" | |
| - name: Verify Numba installation (fast extra) | |
| if: contains(matrix.extras, 'fast') | |
| run: | | |
| python -c "import numba; from elsim.methods import _common; assert _common.numba_enabled; print('numba', numba.__version__)" | |
| - name: Test with pytest and generate coverage report | |
| run: | | |
| pytest --cov=./ --cov-report=xml | |
| - name: Upload coverage to Codecov | |
| if: matrix.python-version == '3.12' | |
| uses: codecov/codecov-action@v6 | |
| with: | |
| files: ./coverage.xml | |
| fail_ci_if_error: true | |
| verbose: true | |
| flags: ${{ contains(matrix.extras, 'fast') && 'numba' || 'no-numba' }} | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |