chore: update pre-commit hooks #422
Workflow file for this run
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
# This workflow will install Python dependencies, run tests and lint with a single version of Python | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: CI | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
concurrency: | |
# Skip intermediate builds: always. | |
# Cancel intermediate builds: always. | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
pre-commit: | |
runs-on: ubuntu-latest | |
name: Check SDist | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
# TODO: Change '3.10.6' to '3.x' after updating mypy version | |
# See issue: https://github.com/python/mypy/issues/13627 | |
# "(might be included in mypy 0.980, if not it will be in mypy 0.990)" | |
python-version: 3.10.6 | |
- uses: pre-commit/action@v3.0.1 | |
build: | |
needs: pre-commit | |
runs-on: ${{ matrix.os }} | |
name: Build and test package | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install OCRed | |
run: | | |
python -m pip install .[dev] | |
- name: Install Tesseract OCR Engine on Ubuntu | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
sudo apt-get update | |
sudo apt-get install tesseract-ocr | |
- name: Install Tesseract OCR Engine on MacOS | |
if: matrix.os == 'macos-latest' | |
run: | | |
brew update | |
rm -f /usr/local/bin/2to3* | |
rm -f /usr/local/bin/idle3* | |
rm -f /usr/local/bin/pydoc3* | |
rm -f /usr/local/bin/python3* | |
brew install tesseract-lang | |
- name: Run unit tests and generate coverage report | |
run: | | |
python -m pytest -ra --cov=ocred tests/ | |
- name: Upload coverage report | |
uses: codecov/codecov-action@v4.3.0 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
docs: | |
needs: pre-commit | |
runs-on: ubuntu-latest | |
name: Build and test documentation | |
strategy: | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.9 | |
- name: Install Tesseract OCR Engine | |
run: | | |
sudo apt-get update | |
sudo apt-get install tesseract-ocr | |
- name: Install ocred with doc dependencies | |
run: python -m pip install -e .[dev,docs] | |
- name: Run doctests | |
run: xdoctest ./ocred/ | |
- name: Build docs | |
run: mkdocs build |