diff --git a/.github/workflows/maze-build.yml b/.github/workflows/maze-build.yml new file mode 100644 index 0000000..c614d20 --- /dev/null +++ b/.github/workflows/maze-build.yml @@ -0,0 +1,36 @@ +name: Build and Test MazeSolver + +on: + push: + branches: [ release/stm32maze ] + pull_request: + branches: [ release/stm32maze ] + +jobs: + build-and-test: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + # ubuntu-latest ships with GCC and Make — no setup action needed + + - name: Build project (debug) + run: make + + - name: Run maze solver + run: ./build/mazealgo + + - name: Build project (release / -O2) + run: | + make clean + make CFLAGS+=' -O2' + + - name: Upload build artifacts + uses: actions/upload-artifact@v4 + if: always() # capture artifacts even on failure + with: + name: mazealgo-build + path: build/ + retention-days: 7 \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..1adedda --- /dev/null +++ b/Makefile @@ -0,0 +1,25 @@ +SRCS = astar.c floodfill.c main.c +OBJS = $(patsubst %.c,build/%.o,$(SRCS)) +DEPS = $(OBJS:.o=.d) +TARGET = build/mazealgo +CC ?= gcc + +CFLAGS = -Wall -Wextra -Werror -std=c11 -Og -g -pedantic +CFLAGS += -Wconversion -Wshadow -Wformat=2 -fstack-protector-strong + +-include $(DEPS) + +build/mazealgo: $(OBJS) + $(CC) -o $@ $^ $(CFLAGS) +build/%.o: %.c + mkdir -p build + $(CC) -MMD -MP -c $< -o $@ $(CFLAGS) +.PHONY: clean help +clean: + rm -rf build + +help: + @echo "This project is built using 'make' (see Makefile)." + @echo "If the README still refers to CMake-based builds, those instructions are legacy." + @echo "To build the binary used by CI, run: make" + @echo "To clean build artifacts, run: make clean" diff --git a/astar.c b/astar.c new file mode 100644 index 0000000..0c88a0a --- /dev/null +++ b/astar.c @@ -0,0 +1,6 @@ +#include "astar.h" + +void astar(void) +{ + +} diff --git a/astar.h b/astar.h new file mode 100644 index 0000000..1276a1f --- /dev/null +++ b/astar.h @@ -0,0 +1,5 @@ +#ifndef ASTAR_H +#define ASTAR_H + +void astar(void); +#endif diff --git a/floodfill.c b/floodfill.c new file mode 100644 index 0000000..2092eb1 --- /dev/null +++ b/floodfill.c @@ -0,0 +1,6 @@ +#include "floodfill.h" + +void floodfill(void) +{ + +} diff --git a/floodfill.h b/floodfill.h new file mode 100644 index 0000000..c06783c --- /dev/null +++ b/floodfill.h @@ -0,0 +1,6 @@ +#ifndef FLOODFILL_H +#define FLOODFILL_H + +void floodfill(void); + +#endif diff --git a/main.c b/main.c new file mode 100644 index 0000000..5c6302e --- /dev/null +++ b/main.c @@ -0,0 +1,11 @@ +#include "astar.h" +#include "floodfill.h" + +int main(int argc, char** argv) +{ + (void)argc; + (void)argv; + floodfill(); + astar(); + return 0; +}