[pre-commit.ci] pre-commit autoupdate #313
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: testing | |
on: | |
push: | |
branches: [main, develop, rc] | |
pull_request: | |
branches: [main, develop] | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
# Python 3.11 is blocked by the following issue: https://github.com/h5py/h5py/issues/2146 | |
python-version: ["3.8", "3.9", "3.10"] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
# https://github.com/actions/cache/blob/main/examples.md#python---pip | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('**/setup.py') }} | |
restore-keys: | | |
${{ runner.os }}-${{ matrix.python-version }}-pip- | |
- name: Install | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install -e .[dev] | |
- name: Test with pytest | |
run: | | |
python -m pytest -v --cov=spgrep --cov-config=setup.cfg --cov-report=xml tests/ | |
- name: Upload coverage to Codecov | |
if: matrix.python-version == '3.9' | |
uses: codecov/codecov-action@v4 | |
with: | |
file: ./coverage.xml | |
flags: unittests | |
fail_ci_if_error: false | |
docs: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.9" | |
- name: Install dependencies | |
run: | | |
sudo apt-get install -y pandoc | |
- name: Install | |
run: | | |
python -m pip install --upgrade pip | |
pip install -e .[dev,docs] | |
- name: Build | |
run: | | |
sphinx-build docs docs_build | |
- name: Deploy docs at develop branch | |
if: ${{ github.ref == 'refs/heads/develop' }} | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }} | |
publish_dir: ./docs_build | |
destination_dir: develop |