leo/.github/workflows/acl2.yml

91 lines
3.1 KiB
YAML
Raw Normal View History

2021-07-30 15:36:43 +03:00
name: Leo-ACL2
2021-08-31 20:23:11 +03:00
on: workflow_dispatch
env:
2021-07-30 15:36:43 +03:00
RUST_BACKTRACE: 1
2021-08-18 17:51:50 +03:00
# This job can only be run on linux (Ubuntu)
2021-07-30 15:36:43 +03:00
jobs:
acl2:
name: leo-acl2
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
2021-08-17 13:27:23 +03:00
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
2021-07-30 15:36:43 +03:00
2021-08-17 13:27:23 +03:00
- name: Generate asts
run: |
2022-05-23 11:22:23 +03:00
# This currently has to be on testnet3 to work:
cd compiler/parser
cargo -q install --path . --example parser
# To ensure full file tests,
# just do compiler tests and remove expectation: Fail tests
cd ../../tests/compiler
find . -type f -exec grep -q 'expectation *: *Fail' {} \; -delete
find . -name '*.leo' -execdir parser {} \; > /dev/null
# Show how many there are:
echo "Counts (.leo / .json):"
find . -name '*.leo' -print | wc -l
find . -name '*.json' -print | wc -l
2021-07-30 15:36:43 +03:00
2021-08-17 13:27:23 +03:00
# Pull the latest release from the leo-acl2-bin repo, and put it into the
# repo/acl2 directory. After it's done, unpack the tgz file locally.
2021-08-18 17:51:50 +03:00
- name: Pull tgc executable
2021-07-30 15:36:43 +03:00
run: |
2021-08-17 13:27:23 +03:00
mkdir acl2 && cd acl2;
wget $( curl -s https://api.github.com/repos/AleoHQ/leo-acl2-bin/releases/latest \
2022-05-23 11:22:23 +03:00
| jq -r '.assets[].browser_download_url|scan("^.*leo-acl2--v.*\\.tgz$")' )
2021-08-17 10:44:44 +03:00
echo "Unpacking $(ls):"
2021-08-17 13:27:23 +03:00
tar -xvzf $(ls)
# Run theorem generation and checking using the prepared ASTs and the pulled and unzipped leo-acl2 tarball.
2021-08-18 17:51:50 +03:00
- name: Run tgc over ASTs
2021-08-17 13:27:23 +03:00
run: |
2022-05-23 11:22:23 +03:00
parsing_errors=();
num_cases=0;
# Note that PWD gets reset at the beginning of each the step
# to /home/runner/work/leo/leo
acl2dir="${PWD}"/acl2
cd tests/compiler;
for tc in `find ${PWD} -name '*.leo' -print`;
2021-08-17 13:27:23 +03:00
do
2022-05-23 11:22:23 +03:00
cd "${tc%/*}"; # enter the directory
leofile="${tc##*/}";
jsonfile="${leofile%.leo}.json";
num_cases=$((num_cases + 1));
"$acl2dir"/tgc parsing "$leofile" "$jsonfile" parsing-theorem.lisp > parsing_result.out || parsing_errors+=("$tc");
2021-08-17 13:27:23 +03:00
done;
2021-08-18 14:53:18 +03:00
echo "----------------"
2022-05-23 11:22:23 +03:00
echo "Ran tgc on ${num_cases} programs."
echo "----------------"
2022-05-23 11:22:23 +03:00
if [ ${#parsing_errors[@]} -eq 0 ]; then
echo "Parsing - Total Success!"
2021-08-18 14:53:18 +03:00
else
2022-05-23 11:22:23 +03:00
echo "Parsing Failures (total: ${#parsing_errors[@]}):"
for tc in ${parsing_errors[@]};
do
2022-05-23 11:22:23 +03:00
echo $tc
done;
2021-08-31 20:41:04 +03:00
#echo "Attaching logs:"
#for dir in ${canonicalization_errors[@]};
#do
# cat tmp/tgc/$dir/canonicalization_result.out
# cat tmp/tgc/$dir/canonicalization-theorem.lisp
#done;
fi
2022-05-23 11:22:23 +03:00
if [[ ${#parsing_errors[@]} -ne 0 ]]; then
echo "----------------"
echo "Exiting with status 1 due to at least one tgc error."
2021-08-18 14:53:18 +03:00
exit 1
fi