forked from Lamina-dev/Lamina
-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (82 loc) · 2.88 KB
/
ci.yml
File metadata and controls
102 lines (82 loc) · 2.88 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
name: CI
on:
push:
pull_request:
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup CMake
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: "3.16.3"
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake ninja-build
- name: Initialize Git submodules
run: |
git submodule update --init --recursive
- name: Configure CMake
run: |
cmake -B build -DCMAKE_BUILD_TYPE=Debug -G "Unix Makefiles" .
- name: Build Lamina
run: |
echo "Building Lamina interpreter with CMake..."
cmake --build build --parallel
echo "✅ Build successful!"
- name: Basic functionality test
working-directory: build/bin
env:
LD_LIBRARY_PATH: .
run: |
echo "Running basic tests..."
# Ensure Lamina is executable
chmod +x ./lamina
# Test 1: Hello World
echo 'print("Hello, Lamina!");' > test1.lm
./lamina test1.lm
# Test 2: Basic arithmetic
echo 'var x = 2 + 3 * 4;' > test2.lm
echo 'print("2 + 3 * 4 =", x);' >> test2.lm
./lamina test2.lm
# Test 3: Precise fractions
echo 'var fraction = 16 / 9;' > test3.lm
echo 'print("16/9 =", fraction);' >> test3.lm
./lamina test3.lm
# Test 4: Functions
echo 'func add(a, b) { return a + b; }' > test4.lm
echo 'var result = add(10, 20);' >> test4.lm
echo 'print("add(10, 20) =", result);' >> test4.lm
./lamina test4.lm
echo "✅ All basic tests passed!"
- name: Test example programs
working-directory: build/bin
run: |
echo "Testing example programs..."
if [ -d "../../examples" ]; then
for example in ../../examples/*.lm; do
if [ -f "$example" ]; then
echo "Testing $(basename "$example")..."
./lamina "$example" || echo "⚠️ Warning: $example execution failed"
fi
done
else
echo "ℹ️ No examples directory found"
fi
- name: Check for memory leaks (with valgrind)
working-directory: build/bin
run: |
echo "Installing valgrind for memory leak detection..."
sudo apt-get install -y valgrind
echo "Running memory leak test..."
echo 'var x = 42; print("x =", x);' > memtest.lm
if valgrind --leak-check=full --error-exitcode=1 ./lamina memtest.lm 2>&1; then
echo "✅ No memory leaks detected"
else
echo "⚠️ Memory leaks detected, but continuing..."
fi