fmt #4978
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Unit tests | |
on: [push] | |
env: | |
RUST_BACKTRACE: full | |
jobs: | |
unit-tests: | |
name: "Unit Tests" | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Install Packages" | |
run: sudo apt-get install -y libmpfr6 libmpfr-dev | |
- name: "Install Racket" | |
uses: Bogdanp/[email protected] | |
with: | |
version: "8.14" | |
- name: Install Rust compiler | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
components: rustfmt, clippy | |
- uses: actions/checkout@master | |
- name: "Install dependencies" | |
run: make install | |
- name: "Test raco fmt compliance" | |
run: make fmt && git diff --exit-code | |
# Run the Herbie unit tests | |
- name: "Run Herbie unit tests" | |
run: raco test src/ infra/ egg-herbie/ | |
# Test the command-line tools | |
- name: "Test the shell command-line tool" | |
run: | | |
<bench/tutorial.fpcore racket -l herbie shell >/tmp/out.fpcore | |
test `grep -c :herbie-time /tmp/out.fpcore` -eq 3 | |
- name: "Test the improve command-line tool" | |
run: | | |
racket -l herbie improve bench/tutorial.fpcore /tmp/out.fpcore | |
test `grep -c :herbie-time /tmp/out.fpcore` -eq 3 | |
- name: "Run the report command-line tool" | |
run: | | |
racket -l herbie report bench/tutorial.fpcore /tmp/out/ | |
test -d /tmp/out/ | |
test -f /tmp/out/index.html | |
test -f /tmp/out/results.json | |
- name: "Run two reports with the same seed and diff them" | |
run: | | |
racket -l herbie report --threads yes --seed 1 bench/hamming/rearrangement.fpcore graphs0 | |
racket -l herbie report --threads yes --seed 1 bench/hamming/rearrangement.fpcore graphs1 | |
racket infra/diff.rkt graphs0 graphs1 | |
# Test the egg-herbie Rust code | |
- run: cd egg-herbie && cargo clippy --tests | |
continue-on-error: true | |
- run: cd egg-herbie && cargo test | |
- run: cd egg-herbie && cargo fmt -- --check | |
- run: cd egg-herbie && raco test ./ | |
# Test the API | |
- name: "Start server" | |
run: racket -l herbie web --port 8000 & | |
- name: "Wait for server startup" | |
run: while ! nc -z localhost 8000; do sleep 0.1; done | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: "Test the endpoint" | |
run: node infra/testApi.mjs |