Skip to content

Develop #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Apr 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 29 additions & 28 deletions .github/workflows/minigo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,38 @@ name: MiniGo CI

on:
push:
branches: ["main"]
branches: [ "develop" ]
pull_request:
branches: [ "main" ]

jobs:
build-test-lint:
build-and-test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: "3.12"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest coverage antlr4-python3-runtime==4.9.2
pip install -e .

- name: Download ANTLR JAR
run: |
curl -O https://www.antlr.org/download/antlr-4.9.2-complete.jar

- name: Run unit tests with coverage
run: |
export ANTLR_JAR="$(pwd)/MiniGo/src/antlr-4.9.2-complete.jar"
cd "MiniGo/src"
./test.sh all_with_coverage
coverage xml
- name: Checkout code
uses: actions/checkout@v4

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
if: success()
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-

- name: Set up Docker Compose
run: |
docker compose build

- name: Run tests
run: |
docker compose run --rm minigo \
/bin/bash -c "cd MiniGo/src && python main.py gen && ./test.sh all"

- name: Debug on failure
if: failure()
run: |
echo "=== Last 50 lines of test output ==="
docker run --rm $DOCKER_IMAGE \
tail -n 50 /app/MiniGo/src/test.log || true
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
.DS_Store
*.txt
.antlr/
MiniGoClass.j
MiniGoClass.class

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ COPY requirements.txt .
RUN pip install -r requirements.txt

# Copy ANTLR jar and set environment variable
COPY antlr-4.9.2-complete.jar .
ENV ANTLR_JAR=/app/antlr-4.9.2-complete.jar
COPY MiniGo/src/antlr-4.9.2-complete.jar .
ENV ANTLR_JAR=/app/MiniGo/src/antlr-4.9.2-complete.jar

# Set Python path for test modules
# ENV PYTHONPATH="/app"
Expand Down
21 changes: 2 additions & 19 deletions MiniGo/src/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,25 +86,8 @@ case "$1" in
echo "Running semantic analysis tests..."
python main.py test CheckSuite
echo ""
;;
all_with_coverage)
# Execute all unit tests with coverage
rm -f ${INPUT}/* 2>/dev/null
rm -f ${OUTPUT}/* 2>/dev/null
echo "<<< RUNNING ALL TESTS >>>"
echo ""
echo "Running lexical analysis tests..."
coverage run --append main.py test LexerSuite
echo ""
echo "Running syntax analysis tests..."
coverage run --append main.py test ParserSuite
echo ""
echo "Running AST generation tests..."
coverage run --append main.py test ASTGenSuite
echo ""
echo "Running semantic analysis tests..."
coverage run --append main.py test CheckSuite
echo ""
# echo "Running code generation tests..."
# python main.py test CodeGenSuite
;;
clean)
# Remove all test artifacts from directories
Expand Down