-
Notifications
You must be signed in to change notification settings - Fork 21
168 lines (141 loc) · 4.87 KB
/
tests.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
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
name: tests
on:
push:
branches: [main]
pull_request:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Allows usage from other workflows
workflow_call:
jobs:
format-and-types:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '22'
- name: Report node version
run: node --version
- name: report python version
run: python --version
- name: Install linters and formatters
run: python -m pip install flake8 black mypy
- name: Install poetry
run: python -m pip install poetry
- name: Initialize project
run: |
python -m poetry install
python -m poetry run python scripts/fetch_core.py
- name: Check formatting with black
run: python -m poetry run black --check --diff $(git ls-files "*.py")
- name: Check for lint
run: python -m poetry run flake8
- name: Check types
run: python -m poetry run mypy --install-types --non-interactive
deep-test:
needs: format-and-types
runs-on: ubuntu-22.04
#container: oscarlevin/pretext:full
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: set up node
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Report Python version
run: python --version
- name: Install apt packages (Linux with python 3.12 only)
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends texlive texlive-science texlive-xetex ghostscript pdf2svg texlive-fonts-extra sagemath python3-pip
- name: Install poetry 1.8.4
run: |
python -m pip install --upgrade pip
python -m pip install poetry==1.8.4
- name: View poetry --help
run: poetry --help
- name: Install dependencies
shell: bash
run: |
python -m poetry install --all-extras
python -m poetry run python scripts/fetch_core.py
- name: Ensure dependencies are present
run: |
echo "manually installing pelican; poetry does not seem to do this correctly."
python -m poetry run pip install pelican
python -m poetry run pelican --version
- name: Test with pytest
run: |
python -m poetry run pytest -v --cov
broad-tests:
needs: format-and-types
strategy:
fail-fast: true
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
poetry-version: ["1.8.4"]
os: [ubuntu-latest, windows-latest]
exclude:
- os: windows-latest
python-version: "3.8"
- os: windows-latest
python-version: "3.9"
- os: windows-latest
python-version: "3.10"
- os: windows-latest
python-version: "3.11"
- os: ubuntu-latest
python-version: "3.12"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: set up node
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Install poetry ${{ matrix.poetry-version }}
run: |
python -m ensurepip
python -m pip install --upgrade pip
python -m pip install poetry==${{ matrix.poetry-version }}
- name: View poetry --help
run: poetry --help
- name: Install build dependencies if on Linux
if: runner.os == 'Linux'
run: sudo apt-get -y install libcairo2-dev pkg-config python3-dev
- name: Install dependencies
shell: bash
run: |
python -m poetry install --all-extras
python -m poetry run python scripts/fetch_core.py
- name: Ensure dependencies are present
run: |
echo "manually installing pelican; poetry does not seem to do this correctly."
python -m poetry run pip install pelican
python -m poetry run pelican --version
- name: Test with pytest
run: |
python -m poetry run pytest -v --cov
schema:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: awalsh128/[email protected]
with:
packages: jing trang
version: 1.0
- name: Make sure Schema rnc and rng files in sync via TRANG
run: |
trang ./schema/project-ptx.rnc ./tmp-project-ptx.rng
cmp ./schema/project-ptx.rng ./tmp-project-ptx.rng
- name: Verify template `project.ptx` match schema via JING
run: |
for i in $(find ./templates -name "project.ptx"); do jing ./schema/project-ptx.rng "$i"; done