|
|
|
# This workflow will install Python dependencies, run tests and lint with a single version of Python
|
|
|
|
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
|
|
|
|
|
|
|
|
name: CLI Tests
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
pull_request:
|
|
|
|
workflow_dispatch:
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
python-version: ['3.7', '3.8', '3.9', '3.10']
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
|
|
uses: actions/setup-python@v5
|
|
|
|
with:
|
|
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
- name: Lint with flake8
|
|
|
|
run: |
|
|
|
|
pip install flake8
|
|
|
|
# stop the build if there are Python syntax errors or undefined names
|
|
|
|
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
|
|
|
|
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
|
|
|
|
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
|
|
|
|
- name: Install package
|
|
|
|
run: make install
|
|
|
|
- name: Cache models
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
key: models
|
|
|
|
path: /home/runner/.local/share/ocrd-resources/ocrd-sbb-binarize/*
|
|
|
|
- name: Install dependencies for test
|
|
|
|
# also downloads models, if not already present
|
|
|
|
run: make models test/assets
|
|
|
|
- name: Run tests
|
|
|
|
run: make test
|
|
|
|
- name: Setup upterm session when failure
|
|
|
|
if: failure()
|
|
|
|
uses: lhotari/action-upterm@v1
|
|
|
|
|