forked from metamath/set.mm
-
Notifications
You must be signed in to change notification settings - Fork 0
354 lines (340 loc) · 16.4 KB
/
verifiers.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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
name: verifiers
on: [push, pull_request, workflow_dispatch]
# Run many verifiers on metamath files.
# We *primarily* check set.mm and iset.mm, but we also run some checks on
# other files (in particular on some HTML files).
#
# Only one verifier is necessary, but using multiple verifiers counters
# the risk that a verifier might have a defect in its implementation.
# With 4 verifiers, all 4 would have to have a defect involving an
# invalid theorem for that invalid theorem to be accepted as valid.
# This is unlikely, because the verifiers are written by different people
# in different languages. This can be considered extreme peer review, where
# every reviewer is separately checking each step.
# Some of these verifiers also check for style,
# so using multiple verifiers can also detect many different style problems.
#
# Note that one of the checks is scripts/verify.
#
# We report an error if the list of "discouraged" results is unexpected;
# this makes it easy to detect changes (which can then be specially reviewed).
# To regenerate the "discouraged" file, you can run scripts/gen-discouraged
#
# We typically rewrap the file using scripts/rewrap.
# TODO: We aren't caching many old results; add caches
# (e.g., of unchanged compiled programs) to speed things further.
# In each job we download, build, install, and run a verifier.
# NOTE: We generally install programs in $HOME/bin, so ensure that's on the
# PATH (usually it is on any non-Windows system).
jobs:
###########################################################
skip_dups:
name: Check for duplicate jobs to avoid duplication
# continue-on-error: true # Uncomment once integration is finished
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@master
with:
github_token: ${{ github.token }}
paths_ignore: '["**/README.md", "**/docs/**"]'
###########################################################
checkmm:
name: Verify using checkmm (a C++ verifier by Eric Schmidt)
runs-on: ubuntu-latest
needs: skip_dups
if: ${{ needs.skip_dups.outputs.should_skip != 'true' }}
steps:
# By default checkout fetches a single commit, which is what we want.
# See: https://github.com/actions/checkout
- uses: actions/checkout@v3
- run: echo 'Starting'
- run: pwd
- run: ls -l
- run: g++ --version
# Get and compile checkmm, a C++ verifier by Eric Schmidt
- run: wget -N https://github.com/metamath/metamath-website-seed/raw/main/downloads/checkmm.cpp
- run: g++ -O2 -o checkmm checkmm.cpp
# Use it to verify set.mm and iset.mm
- run: ./checkmm set.mm
- run: ./checkmm iset.mm
###########################################################
metamathexe:
name: Verify using metamath.exe (original C verifier by Norman Megill)
runs-on: ubuntu-latest
needs: skip_dups
if: ${{ needs.skip_dups.outputs.should_skip != 'true' }}
steps:
- uses: actions/checkout@v3
# Use GITHUB_PATH to set PATH. For details see:
# https://docs.github.com/en/free-pro-team@latest/actions/reference/
# workflow-commands-for-github-actions#setting-an-environment-variable
- name: Ensure ~/bin is in PATH
run: |
echo "$HOME/bin" >> "$GITHUB_PATH"
mkdir -p "$HOME/bin"
- name: Get metamath C program and supporting files
run: scripts/download-metamath
- name: Record latest version of metamath as env variable
run: |
dirname=$(zipinfo -1 metamath-program.zip | head -1)
dirname=${dirname#metamath-metamath-exe-}
echo "METAMATH_LATEST_VERSION=${dirname%/}" >> $GITHUB_ENV
# Note: cache key includes version of metamath in use
- name: Cache metamathexe
id: cache-metamathexe
uses: actions/cache@v3
env:
cache-name: cache-metamathexe
with:
path: ~/bin/metamath
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.METAMATH_LATEST_VERSION }}
- name: Build/install metamath, a C verifier (and more) by Norm Megill
if: ${{ !steps.cache-metamathexe.outputs.cache-hit }}
run: |
gcc --version
scripts/build-metamath
# Create mmset.html and mmil.html so we can verify against them.
- run: metamath 'read set.mm' 'markup mmset.raw.html mmset.html /ALT /CSS' quit
- run: metamath 'read iset.mm' 'markup mmil.raw.html mmil.html /ALT /CSS' quit
- run: mv mmbiblio.raw.html mmbiblio.html || true
- run: scripts/verify --top_date_skip --extra 'write bibliography mmbiblio.html' set.mm
- run: scripts/verify --top_date_skip iset.mm
- run: ls -1 *.mm | sed -e '/^set\.mm$/d' -e '/^iset\.mm$/d' | while read db; do scripts/verify --top_date_skip --no-verify-markup "$db"; done
- run: scripts/check-raw-html set.mm mmcomplex.raw.html mmdeduction.raw.html mmnatded.raw.html mmnf.raw.html mmset.raw.html mmzfcnd.raw.html mmfrege.raw.html
- run: scripts/check-raw-html iset.mm mmil.raw.html
# Generate HTML from raw files into mpegif-html/ and mpeuni-html/
- run: scripts/regen-from-raw --force '/HTML' .regened.html
- run: mkdir -p mpegif-html/
- run: for f in *.regened.html; do mv $f mpegif-html/${f%.regened.html}.html ; done
- run: scripts/regen-from-raw --force '/ALT_HTML' .regened.html
- run: mkdir -p mpeuni-html/
- run: for f in *.regened.html; do mv $f mpeuni-html/${f%.regened.html}.html ; done
# Check that set.mm and iset.mm have been rewrapped.
# We'd probably rather have a bot push up a commit with the rewrapping
# when a pull request is submitted, but until we set that up,
# at least check that the rewrapping has been done.
- run: cp set.mm set-wrapped.mm
- run: scripts/rewrap set-wrapped.mm
- run: echo 'Checking for set.mm rewrapping:' && diff -U 0 set.mm set-wrapped.mm
- run: cp iset.mm iset-wrapped.mm
- run: scripts/rewrap iset-wrapped.mm
- run: echo 'Checking for iset.mm rewrapping:' && diff -U 0 iset.mm iset-wrapped.mm
# The following checks are arbitrarily included in the metamath job.
- run: echo 'Looking for tabs (not allowed)...' && ! grep "$(printf '\t')" set.mm
- run: echo 'Looking for tabs (not allowed)...' && ! grep "$(printf '\t')" iset.mm
###########################################################
tex:
name: Generate TeX output using metamath.exe
runs-on: ubuntu-latest
needs: skip_dups
if: ${{ needs.skip_dups.outputs.should_skip != 'true' }}
steps:
- uses: actions/checkout@v3
# Update first to counter problems installing texlive
- run: sudo apt-get update --fix-missing
# Install LaTeX so we can test generated LaTeX. We use extended packages:
# texlive-extra-utils provides pdflatex
# texlive-fonts-extra provides phonetic.sty
# texlive-science provides accents.sty
- run: sudo apt-get install texlive-latex-extra texlive-extra-utils texlive-fonts-extra texlive-science
# Here's an eXample of how to install "extra" LaTeX packages. See:
# https://tex.stackexchange.com/questions/38978/how-can-i-manually-install-a-latex-package-debian-ubuntu-linux/39259#39259
# - run: mkdir -p "$HOME/texmf"
# - run: wget https://mirrors.ctan.org/macros/latex/contrib/accents.zip -o "$HOME/texmf/accents.zip"
# - run: cd "$HOME/texmf"; unzip -j accents.zip
# - run: texhash texmf
# Use GITHUB_PATH to set PATH. For details see:
# https://docs.github.com/en/free-pro-team@latest/actions/reference/
# workflow-commands-for-github-actions#setting-an-environment-variable
- name: Ensure ~/bin is in PATH
run: |
echo "$HOME/bin" >> "$GITHUB_PATH"
mkdir -p "$HOME/bin"
- name: Get metamath C program and supporting files
run: scripts/download-metamath
- name: Record latest version of metamath as env variable
run: |
dirname=$(zipinfo -1 metamath-program.zip | head -1)
dirname=${dirname#metamath-metamath-exe-}
echo "METAMATH_LATEST_VERSION=${dirname%/}" >> $GITHUB_ENV
# Note: cache key includes version of metamath in use
- name: Cache metamathexe
id: cache-metamathexe
uses: actions/cache@v3
env:
cache-name: cache-metamathexe
with:
path: ~/bin/metamath
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.METAMATH_LATEST_VERSION }}
- name: Build/install metamath, a C verifier (and more) by Norm Megill
if: ${{ !steps.cache-metamathexe.outputs.cache-hit }}
run: |
gcc --version
scripts/build-metamath
# Check generated LaTeX, to ensure the TeX definitions are okay. set.mm:
- run: python3 scripts/latex_collector.py set.mm list-set.tex
- run: pdflatex -halt-on-error list-set.tex 2>&1 | tee ,latex-output
# Complain if the pdflatex output says something is invalid
- run: "! grep ' invalid ' ,latex-output"
###########################################################
smetamath-rs:
name: Verify using smetamath-rs (smm3) (Rust verifier by Stefan O'Rear)
runs-on: ubuntu-latest
needs: skip_dups
if: ${{ needs.skip_dups.outputs.should_skip != 'true' }}
steps:
- uses: actions/checkout@v3
- name: Cache smm3
id: cache-smm3
uses: actions/cache@v3
env:
cache-name: cache-smetamath
with:
path: ~/.cargo/bin/smetamath
key: ${{ runner.os }}-build-${{ env.cache-name }}
- name: Install rust
if: ${{ !steps.cache-smm3.outputs.cache-hit }}
uses: hecrj/setup-rust-action@v1
with:
rust-version: stable
- name: Install smm3
if: ${{ !steps.cache-smm3.outputs.cache-hit }}
run: cargo install smetamath --vers 3.0.0
- name: Verify set.mm
run: |
~/.cargo/bin/smetamath --verify --split --jobs 4 --timing ./set.mm 2>&1 | tee smm.log && [ `egrep '(:Error:|:Warning:)' < smm.log; echo $?` -eq 1 ]
- name: Verify iset.mm
run: |
~/.cargo/bin/smetamath --verify --split --jobs 4 --timing ./iset.mm 2>&1 | tee smm.log && [ `egrep '(:Error:|:Warning:)' < smm.log; echo $?` -eq 1 ]
###########################################################
metamath-knife:
name: Verify using metamath-knife
runs-on: ubuntu-latest
needs: skip_dups
if: ${{ needs.skip_dups.outputs.should_skip != 'true' }}
steps:
- uses: actions/checkout@v3
- name: Cache metamath-knife
id: cache-metamath-knife
uses: actions/cache@v3
env:
cache-name: cache-knife
with:
path: metamath-knife/target/release/metamath-knife
key: ${{ runner.os }}-build-${{ env.cache-name }}
- name: Install rust
if: ${{ !steps.cache-metamath-knife.outputs.cache-hit }}
uses: hecrj/setup-rust-action@v1
with:
rust-version: stable
- name: Install metamath-knife
if: ${{ !steps.cache-metamath-knife.outputs.cache-hit }}
run: |
rm -rf metamath-knife &&
git clone --depth 1 https://github.com/metamath/metamath-knife.git &&
cd metamath-knife &&
cargo build --release
- name : Update PATH
run: echo "metamath-knife/target/release" >> "$GITHUB_PATH"
- name: Verify set.mm
run: scripts/verify-knife ./set.mm ./discouraged
- name: Verify iset.mm
run: scripts/verify-knife ./iset.mm ./iset-discouraged
###########################################################
mmj2:
name: Verify using mmj2 (Java verifier by Mel L. O'Cat and Mario Carneiro)
runs-on: ubuntu-latest
needs: skip_dups
if: ${{ needs.skip_dups.outputs.should_skip != 'true' }}
steps:
- uses: actions/checkout@v3
# See: https://github.com/actions/setup-java
- uses: actions/setup-java@v3
with:
distribution: 'zulu' # ('temurin', 'zulu', ...) - required field
java-version: '11' # The JDK version to make available on the path.
# java-package: jdk # (jdk, jre, jdk+fx, or jre+fx) - defaults to jdk
# architecture: x64 # (x86, x64, armv7, aarch64, or ppc64le) - default value derived from the runner machine
- run: wget -N https://github.com/digama0/mmj2/raw/master/mmj2jar/mmj2.jar
- run: mkdir macros
- run: wget -O macros/definitionCheck.js https://github.com/digama0/mmj2/raw/master/mmj2jar/macros/definitionCheck.js
- run: wget -O macros/init.js https://github.com/digama0/mmj2/raw/master/mmj2jar/macros/init.js
- run: wget -O macros/showDiscouraged.js https://github.com/digama0/mmj2/raw/master/mmj2jar/macros/showDiscouraged.js
# Do extra checking and generate the '*discouraged.new' file
# (the 'printf' lets us insert multiple lines).
# We use setparser to check that definitions don't create
# syntax ambiguities
- run: scripts/verify-mmj2 --setparser 'mmj.verify.LRParser' --extra "$(printf 'RunMacro,definitionCheck,ax-*,df-bi,df-clab,df-cleq,df-clel\nRunMacro,showDiscouraged,discouraged.new')" set.mm
- run: scripts/verify-mmj2 --setparser 'mmj.verify.LRParser' --extra "$(printf 'RunMacro,definitionCheck,ax-*,df-bi,df-clab,df-cleq,df-clel\nRunMacro,showDiscouraged,iset-discouraged.new')" iset.mm
- run: echo 'Checking discouraged file:' && diff -U 0 discouraged discouraged.new
- run: echo 'Checking iset-discouraged file:' && diff -U 0 iset-discouraged iset-discouraged.new
###########################################################
mmverifypy-setmm:
name: Verify set.mm using mmverify.py (Python verifier by Raph Levien)
runs-on: ubuntu-latest
needs: skip_dups
if: ${{ needs.skip_dups.outputs.should_skip != 'true' }}
steps:
- uses: actions/checkout@v3
# See https://github.com/actions/setup-python
- uses: actions/setup-python@v4
with:
python-version: '>=3.9'
- run: wget -N https://raw.githubusercontent.com/david-a-wheeler/mmverify.py/master/mmverify.py
# We can speed up the script by deleting all logging calls, since we do
# not need them.
- run: sed -E '/^ *vprint\(/d' mmverify.py > mmverify.faster.py
- run: chmod a+x mmverify.faster.py
- run: ./mmverify.faster.py set.mm
###########################################################
mmverifypy-isetmm:
name: Verify iset.mm using mmverify.py (Python verifier by Raph Levien)
runs-on: ubuntu-latest
needs: skip_dups
if: ${{ needs.skip_dups.outputs.should_skip != 'true' }}
steps:
- uses: actions/checkout@v3
# See https://github.com/actions/setup-python
- uses: actions/setup-python@v4
with:
python-version: '>=3.9'
- run: wget -N https://raw.githubusercontent.com/david-a-wheeler/mmverify.py/master/mmverify.py
# We can speed up the script by deleting all logging calls, since we do
# not need them.
- run: sed -E '/^ *vprint\(/d' mmverify.py > mmverify.faster.py
- run: chmod a+x mmverify.faster.py
- run: ./mmverify.faster.py iset.mm
###########################################################
check-dates:
name: Check dates in set.mm
runs-on: ubuntu-latest
needs: skip_dups
if: ${{ needs.skip_dups.outputs.should_skip != 'true' }}
# Check for valid dates (detect nonsense like "June 31")
# We run scripts/report-changes.py to convert dates to Unix timestamps;
# this will raise an exception if the conversion can't occur,
# thus checking that dates are valid. If the conversion is invalid,
# you'll see the output from the last *valid* date followed by
# an exception.
# TODO: Check other .mm files, currently this only checks set.mm.
steps:
- uses: actions/checkout@v3
- run: pip3 install ply
- run: scripts/report-changes.py --gource > /dev/null
# TODO: Add mm-scala. Something like this:
# ###########################################################
# # - # mm-scala, a Scala verifier by Mario Caneiro
# # name: mm-scala (Scala)
# # language: scala
# # install:
# # - git clone --depth 1 https://github.com/digama0/mm-scala.git
# # script:
# # - cd mm-scala; sbt ++$TRAVIS_SCALA_VERSION test
# # - ls
# # - ls mm-scala
# # - mm-scala/mm-scala set.mm
# ###########################################################