Skip to content
Open
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
9 changes: 6 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ jobs:

- name: Create ZIP of .app
run: |
ditto -c -k --keepParent .bin/SyntaxTutor.app SyntaxTutor-${{ steps.version.outputs.value }}-macos-x86_64.zip
cd .bin && ditto -c -k --keepParent SyntaxTutor.app ../SyntaxTutor-${{ steps.version.outputs.value }}-macos-x86_64.zip

- name: Upload artifact
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -243,7 +243,7 @@ jobs:

- name: Create ZIP of .app (arm64)
run: |
zip -qry SyntaxTutor-${{ steps.version.outputs.value }}-macos-arm64.zip .bin/SyntaxTutor.app
cd .bin && zip -qry ../SyntaxTutor-${{ steps.version.outputs.value }}-macos-arm64.zip SyntaxTutor.app

- name: Upload artifacts
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -300,7 +300,10 @@ jobs:
windeployqt --release .\deploy\SyntaxTutor.exe --dir deploy

- name: Zip Windows bundle
run: powershell Compress-Archive -Path deploy -DestinationPath SyntaxTutor-${{ steps.version.outputs.value }}-windows-x64.zip
shell: pwsh
run: |
Rename-Item deploy SyntaxTutor
Compress-Archive -Path SyntaxTutor -DestinationPath SyntaxTutor-${{ steps.version.outputs.value }}-windows-x64.zip

- name: Upload zipped Windows bundle
uses: actions/upload-artifact@v4
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,15 @@ jobs:
run: ./test_runner

- name: Build Qt tests
working-directory: tests
run: |
qmake6 tests.pro
make -j"$(nproc)"
mkdir -p build/tests
cd build/tests && qmake6 $GITHUB_WORKSPACE/tests/tests.pro
make -C build/tests -j"$(nproc)"

- name: Run Qt tests
working-directory: tests
env:
QT_QPA_PLATFORM: offscreen
run: ./.bin/tutor_tests
run: build/tests/.bin/tutor_tests

- name: Install gcovr & generate SonarQube XML coverage
run: |
Expand Down
64 changes: 64 additions & 0 deletions GNUmakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
BUILD_DIR = build
APP_BUILD = $(BUILD_DIR)/app
TEST_BUILD = $(BUILD_DIR)/tests
CORE_BUILD = $(BUILD_DIR)/core
QMAKE = qmake6
JOBS = $(shell nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 4)
CXX ?= g++

# Locate gtest via pkg-config, then common brew/system paths
GTEST_CFLAGS := $(shell pkg-config --cflags gtest 2>/dev/null)
GTEST_LIBS := $(shell pkg-config --libs gtest gtest_main 2>/dev/null)
ifeq ($(GTEST_LIBS),)
GTEST_PREFIX := $(shell brew --prefix googletest 2>/dev/null)
ifneq ($(GTEST_PREFIX),)
GTEST_CFLAGS := -I$(GTEST_PREFIX)/include
GTEST_LIBS := -L$(GTEST_PREFIX)/lib -lgtest -lgtest_main
else
GTEST_CFLAGS := -I/usr/include
GTEST_LIBS := -lgtest -lgtest_main -lpthread
endif
endif

BACKEND_SRCS = \
src/backend/grammar.cpp \
src/backend/grammar_factory.cpp \
src/backend/grammar_parser.cpp \
src/backend/ll1_parser.cpp \
src/backend/lr0_item.cpp \
src/backend/slr1_parser.cpp \
src/backend/symbol_table.cpp \
src/backend/tests.cpp

.PHONY: all app tests core check check-core check-ui clean

all: app tests core

app:
mkdir -p $(APP_BUILD)
cd $(APP_BUILD) && $(QMAKE) $(CURDIR)/SyntaxTutor.pro CONFIG+=release
$(MAKE) -C $(APP_BUILD) -j$(JOBS)

tests:
mkdir -p $(TEST_BUILD)
cd $(TEST_BUILD) && $(QMAKE) $(CURDIR)/tests/tests.pro
$(MAKE) -C $(TEST_BUILD) -j$(JOBS)

core:
mkdir -p $(CORE_BUILD)
$(CXX) -std=gnu++2a -O2 -Isrc/backend \
$(GTEST_CFLAGS) \
$(BACKEND_SRCS) \
$(GTEST_LIBS) \
-o $(CORE_BUILD)/core_tests

check: check-core check-ui

check-core: core
$(CORE_BUILD)/core_tests

check-ui: tests
QT_QPA_PLATFORM=offscreen $(TEST_BUILD)/.bin/tutor_tests

clean:
rm -rf $(BUILD_DIR)
Loading