-
Notifications
You must be signed in to change notification settings - Fork 2
195 lines (179 loc) · 7.26 KB
/
rust.yml
File metadata and controls
195 lines (179 loc) · 7.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
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