-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathtoast.yml
More file actions
211 lines (197 loc) · 5.54 KB
/
toast.yml
File metadata and controls
211 lines (197 loc) · 5.54 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
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
image: ubuntu:26.04
default: verify
user: user
command_prefix: |
# Make not silently ignore errors.
set -euo pipefail
# Load the opam environment, if it exists.
if [ -d "$HOME/.opam" ]; then
eval "$(opam env)"
fi
# Load the elan environment, if it exists.
if [ -f "$HOME/.elan/env" ]; then
source "$HOME/.elan/env"
fi
# Make Bash log commands.
set -x
tasks:
install_packages:
description: Install system packages.
user: root
command: |
# Install the following packages:
#
# - build-essential - Used by opam to build Rocq
# - curl - Used for installing Lean and Tagref
# - git - Used for installing Lean dependencies
# - libgmp3-dev - Used by opam to build Rocq
# - opam - Used to install OCaml and Rocq
# - pkg-config - Used by opam to build Rocq
# - ruby - Used by the linter scripts
apt-get update
apt-get install --yes \
build-essential \
curl \
libgmp3-dev \
opam \
pkg-config \
ruby
install_tagref:
description: Install Tagref, a reference checking tool.
dependencies:
- install_packages
user: root
command: |
# Install Tagref using the official installer script.
curl \
https://raw.githubusercontent.com/stepchowfun/tagref/main/install.sh \
-LSfs | sh
create_user:
description: Create a user who doesn't have root privileges.
user: root
command: |
# Create a user named `user` with a home directory and with Bash as the
# login shell.
useradd user --create-home --shell /bin/bash
# Without this, Ruby will assume files are encoded as ASCII.
echo 'export LANG="C.UTF-8"' >> /home/user/.profile
install_lean:
description: Install Lean.
dependencies:
- create_user
- install_packages
input_paths:
- lake-manifest.json
- lakefile.toml
- lean-toolchain
user: user
command: |
# Install Lean via the Lean version manager.
curl https://elan.lean-lang.org/elan-init.sh -sSf | sh -s -- -y
source "$HOME/.elan/env"
lake update
lake exe cache get
install_rocq:
description: Install Rocq.
dependencies:
- create_user
- install_packages
user: user
command: |
# Install Rocq via opam.
opam init --disable-sandboxing --yes
eval "$(opam env)"
opam pin add rocq-prover 9.0.0 --yes
install_tools:
description: Install the tools needed to verify the Rocq proofs.
dependencies:
- install_lean
- install_rocq
- install_tagref
verify:
description: Run Lean and Rocq on the proof scripts.
dependencies:
- install_tools
input_paths:
- Makefile
- _RocqProject
- proofs_lean
- proofs_rocq
user: user
command: |
# Run Lean on the proof scripts.
lake build
# Run Rocq on the proof scripts.
make clean
make
lint:
description: Run the linters.
dependencies:
- verify
input_paths:
- linters
- toast.yml # To lint the tag references
user: user
command: |
# Make sure the `LANG` environment variable is set for Ruby.
source "$HOME/.profile"
# Check references with Tagref.
tagref
tagref list-unused --fail-if-any
# Run the linters.
./linters/lint-general.rb $(
find . -type d \( \
-path ./.git -o \
-path ./.lake \
\) -prune -o \( \
-name '*.lean' -o \
-name '*.rb' -o \
-name '*.sh' -o \
-name '*.v' -o \
-name '*.yml' -o \
-name 'Dockerfile' -o \
-name 'Makefile' \
\) -print
)
./linters/lint-imports.rb \
'^\s*import ' \
'^\s*import ' \
"lake env lean ?" \
$(
find . -type d \( \
-path ./.git -o \
-path ./.lake \
\) -prune -o \( \
-name '*.lean' \
\) -print
)
# [ref:flags]
./linters/lint-imports.rb \
'^\s*Require ' \
'^\s*Require (Import )?(Stdlib|main)\.' \
"rocq compile \
-set 'Default Goal Selector=!' \
-set 'Loose Hint Behavior=Strict' \
-set 'Primitive Projections' \
-set 'Printing Projections' \
-unset 'Printing Primitive Projection Parameters' \
-Q proofs_rocq main ?" \
$(
find . -type d \( \
-path ./.git -o \
-path ./.lake \
\) -prune -o \( \
-name '*.v' \
\) -print
)
# [ref:flags]
./linters/lint-imports.rb \
'^\s*Import ' \
'^\s*Import ' \
"rocq compile \
-set 'Default Goal Selector=!' \
-set 'Loose Hint Behavior=Strict' \
-set 'Primitive Projections' \
-set 'Printing Projections' \
-unset 'Printing Primitive Projection Parameters' \
-Q proofs_rocq main ?" \
$(
find . -type d \( \
-path ./.git -o \
-path ./.lake \
\) -prune -o \( \
-name '*.v' \
\) -print
)
# [dir:proofs_rocq]
if grep --recursive --line-number --include '*.v' Admitted proofs_rocq
then
echo "Error: 'Admitted' found in proofs." 1>&2
exit 1
fi
# [dir:proofs_lean]
if grep --recursive --line-number --include '*.lean' sorry proofs_lean
then
echo "Error: 'sorry' found in proofs." 1>&2
exit 1
fi