Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ci): add Lean testing in the CI #871

Merged
merged 5 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,31 @@ jobs:
- name: System dependencies
run: |
sudo apt-get update
sudo apt-get -o Acquire::Retries=3 install build-essential libgmp-dev z3 cvc4 opam cargo verilator
sudo apt-get -o Acquire::Retries=3 install build-essential libgmp-dev z3 cvc4 opam cargo verilator git curl

- name: Restore cached elan
id: cache-elan-restore
uses: actions/cache/restore@v3
with:
path: ~/.elan
key: ${{ matrix.os }}-${{ matrix.version }}-elan

- name: Install Lean version manager
if: steps.cache-elan-restore.outputs.cache-hit != 'true'
run: |
curl https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh -sSf | bash -s -- -y

- name: Save cached elan
if: steps.cache-elan-restore.outputs.cache-hit != 'true'
id: cache-elan-save
uses: actions/cache/save@v3
with:
path: ~/.elan
key: ${{ steps.cache-elan-restore.outputs.cache-primary-key }}

- name: Set elan path
run: |
echo "$HOME/.elan/bin" >> "$GITHUB_PATH"

- name: Restore cached opam
id: cache-opam-restore
Expand All @@ -43,7 +67,7 @@ jobs:
path: ~/.opam
key: ${{ steps.cache-opam-restore.outputs.cache-primary-key }}

- name: Install Sail
- name: Install Sail dependencies
run: |
eval $(opam env)
opam pin --yes --no-action add .
Expand Down
2 changes: 1 addition & 1 deletion sail
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

SAIL_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
export SAIL_DIR
Expand Down
4 changes: 3 additions & 1 deletion test/lean/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ def test_lean():
basename = os.path.splitext(os.path.basename(filename))[0]
tests[filename] = os.fork()
if tests[filename] == 0:
step('mkdir {}'.format(basename))
step('rm -r {} || true'.format(basename))
step('mkdir -p {}'.format(basename))
step('\'{}\' {} --lean --lean-output-dir {}'.format(sail, filename, basename))
step(f'lake --dir {basename}/out build')
step('diff {}/out/Out.lean {}.expected.lean'.format(basename, basename))
step('rm -r {}'.format(basename))
print_ok(filename)
Expand Down
Loading