Skip to content

tests: add more edge cases #23

tests: add more edge cases

tests: add more edge cases #23

Workflow file for this run

name: Brainrot CI
on:
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 lang.tab.c lex.yy.c ast.c -lfl
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: brainrot
path: brainrot
run_examples:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download Brainrot artifact
uses: actions/download-artifact@v3
with:
name: brainrot
- name: Grant execute permissions to Brainrot
run: chmod +x brainrot
- name: Run Brainrot examples
run: |
for file in examples/*.brainrot; do
./brainrot < "$file"
done
./brainrot < examples/while_loop.brainrot
test:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download Brainrot artifact
uses: actions/download-artifact@v3
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 -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