Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add codecov and coverage threshold, hoist test requirements to setup.py #348

Merged
merged 7 commits into from
Mar 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 56 additions & 12 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: continuous-integration

on: [push, pull_request]

env:
COVERAGE_THRESHOLD: 62

jobs:

lint:
Expand All @@ -24,12 +27,29 @@ jobs:
with:
node-version: '10.x'

- name: Cache python wheels
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: |
${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('setup.py', 'docs/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python-version }}-
${{ runner.os }}-pip-

- name: Cache node_modules
uses: actions/cache@v2
with:
path: 'node_modules'
key: |
${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade pip setuptools wheel
python -m pip install --upgrade pre-commit
pip install -e .
yarn
python -m pip install -e .
yarn --frozen-lockfile

- name: Lint
run: |
Expand All @@ -50,21 +70,35 @@ jobs:
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}

- name: Cache python wheels
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: |
${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('setup.py', 'docs/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python-version }}-
${{ runner.os }}-pip-

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
pip install -r docs/requirements.txt
python -m pip install --upgrade pip setuptools wheel
python -m pip install -e .[coverage]

# Build the docs
- name: Build docs to store
run: |
export PATH="$HOME/miniconda/bin:$PATH"
sphinx-build -b html docs/ docs/_build/html -W --keep-going

# Run tests
# Run tests under coverage
- name: Run the tests
run: pytest
run: pytest --cov pydata_sphinx_theme --cov-report term-missing:skip-covered --cov-fail-under ${{ env.COVERAGE_THRESHOLD }}

- name: Upload coverage
if: ${{ always() }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose of this if statement, assuming that always is always true?

run: codecov

# Run local Lighthouse audit against built site
audit:
Expand All @@ -86,11 +120,21 @@ jobs:
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}

- name: Cache python wheels
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: |
${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('setup.py', 'docs/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python-version }}-
${{ runner.os }}-pip-

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
pip install -r docs/requirements.txt
python -m pip install --upgrade pip wheel setuptools
python -m pip install -e .[coverage]

# Build the docs
- name: Build docs to store
Expand Down Expand Up @@ -154,7 +198,7 @@ jobs:
python-version: 3.7
- name: Build package
run: |
pip install wheel
python -m pip install -U pip setuptools wheel
python setup.py sdist bdist_wheel
- name: Publish
uses: pypa/gh-action-pypi-publish@v1.1.0
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ include MANIFEST.in
include LICENSE
include README.md
include setup.py
include docs/requirements.txt

graft pydata_sphinx_theme

Expand Down
9 changes: 9 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ def find_version(*file_paths):
with open(os.path.join(HERE, "README.md"), encoding="utf-8") as f:
long_description = f.read()

tests_require = [
line.strip()
for line in read("docs", "requirements.txt").splitlines()
if not line.strip().startswith("#")
]

setup(
name="pydata-sphinx-theme",
Expand All @@ -44,6 +49,10 @@ def find_version(*file_paths):
# See http://www.sphinx-doc.org/en/stable/theming.html#distribute-your-theme-as-a-python-package
entry_points={"sphinx.html_themes": ["pydata_sphinx_theme = pydata_sphinx_theme"]},
install_requires=["sphinx", "beautifulsoup4"],
extras_require={
"test": tests_require,
"coverage": ["pytest-cov", "codecov", *tests_require],
},
python_requires=">=3.5",
classifiers=[
"Development Status :: 4 - Beta",
Expand Down