-
Notifications
You must be signed in to change notification settings - Fork 0
124 lines (108 loc) · 4.17 KB
/
Copy pathpython.yml
File metadata and controls
124 lines (108 loc) · 4.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
name: Python
on:
push:
branches: [main, dev]
paths:
- python/**
- mdi-core/**
- .github/workflows/python.yml
- .github/workflows/release-pypi.yml
pull_request:
paths:
- python/**
- mdi-core/**
- .github/workflows/python.yml
- .github/workflows/release-pypi.yml
jobs:
test:
name: Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.14']
defaults:
run:
working-directory: python
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: python/pyproject.toml
- uses: actions/setup-java@v4
if: matrix.python-version == '3.14'
with:
distribution: temurin
java-version: "21"
- uses: actions/setup-dotnet@v4
if: matrix.python-version == '3.14'
with:
dotnet-version: "8.0.x"
- uses: actions/setup-node@v4
if: matrix.python-version == '3.14'
with:
node-version: "22"
- name: Build the native extension and install test dependencies
run: python -m pip install -e '.[test]'
# pyproject.toml sets branch coverage and fails below 95%; this command
# makes the threshold a merge gate rather than a reporting-only metric.
- name: Run public API tests with coverage gate
run: python -m pytest --cov=mdi --cov-branch --cov-report=term-missing --cov-report=xml
- name: Install authoritative publication-format consumers
if: matrix.python-version == '3.14'
working-directory: ${{ github.workspace }}
run: |
sudo apt-get update
sudo apt-get install --yes libreoffice-writer
curl --fail --location --silent --show-error \
https://github.com/w3c/epubcheck/releases/download/v5.3.0/epubcheck-5.3.0.zip \
--output "$RUNNER_TEMP/epubcheck.zip"
unzip -q "$RUNNER_TEMP/epubcheck.zip" -d "$RUNNER_TEMP"
npm install --prefix "$RUNNER_TEMP/vnu" --no-save vnu-jar@25.12.31
- name: Generate every public Python format
if: matrix.python-version == '3.14'
working-directory: ${{ github.workspace }}
run: |
python python/tests/test_package_smoke.py \
--output-dir "$RUNNER_TEMP/python-package-smoke"
- name: Validate HTML with the Nu Html Checker
if: matrix.python-version == '3.14'
working-directory: ${{ github.workspace }}
run: |
java -jar \
"$RUNNER_TEMP/vnu/node_modules/vnu-jar/build/dist/vnu.jar" \
--errors-only "$RUNNER_TEMP/python-package-smoke/smoke.html"
- name: Validate EPUB with the official W3C EPUBCheck
if: matrix.python-version == '3.14'
working-directory: ${{ github.workspace }}
run: |
java -jar "$RUNNER_TEMP/epubcheck-5.3.0/epubcheck.jar" \
"$RUNNER_TEMP/python-package-smoke/smoke.epub"
- name: Validate DOCX with the Open XML SDK
if: matrix.python-version == '3.14'
working-directory: ${{ github.workspace }}
run: |
dotnet run \
--project nodejs/format-contracts/openxml-validator/OpenXmlValidator.csproj \
-- "$RUNNER_TEMP/python-package-smoke/smoke.docx"
- name: Open DOCX with LibreOffice Writer
if: matrix.python-version == '3.14'
working-directory: ${{ github.workspace }}
run: |
mkdir -p "$RUNNER_TEMP/libreoffice-output"
soffice \
"-env:UserInstallation=file://$RUNNER_TEMP/libreoffice-profile" \
--headless \
--convert-to pdf \
--outdir "$RUNNER_TEMP/libreoffice-output" \
"$RUNNER_TEMP/python-package-smoke/smoke.docx"
test -s "$RUNNER_TEMP/libreoffice-output/smoke.pdf"
- name: Upload Python coverage
if: matrix.python-version == '3.14'
uses: actions/upload-artifact@v4
with:
name: python-coverage
path: python/coverage.xml