-
Notifications
You must be signed in to change notification settings - Fork 28
81 lines (68 loc) · 1.9 KB
/
ci.yml
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
name: Brainrot CI
on:
workflow_dispatch:
push:
branches: ["main"]
paths-ignore:
- "**/*.md"
- "CODEOWNERS"
- "Makefile"
pull_request:
branches: ["main"]
paths-ignore:
- "**/*.md"
- "CODEOWNERS"
- "Makefile"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install gcc flex bison libfl-dev -y
- name: Build Brainrot
run: |
bison -d -Wcounterexamples lang.y -o lang.tab.c
flex lang.l
gcc -o brainrot lib/hm.c lib/mem.c lang.tab.c lex.yy.c ast.c -lfl -lm
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: brainrot
path: brainrot
test:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download Brainrot artifact
uses: actions/download-artifact@v4
with:
name: brainrot
- name: Grant execute permissions to Brainrot
run: chmod +x brainrot
- name: Install Python and dependencies
run: |
sudo apt-get update
sudo apt-get install python3 python3-pip valgrind -y
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
working-directory: tests
- name: Run Pytest
run: |
source .venv/bin/activate
pytest -v test_brainrot.py
working-directory: tests
- name: Run Valgrind on all .brainrot tests
run: |
for f in test_cases/*.brainrot; do
echo "Running Valgrind on $f..."
valgrind --leak-check=full --error-exitcode=1 ./brainrot < "$f"
echo
done
working-directory: .