Refactor to have less state #7996
Workflow file for this run
This file contains hidden or 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/setup-racket@v1.14 | |
| with: | |
| version: "8.18" | |
| - name: Install Rust compiler | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: stable | |
| components: rustfmt, clippy | |
| - name: Cache cargo build | |
| uses: Swatinem/rust-cache@v2 | |
| - uses: actions/checkout@v5 | |
| - name: "Install dependencies" | |
| run: make install | |
| # SoftPosit is required to test the softposit platform we use for testing | |
| - name: "Install SoftPosit support" | |
| run: raco pkg install softposit-rkt | |
| - 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 :precision /tmp/out.fpcore` -eq 3 | |
| test `grep -c ';;' /tmp/out.fpcore` -eq 0 | |
| - name: "Test the improve command-line tool" | |
| run: | | |
| racket -l herbie improve bench/tutorial.fpcore /tmp/out.fpcore | |
| test `grep -c :precision /tmp/out.fpcore` -eq 3 | |
| test `grep -c '^; ' /tmp/out.fpcore` -eq 0 | |
| - 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 tmp-0 | |
| racket -l herbie report --threads yes --seed 1 bench/hamming/rearrangement.fpcore tmp-1 | |
| racket infra/diff.rkt tmp-0 tmp-1 | |
| - name: "Run Herbie on array benchmarks" | |
| run: racket -l herbie improve bench/arrays /tmp/out.fpcore | |
| - name: "Run Herbie with egglog" | |
| run: racket -y infra/ci.rkt --egglog --precision binary64 --seed 1 bench/tutorial.fpcore | |
| # 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 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: 20 | |
| - name: "Test the endpoint" | |
| run: node infra/test-api.mjs |