FIX: minor fix for pre-commit (#267) #637
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: continuous-integration | |
on: | |
push: | |
branches: [main] | |
tags: | |
- 'v*' | |
pull_request: | |
jobs: | |
pre-commit: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- uses: pre-commit/[email protected] | |
tests: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
python-version: ["3.11"] | |
# Only test the latest major release of Sphinx because otherwise we need to | |
# keep multiple versions of regression tests on file and this creates lots of | |
# noise in the tests. | |
sphinx: ["~=5.0"] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: "pip" | |
cache-dependency-path: "pyproject.toml" | |
- name: Install dependencies with Sphinx ${{ matrix.sphinx }} | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install --upgrade "sphinx${{matrix.sphinx}}" -e .[test] --pre | |
- name: Run pytest | |
run: > | |
pytest --durations=10 --cov=quantecon_book_theme --cov-report=xml --cov-report=term-missing | |
- name: Upload to Codecov | |
if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.11 && github.repository == 'QuantEcon/quantecon-book-theme' && github.event_name == 'pull_request' | |
uses: codecov/[email protected] | |
with: | |
name: ebp-qbt-pytests-py3.7 | |
flags: pytests | |
file: ./coverage.xml | |
fail_ci_if_error: true | |
publish: | |
name: Publish to PyPi | |
needs: [pre-commit, tests] | |
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v4 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: Build package | |
run: | | |
python -m pip install -U pip build | |
python -m build | |
- name: Publish | |
uses: pypa/[email protected] | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_KEY }} |