-
Notifications
You must be signed in to change notification settings - Fork 390
88 lines (66 loc) · 2.4 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# 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