test/: added test with demo-whisper_2_3.pdf, but disable by default. #186
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
# Run test when triggering the workflow on push and pull request, | |
# but only for the master branch | |
name: test | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
# ----------------------------------------------------------------------------------------------------- | |
# To leverage the benefit of Github Action, the testing process is divided into three jobs: | |
# 1. pdf2docx: convert sample pdf to docx -> linux runner | |
# 2. docx2pdf: convert generated docx to pdf for comparing -> specific runner with MS Word installed | |
# 3. check_quality: convert page to image and compare similarity with python-opencv -> linux runner | |
# However, keep step 1 only, considering the difficulty to get a specific runner with MS Word installed. | |
# ----------------------------------------------------------------------------------------------------- | |
jobs: | |
pdf2docx-docker: | |
runs-on: ubuntu-latest | |
container: | |
image: python:3.8 | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v2 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install pytest | |
python setup.py develop | |
- name: Run unit test | |
run: | | |
pytest -v ./test/test.py::TestConversion | |
pdf2docx-ubuntu: | |
runs-on: ubuntu-latest | |
needs: pdf2docx-docker | |
strategy: | |
matrix: | |
python-version: ["3.8", "3.9", "3.10"] | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install pytest pytest-cov | |
python setup.py develop | |
- name: Run unit test | |
run: | | |
pytest -v ./test/test.py::TestConversion --cov=./pdf2docx --cov-report=xml | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v3 | |
with: # Or as an environment variable | |
token: ${{ secrets.CODECOV_TOKEN }} | |
# upload docx for further job | |
- name: Archive package | |
uses: actions/upload-artifact@v2 | |
with: | |
name: outputs | |
path: ./test/outputs |