Skip to content

Commit 3f6b078

Browse files
authored
Merge pull request #1 from kchan139/develop
Develop
2 parents 43b8873 + ac8dcba commit 3f6b078

File tree

4 files changed

+35
-49
lines changed

4 files changed

+35
-49
lines changed

.github/workflows/minigo.yml

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,38 @@ name: MiniGo CI
22

33
on:
44
push:
5-
branches: ["main"]
5+
branches: [ "develop" ]
6+
pull_request:
7+
branches: [ "main" ]
68

79
jobs:
8-
build-test-lint:
10+
build-and-test:
911
runs-on: ubuntu-latest
1012

1113
steps:
12-
- uses: actions/checkout@v4
13-
14-
- name: Set up Python 3.12
15-
uses: actions/setup-python@v4
16-
with:
17-
python-version: "3.12"
18-
19-
- name: Install dependencies
20-
run: |
21-
python -m pip install --upgrade pip
22-
pip install flake8 pytest coverage antlr4-python3-runtime==4.9.2
23-
pip install -e .
24-
25-
- name: Download ANTLR JAR
26-
run: |
27-
curl -O https://www.antlr.org/download/antlr-4.9.2-complete.jar
28-
29-
- name: Run unit tests with coverage
30-
run: |
31-
export ANTLR_JAR="$(pwd)/MiniGo/src/antlr-4.9.2-complete.jar"
32-
cd "MiniGo/src"
33-
./test.sh all_with_coverage
34-
coverage xml
14+
- name: Checkout code
15+
uses: actions/checkout@v4
3516

36-
- name: Upload coverage to Codecov
37-
uses: codecov/codecov-action@v3
38-
if: success()
17+
- name: Cache Docker layers
18+
uses: actions/cache@v3
19+
with:
20+
path: /tmp/.buildx-cache
21+
key: ${{ runner.os }}-buildx-${{ github.sha }}
22+
restore-keys: |
23+
${{ runner.os }}-buildx-
24+
25+
- name: Set up Docker Compose
26+
run: |
27+
docker compose build
28+
29+
- name: Run tests
30+
run: |
31+
docker compose run --rm minigo \
32+
/bin/bash -c "cd MiniGo/src && python main.py gen && ./test.sh all"
33+
34+
- name: Debug on failure
35+
if: failure()
36+
run: |
37+
echo "=== Last 50 lines of test output ==="
38+
docker run --rm $DOCKER_IMAGE \
39+
tail -n 50 /app/MiniGo/src/test.log || true

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
.DS_Store
22
*.txt
33
.antlr/
4+
MiniGoClass.j
5+
MiniGoClass.class
46

57
# Byte-compiled / optimized / DLL files
68
__pycache__/

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ COPY requirements.txt .
1212
RUN pip install -r requirements.txt
1313

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

1818
# Set Python path for test modules
1919
# ENV PYTHONPATH="/app"

MiniGo/src/test.sh

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -86,25 +86,8 @@ case "$1" in
8686
echo "Running semantic analysis tests..."
8787
python main.py test CheckSuite
8888
echo ""
89-
;;
90-
all_with_coverage)
91-
# Execute all unit tests with coverage
92-
rm -f ${INPUT}/* 2>/dev/null
93-
rm -f ${OUTPUT}/* 2>/dev/null
94-
echo "<<< RUNNING ALL TESTS >>>"
95-
echo ""
96-
echo "Running lexical analysis tests..."
97-
coverage run --append main.py test LexerSuite
98-
echo ""
99-
echo "Running syntax analysis tests..."
100-
coverage run --append main.py test ParserSuite
101-
echo ""
102-
echo "Running AST generation tests..."
103-
coverage run --append main.py test ASTGenSuite
104-
echo ""
105-
echo "Running semantic analysis tests..."
106-
coverage run --append main.py test CheckSuite
107-
echo ""
89+
# echo "Running code generation tests..."
90+
# python main.py test CodeGenSuite
10891
;;
10992
clean)
11093
# Remove all test artifacts from directories

0 commit comments

Comments
 (0)