Add require clauses and post-monomorph body safety checks #1272
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: Rust | |
| on: | |
| push: | |
| pull_request: | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| # Force the cc crate to pick clang-19 so build.rs / cli/build.rs detect | |
| # a clang-like compiler and compile src/stack_interp.c with preserve_none | |
| # + musttail honored. Two reasons clang-19 specifically: | |
| # 1. The `clang` meta-package on ubuntu-latest currently installs | |
| # clang 18.0-59~exp2 (a pre-1.0 snapshot from Debian experimental). | |
| # preserve_none was added in upstream Clang 19 — Clang 18 silently | |
| # ignores `__attribute__((preserve_none))` with a warning, falling | |
| # back to System V cc, which makes musttail dispatch corrupt | |
| # register state mid-loop and crashes iir_filter.lyte before its | |
| # assert(true) ever runs. | |
| # 2. Ubuntu 24.04's stable clang-N packages cap at 18; clang-19+ has | |
| # to come from apt.llvm.org. | |
| # Without clang at all, cc-rs picks gcc, is_like_clang() returns false, | |
| # has_stack_interp is never set, and the stack backend is stubbed out. | |
| env: | |
| CC: clang-19 | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install clang-19 from apt.llvm.org | |
| run: | | |
| wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/llvm.gpg | |
| echo "deb http://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs)-19 main" | sudo tee /etc/apt/sources.list.d/llvm.list | |
| sudo apt-get update | |
| sudo apt-get install -y clang-19 | |
| - name: Build | |
| run: cargo build --workspace --verbose | |
| - name: Run tests | |
| run: cargo test --workspace --verbose | |
| - name: Install Lua and LuaJIT | |
| run: | | |
| sudo apt-get install -y lua5.4 luajit | |
| sudo ln -sf /usr/bin/lua5.4 /usr/local/bin/lua | |
| - name: Run benchmarks | |
| run: | | |
| ./benchmark/run.sh 3 | tee benchmark_output.txt | |
| - name: Post benchmark results to job summary | |
| if: always() | |
| run: | | |
| echo '## Benchmark Results (Ubuntu x86_64)' >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| cat benchmark_output.txt >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| build-macos: | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install arm64 LLVM 18 and libffi | |
| run: brew install llvm@18 libffi | |
| - name: Build | |
| run: cargo build --workspace --verbose | |
| - name: Run tests | |
| run: cargo test --workspace --verbose | |
| - name: Build with LLVM | |
| env: | |
| LLVM_SYS_180_PREFIX: /opt/homebrew/opt/llvm@18 | |
| LIBRARY_PATH: /opt/homebrew/opt/llvm@18/lib | |
| run: cargo build -p lyte -p lyte-cli --features llvm --verbose | |
| - name: Run tests with LLVM | |
| env: | |
| LLVM_SYS_180_PREFIX: /opt/homebrew/opt/llvm@18 | |
| LIBRARY_PATH: /opt/homebrew/opt/llvm@18/lib | |
| run: cargo test -p lyte -p lyte-cli --features llvm --verbose | |
| - name: Run freeverb FFI benchmark | |
| env: | |
| LLVM_SYS_180_PREFIX: /opt/homebrew/opt/llvm@18 | |
| LIBRARY_PATH: /opt/homebrew/opt/llvm@18/lib | |
| run: | | |
| ./benchmark/run-freeverb.sh 3 10000 | tee freeverb_output.txt | |
| - name: Post freeverb results to job summary | |
| if: always() | |
| run: | | |
| echo '## Freeverb FFI Benchmark (macOS ARM64, LLVM)' >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| cat freeverb_output.txt >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| - name: Install x86_64 Homebrew | |
| # The xcframework's macOS x86_64 slice is built with cross-compiled | |
| # LLVM, which requires a native x86_64 llvm-config + libs. Install | |
| # an independent Homebrew under /usr/local via Rosetta so it can | |
| # coexist with the arm64 Homebrew at /opt/homebrew. | |
| run: | | |
| NONINTERACTIVE=1 arch -x86_64 /bin/bash -c \ | |
| "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
| - name: Install x86_64 LLVM 18 and libffi | |
| run: arch -x86_64 /usr/local/bin/brew install llvm@18 libffi | |
| - name: Build xcframework | |
| run: ./build-xcframework.sh | |
| - name: Install Lua and LuaJIT | |
| run: brew install lua luajit | |
| - name: Run benchmarks | |
| run: | | |
| ./benchmark/run.sh 3 | tee benchmark_output.txt | |
| - name: Post benchmark results to job summary | |
| if: always() | |
| run: | | |
| echo '## Benchmark Results (macOS ARM64)' >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| cat benchmark_output.txt >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| fuzz: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install nightly toolchain | |
| run: rustup toolchain install nightly --profile minimal | |
| - name: Install cargo-fuzz | |
| run: cargo +nightly install cargo-fuzz | |
| - name: Fuzz lexer (30s) | |
| run: cargo +nightly fuzz run lexer -- -max_total_time=30 | |
| - name: Fuzz parser (30s) | |
| run: cargo +nightly fuzz run parser -- -max_total_time=30 | |
| - name: Fuzz checker (30s) | |
| run: cargo +nightly fuzz run checker -- -max_total_time=30 | |
| - name: Fuzz compile_jit (30s) | |
| run: cargo +nightly fuzz run compile_jit -- -max_total_time=30 | |
| - name: Fuzz compile_vm (30s) | |
| run: cargo +nightly fuzz run compile_vm -- -max_total_time=30 | |
| - name: Differential fuzz JIT vs VM (30s) | |
| run: cargo +nightly fuzz run differential -- -max_total_time=30 | |
| - name: List fuzz artifacts on failure | |
| if: failure() | |
| run: find fuzz/artifacts -type f -print | |
| - name: Upload fuzz artifacts on failure | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: fuzz-artifacts-ubuntu | |
| path: fuzz/artifacts/ | |
| if-no-files-found: ignore | |
| retention-days: 14 | |
| build-llvm: | |
| runs-on: ubuntu-latest | |
| env: | |
| LLVM_SYS_180_PREFIX: /usr/lib/llvm-18 | |
| LIBRARY_PATH: /usr/lib/llvm-18/lib | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install LLVM 18 | |
| run: | | |
| wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - | |
| sudo add-apt-repository "deb http://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs)-18 main" | |
| sudo apt-get update | |
| sudo apt-get install -y llvm-18-dev libpolly-18-dev libzstd-dev | |
| - name: Build with LLVM | |
| run: cargo build -p lyte -p lyte-cli --features llvm --verbose | |
| - name: Run tests with LLVM | |
| run: cargo test -p lyte -p lyte-cli --features llvm --verbose | |
| - name: Install nightly toolchain | |
| run: rustup toolchain install nightly --profile minimal | |
| - name: Install cargo-fuzz | |
| run: cargo +nightly install cargo-fuzz | |
| - name: Differential fuzz JIT vs VM vs LLVM (30s) | |
| run: cargo +nightly fuzz run differential --features llvm -- -max_total_time=30 | |
| - name: List fuzz artifacts on failure | |
| if: failure() | |
| run: find fuzz/artifacts -type f -print | |
| - name: Upload fuzz artifacts on failure | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: fuzz-artifacts-llvm | |
| path: fuzz/artifacts/ | |
| if-no-files-found: ignore | |
| retention-days: 14 | |
| - name: LLVM backend stress test (10 runs) | |
| run: | | |
| for i in $(seq 1 10); do | |
| echo -n "Run $i: " | |
| ./target/debug/lyte tests/cases/slices/empty_string.lyte --backend llvm | |
| done |