-
Notifications
You must be signed in to change notification settings - Fork 46
92 lines (87 loc) · 3.17 KB
/
github-ci.yaml
File metadata and controls
92 lines (87 loc) · 3.17 KB
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
89
90
91
92
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
tests:
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
platform: [ubuntu-latest, windows-latest, macos-latest]
name: pytest on ${{ matrix.python-version }} / ${{ matrix.platform }}
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout Code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
submodules: 'recursive'
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip
run: python -m pip install --upgrade pip
- name: Install requirements
run: pip install . --group dev
- name: Install pdfly
if: matrix.python-version != '3.8'
run: pip install .
- name: Install pdfly using the minimal versions of the dependencies
if: matrix.python-version == '3.8'
run: |
# We ensure that those minimal versions remain compatible:
sed -i '/dependencies = \[/,/\]/s/>=/==/' pyproject.toml
pip install .
- name: Run tests
run: pytest -vv
codestyle:
name: Check code with black, mypy, ruff & typos
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
submodules: 'recursive'
- name: Cache Downloaded Files
id: cache-downloaded-files
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
with:
path: '**/tests/pdf_cache/*'
key: cache-downloaded-files
- name: Upgrade pip, install pdfly and its dev dependencies
run: |
python -m pip install --upgrade pip
pip install .
pip install . --group dev
- name: Lint with black
run: black --check --extend-exclude sample-files .
- name: Lint with mypy
run: mypy . --ignore-missing-imports --exclude build
- name: Test with ruff
run: ruff check pdfly/
- name: Spell Check Repo
uses: crate-ci/typos@06d010dfe4c84fdab1a25ea02b57b3585018ba80 # v1.42.3
package:
name: Build & verify package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{env.PYTHON_LATEST}}
- name: Build package
run: |
python -m pip install flit check-wheel-contents
flit build
ls -l dist
check-wheel-contents dist/*.whl
- name: Test installing package
run: python -m pip install .
- name: Test running installed package
working-directory: /tmp
run: python -c "import pdfly;print(pdfly.__version__)"