Skip to content

Reduce frequency of pre-commit autoupdates (#3246) #4

Reduce frequency of pre-commit autoupdates (#3246)

Reduce frequency of pre-commit autoupdates (#3246) #4

Workflow file for this run

name: tests
on:
push:
branches:
- master
pull_request:
branches:
- master
paths:
- "shap/**"
- "tests/**"
- "data/**"
- ".github/workflows/run_tests.yml"
- "pyproject.toml"
- "setup.py"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
run_tests:
strategy:
matrix:
os: ["ubuntu-latest"]
# The total number of matrix jobs should match codecov.yml `after_n_builds`.
python-version: ["3.8", "3.9", "3.10", "3.11"]
extras: ["test"]
include:
# Test on windows/mac, just one job each
- os: windows-latest
python-version: "3.11"
extras: "test"
- os: macos-latest
python-version: "3.11"
extras: "test"
# Run tests with only the core dependencies, to ensure we
# cover the latest version of numpy/pandas. See dsgibbons#46
- os: ubuntu-latest
python-version: "3.11"
extras: "test-core"
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Cache python libs
uses: actions/cache@v3
if: matrix.extras == 'test'
with:
path: |
# Only cache a subset of libraries, ensuring cache size remains under 10GB. See dsgibbons#42
${{ env.pythonLocation }}/**/site-packages/pyspark*
${{ env.pythonLocation }}/**/site-packages/nvidia*
${{ env.pythonLocation }}/**/site-packages/torch*
${{ env.pythonLocation }}/**/site-packages/functorch*
key: ${{ runner.os }}-${{ matrix.python-version }}-${{ env.pythonLocation }}-${{ hashFiles('setup.py', 'pyproject.toml') }}-0
- name: Install dependencies
run: |
python -m pip install --upgrade pip
# Use "eager" update strategy in case cached dependencies are outdated
# Using regular install NOT editable install: see GH #3020
pip install --upgrade --upgrade-strategy eager '.[${{ matrix.extras }},plots]'
- name: Test with pytest
# Ensure we avoid adding current working directory to sys.path:
# - Use "pytest" over "python -m pytest"
# - Use "append" import mode rather than default "prepend"
run: >
pytest --durations=20
--cov --cov-report=xml
--mpl-generate-summary=html --mpl-results-path=./mpl-results
--import-mode=append
- name: Upload mpl test report
if: failure()
uses: actions/upload-artifact@v3
with:
name: mpl-results-${{ matrix.python-version }}-${{ runner.os }}-${{ matrix.extras }}
path: mpl-results/
if-no-files-found: ignore
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3