CLI Tests #43
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://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | |
name: CLI Tests | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
workflow_dispatch: | |
inputs: | |
upterm-session: | |
description: 'Run SSH login server for debugging' | |
default: False | |
type: boolean | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ['3.7', '3.8', '3.9'] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
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: Setup upterm session | |
# interactive SSH logins for debugging | |
if: github.event.inputs.upterm-session == 'true' | |
uses: lhotari/action-upterm@v1 | |
- name: Install dependencies | |
run: make deps | |
- name: Install package | |
run: make install | |
- name: Cache models | |
uses: actions/cache@v3 | |
with: | |
key: detectron-models | |
path: /home/runner/.local/share/ocrd-resources/ocrd-detectron2-segment/* | |
- name: Install dependencies for test | |
# also downloads models, if not already present | |
run: make deps-test | |
- name: Run tests | |
run: make test | |
- name: Upload test results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test-results | |
path: | | |
./test/assets/*/data/test-result | |
./test/assets/*/data/OCR-D-SEG-*/ | |
if-no-files-found: error | |
publish: | |
permissions: | |
# for stefanzweifel/git-auto-commit-action to push code on gh-pages | |
contents: write | |
needs: build | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
steps: | |
- name: Checkout GH Pages | |
uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3.4.0 | |
with: | |
ref: gh-pages | |
- name: Download Artifact | |
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
with: | |
name: test-results | |
path: test-results | |
- name: Data Ingest | |
run: bash gen-test-results-table.sh | |
- name: Commit | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: new test results from ${{ github.sha }} | |
branch: gh-pages | |
# file_pattern: test-results* | |
repository: . | |