Skip to content

Merge pull request #147 from scikit-hep/dependabot/github_actions/act… #364

Merge pull request #147 from scikit-hep/dependabot/github_actions/act…

Merge pull request #147 from scikit-hep/dependabot/github_actions/act… #364

Workflow file for this run

name: CI
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
on:
pull_request:
push:
branches: [ "master"]
release:
types:
- "published"
jobs:
pre-commit:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
checks:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
include:
- os: windows-latest
python-version: "3.8"
- os: windows-latest
python-version: "3.11"
- os: macos-latest
python-version: "3.8"
- os: macos-latest
python-version: "3.11"
name: Check Python ${{ matrix.python-version }} ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: pip cache
uses: actions/[email protected]
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.cfg') }}-pip-${{ hashFiles('**/setup.py') }}-pip-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install package
run: python -m pip install -e .[test] pytest-xdist # for multiprocessing
- name: Test package
run: python -m pytest --doctest-modules --cov=hepstats --cov-report=xml -n3
- name: Upload coverage to Codecov
if: matrix.python-version == '3.11' && matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }} # technically not needed, but prevents failures: https://community.codecov.com/t/upload-issues-unable-to-locate-build-via-github-actions-api/3954
file: ./coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false # flaky upload...
dist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build
run: pipx run build
- uses: actions/upload-artifact@v4
with:
path: dist/*
- name: Check metadata
run: pipx run twine check dist/*
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: |
pip install -U -q -e .[docs]
pip list
- name: build docs
run: |
sphinx-build -b html docs docs/_build/html
touch docs/_build/html/.nojekyll
- name: Deploy docs to GitHub Pages
if: success() && github.event_name == 'push' && github.ref == 'refs/heads/master'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_build/html
force_orphan: true
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
commit_message: Deploy to GitHub pages
publish:
needs: [ dist ]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v4
with:
name: artifact
path: dist
- uses: pypa/[email protected]
with:
password: ${{ secrets.pypi_password }}