Article Fixes #236
This file contains 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: Python tests | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- python/** | |
- .github/workflows/** | |
pull_request: | |
paths: | |
- python/** | |
jobs: | |
Tests: | |
runs-on: ${{matrix.os}} | |
name: pdstools (Python ${{ matrix.python-version }}) on ${{ matrix.os }} | |
strategy: | |
fail-fast: true | |
matrix: | |
os: [ubuntu-latest, windows-latest, macOS-latest] | |
python-version: [3.8.x, 3.9.x, 3.11.x] | |
exclude: | |
- os: windows-latest | |
python-version: 3.8.x | |
- os: windows-latest | |
python-version: 3.9.x | |
- os: macOS-latest | |
python-version: 3.8.x | |
- os: macOS-latest | |
python-version: 3.9.x | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install Python ${{matrix.python-version}} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{matrix.python-version}} | |
- name: Upgrade pip | |
run: | | |
python3 -m pip install --upgrade pip | |
- name: Get pip cache dir | |
id: pip-cache | |
run: echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT | |
- name: Cache dependencies | |
continue-on-error: true | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.pip-cache.outputs.dir }} | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt') }}-{{matrix.python-version}} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r python/requirements.txt | |
pip install pytest-cov | |
pip install scipy | |
pip install testbook | |
pip install XlsxWriter | |
pip install ipython | |
pip install ipykernel | |
ipython kernel install --name "python3" --user | |
- name: Run tests | |
run: pytest --cov=./python/pdstools --cov-report=xml --cov-config=./python/tests/.coveragerc --ignore=python/tests/test_healthcheck.py | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
fail_ci_if_error: true |