Skip to content

Commit ac7878c

Browse files
authored
Merge pull request #69 from ProvableHQ/check-leo-grammar
[CI] check leo grammar for some consistency properties
2 parents 43a8ee2 + 5c3a608 commit ac7878c

File tree

1 file changed

+96
-0
lines changed

1 file changed

+96
-0
lines changed
+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# Checks out ACL2 and grammars repositories,
2+
# copies the Leo ABNF grammar from the ProvableHQ/grammars repo
3+
# to the ACL2 books projects/leo directory,
4+
# and certifies the grammar.lisp file that performs consistency checks
5+
# on the Leo ABNF grammar.
6+
7+
name: check-leo-grammar
8+
9+
# Controls when the workflow will run
10+
on:
11+
# Triggers the workflow on push or pull request events but only for the master branch
12+
push:
13+
branches: [ master ]
14+
pull_request:
15+
branches: [ master ]
16+
17+
# Allows you to run this workflow manually from the Actions tab
18+
workflow_dispatch:
19+
20+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
21+
jobs:
22+
# This workflow contains a single job called "build"
23+
build:
24+
# The type of runner that the job will run on
25+
runs-on: macos-latest
26+
27+
# Steps represent a sequence of tasks that will be executed as part of the job
28+
steps:
29+
# Get some info
30+
- name: Machine information
31+
run: |
32+
echo 'Hello, ' `pwd` ' $GITHUB_WORKSPACE=' "$GITHUB_WORKSPACE"
33+
echo 'uname -a : ' `/usr/bin/uname -a`
34+
35+
# Checks out the acl2 repository under $GITHUB_WORKSPACE/acl2
36+
- name: Checkout ACL2
37+
uses: actions/checkout@v4
38+
with:
39+
repository: 'acl2/acl2'
40+
path: 'acl2'
41+
# note: the default commit depth is 1
42+
# note: there are`with:` params for sparse checkout, in case of size
43+
# Note, to check out a specific branch or commit, use "ref:", as in:
44+
#ref: 'testing'
45+
46+
# Note, installing SBCL using brew
47+
# is currently sufficient for certifying the Leo grammar.
48+
# However, more complex computation may require building SBCL with
49+
# settings that allow sbcl to use more resources.
50+
51+
# Note, if we wanted to actually build SBCL here, we would not need to install
52+
# everything that we would do with a Docker build, because the GitHub runner
53+
# comes with a lot of things preinstalled.
54+
55+
- name: Install SBCL and ACL2
56+
run: |
57+
brew install sbcl
58+
59+
# Informational:
60+
which sbcl
61+
62+
# Build ACL2
63+
cd ${GITHUB_WORKSPACE}
64+
cd acl2
65+
make update LISP=`which sbcl`
66+
67+
- name: Check out grammars repo
68+
uses: actions/checkout@v4
69+
with:
70+
repository: 'ProvableHQ/grammars'
71+
path: 'grammars'
72+
73+
- name: Grammar files info
74+
run: |
75+
cd ${GITHUB_WORKSPACE}
76+
wc grammars/leo.abnf
77+
wc acl2/books/projects/leo/grammar.abnf
78+
# The above is prior to being overwritten in the next task.
79+
80+
- name: Copy ABNF file
81+
run: cp ${GITHUB_WORKSPACE}/grammars/leo.abnf ${GITHUB_WORKSPACE}/acl2/books/projects/leo/grammar.abnf
82+
83+
- name: Certify grammar.lisp file
84+
run: |
85+
cd ${GITHUB_WORKSPACE}
86+
cd acl2
87+
export ACL2=`pwd`/saved_acl2
88+
export ACL2_SYSTEM_BOOKS=`pwd`/books
89+
export PATH="${ACL2_SYSTEM_BOOKS}"/build:"${PATH}"
90+
cd books
91+
echo 'Print out the ABNF grammar, so we have a record of what was checked.'
92+
echo '------------------------------'
93+
cat projects/leo/grammar.abnf
94+
echo '------------------------------'
95+
# As of 2024-08-20, macos-latest runners on public repos allow 4 cores.
96+
cert.pl -j4 projects/leo/grammar

0 commit comments

Comments
 (0)