From 6741a1f2fd6d6efc597ff69641aa6be3212b8727 Mon Sep 17 00:00:00 2001 From: icex2 Date: Sat, 19 Oct 2019 23:10:52 +0200 Subject: [PATCH] Add code formatting and testing to build pipeline. #3 This adds a few new make targets for formatting, testing and release building. --- GNUmakefile | 30 ++++++++++++++++++++++++------ doc/development.md | 24 ++++++++++++++++++++++-- 2 files changed, 46 insertions(+), 8 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index eeb037f..3042662 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -29,17 +29,35 @@ ldflags := -Wl,--gc-sections -static-libgcc # Define our ultimate target (`all') here, and also some helpers # -all: +all: print-building + +.PHONY: clean release code-format print-building + +print-building: + @echo "Building gitrev "$(gitrev)"..." + +print-release: + @echo "Release build started" + +release: print-release clean code-format run-tests + +clean: + @echo "Cleaning up..." + $(V)rm -rf $(BUILDDIR) + +code-format: + @echo "Applying clang-format..." +# -style=file enables reading .clang-format + @find src/ -iname *.h -o -iname *.c | xargs clang-format -i -style=file + +run-tests: + @echo "Running tests..." + @./run-tests-wine.sh # Generate a version file to identify the build version: @echo "$(gitrev)" > version -.PHONY: clean - -clean: - $(V)rm -rf $(BUILDDIR) - # # Pull in module definitions # diff --git a/doc/development.md b/doc/development.md index 781c4be..e54b702 100644 --- a/doc/development.md +++ b/doc/development.md @@ -44,10 +44,30 @@ make All output is located in the *build* folder including the final *bemanitools.zip* package. +### Release building +A release build is a clean build including code formatting and testing. This can be executed by running the following +command: +``` +make release +``` + +## Code formatting +To apply our code style using clang-format, simply run the following command: +``` +make code-format +``` + +Please also refer to the [section about](###Additional-code-style-guidelines) which cannot be covered using +clang-format. + ## Testing This still needs to be improved/implemented properly to run the unit-tests easily. Currently, you have to be on either -a Linux/MacOSX system to run *run-test-wine.sh* from the root folder. This executes all currently available unit-tests -and reports to the terminal any errors. This requires wine to be installed. +a Linux/MacOSX system and run +``` +make run-tests +``` +This executes all currently available unit-tests and reports to the terminal any errors. This requires wine to be +installed. ## Project structure Now that your setup is ready to go, here is brief big picture of what you find in this project.