-
Notifications
You must be signed in to change notification settings - Fork 0
149 lines (125 loc) · 3.83 KB
/
Copy pathci.yml
File metadata and controls
149 lines (125 loc) · 3.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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
# Cancel in-progress runs if a new push is made to the same branch
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint-and-type:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip' # Enable pip caching
- name: Install dependencies
run: |
pip install -e '.[test]'
- name: Check formatting (ruff)
run: ruff format --check .
- name: Lint (ruff)
run: ruff check .
- name: Type check (mypy)
run: mypy src/asciidoctrine
build-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
- name: Install dependencies
run: pip install -e '.[docs]'
- name: Build documentation
run: sphinx-build -W -b html docs/ docs/_build/html
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false # Don't cancel other matrix jobs if one fails
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: 'vendor/asciidoc-tck/package-lock.json'
- name: Install dependencies
run: |
pip install -e '.[test]'
pip install coverage pytest-cov
- name: Run Core Tests with Coverage
run: |
coverage erase
coverage run --parallel-mode --source=src/asciidoctrine -m pytest --ignore=tests/test_tck.py --ignore=tests/test_doctest_parsing.py
- name: Run TCK with Coverage
run: |
chmod +x run-tck-coverage.sh
./run-tck-coverage.sh
- name: Run DocTest Parsing with Coverage
run: |
coverage run --parallel-mode --source=src/asciidoctrine -m pytest tests/test_doctest_parsing.py
- name: Combine and Check Coverage
run: |
coverage combine
coverage report --show-missing --fail-under=75
coverage html # Generate HTML report for artifact
- name: Upload coverage report
uses: actions/upload-artifact@v4
with:
name: coverage-report-${{ matrix.python-version }}
path: htmlcov/
if-no-files-found: ignore
test-pyodide:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: false
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: |
pip install build pytest-pyodide
- name: Build wheel
run: |
python -m build --wheel
# Download lark dependency into dist directory for pyodide to find it
pip download lark -d dist/
# Download and extract pyodide distribution
curl -L https://github.com/pyodide/pyodide/releases/download/0.27.2/pyodide-0.27.2.tar.bz2 -o pyodide.tar.bz2
tar -xjf pyodide.tar.bz2
cp -r pyodide/* dist/
rm -rf pyodide pyodide.tar.bz2
- name: Run tests under Pyodide
run: |
# Use node runtime for headless CI
pytest --runtime node --dist-dir dist/ tests/test_functional.py