-
-
Notifications
You must be signed in to change notification settings - Fork 876
51 lines (40 loc) · 1.17 KB
/
python-build.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
name: Test and Build Python Package
on:
push:
branches:
- main
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install dependencies
run: |
pip3 install -U pip
pip3 install -e .[dev]
- name: Test - Code format
run: |
black --check --diff --color pdf2zh/*.py
flake8 --ignore E203,E261,E501,W503,E741
- name: Test - Unit Test
run: |
pytest .
- name: Test - Translate a PDF file with plain text only
run:
pdf2zh ./test/file/translate.cli.plain.text.pdf
- name: Test - Translate a PDF file figure
run:
pdf2zh ./test/file/translate.cli.text.with.figure.pdf
# - name: Test - Translate a PDF file with unknown font
# run:
# pdf2zh ./test/file/translate.cli.font.unknown.pdf
- name: Test - Start GUI and exit
run:
timeout 10 pdf2zh -i || code=$?; if [[ $code -ne 124 && $code -ne 0 ]]; then exit $code; fi
- name: Build as a package
run: python -m build