-
Notifications
You must be signed in to change notification settings - Fork 1
105 lines (82 loc) · 2.83 KB
/
Copy pathci.yml
File metadata and controls
105 lines (82 loc) · 2.83 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
name: CI
env:
LIBREOFFICE_VERSION: "26.2.3"
permissions:
contents: read
pull-requests: write
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
lint:
if: github.repository == 'dfk1352/LibreOffice-skills'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
version: "latest"
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install dependencies
run: uv sync
- name: Ruff check
run: uv run ruff check
- name: Ruff format check
run: uv run ruff format --check
- name: Mypy
run: uv run mypy src/
test:
if: github.repository == 'dfk1352/LibreOffice-skills'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
version: "latest"
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install LibreOffice 26.2
run: |
sudo apt-get update
sudo apt-get install -y libxinerama1 libcairo2 libcups2 libdbus-1-3 libfontconfig1 libfreetype6 libgcc-s1 libglib2.0-0 libgtk-3-0 libnss3 libpango-1.0-0 libx11-6 libxext6 libxrender1 libxml2 wget tar
base_url="https://download.documentfoundation.org/libreoffice/stable/${LIBREOFFICE_VERSION}/deb/x86_64"
archive="LibreOffice_${LIBREOFFICE_VERSION}_Linux_x86-64_deb.tar.gz"
wget -q "${base_url}/${archive}"
tar -xzf "${archive}"
extract_dir="$(ARCHIVE="${archive}" python3 - <<'PY'
import os
import tarfile
with tarfile.open(os.environ["ARCHIVE"]) as tf:
roots = sorted({name.split('/', 1)[0] for name in tf.getnames() if name})
if len(roots) != 1:
raise SystemExit(f"Expected one archive root, found: {roots}")
print(roots[0])
PY
)"
sudo dpkg -i "${extract_dir}"/DEBS/*.deb || sudo apt-get install -fy
echo "/opt/libreoffice${LIBREOFFICE_VERSION%.*}/program" >> "$GITHUB_PATH"
echo "LIBREOFFICE_PROGRAM_PATH=/opt/libreoffice${LIBREOFFICE_VERSION%.*}/program" >> "$GITHUB_ENV"
- name: Install dependencies
run: uv sync
- name: Run unit tests
run: >
uv run pytest tests/
--ignore=tests/writer/test_writer_workflows.py
--ignore=tests/calc/test_calc_workflows.py
--ignore=tests/impress/test_impress_workflows.py
--cov=src
--cov-report=xml
- name: Upload coverage report
uses: actions/upload-artifact@v6
with:
name: coverage-report
path: coverage.xml