From f18ea43e9e38b5c981b9e7e838af6a9982656e25 Mon Sep 17 00:00:00 2001 From: Jonathan Moallem Date: Tue, 24 Nov 2020 15:13:40 +1100 Subject: [PATCH] Added test target to Makefile and updated workflow definitions --- .../workflows/{macOS-build.yml => macOS.yml} | 8 ++++---- .../workflows/{ubuntu-build.yml => ubuntu.yml} | 8 ++++---- .../{windows-build.yml => windows.yml} | 4 ++-- Makefile | 18 ++++++++++++++---- 4 files changed, 24 insertions(+), 14 deletions(-) rename .github/workflows/{macOS-build.yml => macOS.yml} (75%) rename .github/workflows/{ubuntu-build.yml => ubuntu.yml} (86%) rename .github/workflows/{windows-build.yml => windows.yml} (84%) diff --git a/.github/workflows/macOS-build.yml b/.github/workflows/macOS.yml similarity index 75% rename from .github/workflows/macOS-build.yml rename to .github/workflows/macOS.yml index 3eb69ea..949d9d1 100644 --- a/.github/workflows/macOS-build.yml +++ b/.github/workflows/macOS.yml @@ -1,4 +1,4 @@ -name: macOS-build +name: macOS on: push: @@ -8,11 +8,11 @@ on: branches: [ main ] jobs: - macOS-build: + build: runs-on: macos-latest steps: - uses: actions/checkout@v2 - name: make setup run: make setup - - name: make - run: make + - name: make test + run: make test diff --git a/.github/workflows/ubuntu-build.yml b/.github/workflows/ubuntu.yml similarity index 86% rename from .github/workflows/ubuntu-build.yml rename to .github/workflows/ubuntu.yml index 100f4e3..a3d62e4 100644 --- a/.github/workflows/ubuntu-build.yml +++ b/.github/workflows/ubuntu.yml @@ -1,4 +1,4 @@ -name: ubuntu-build +name: ubuntu on: push: @@ -8,7 +8,7 @@ on: branches: [ main ] jobs: - ubuntu-build: + build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -18,5 +18,5 @@ jobs: run: sudo apt install libasound2-dev mesa-common-dev libx11-dev libxrandr-dev libxi-dev xorg-dev libgl1-mesa-dev libglu1-mesa-dev - name: make setup run: make setup - - name: make - run: make + - name: make test + run: make test diff --git a/.github/workflows/windows-build.yml b/.github/workflows/windows.yml similarity index 84% rename from .github/workflows/windows-build.yml rename to .github/workflows/windows.yml index beb5a38..3313a33 100644 --- a/.github/workflows/windows-build.yml +++ b/.github/workflows/windows.yml @@ -1,5 +1,5 @@ -name: windows-build +name: windows on: push: @@ -9,7 +9,7 @@ on: branches: [ main ] jobs: - windows-build: + build: runs-on: windows-latest steps: - uses: actions/checkout@v2 diff --git a/Makefile b/Makefile index 3002185..03d8610 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ # Set general macros buildFile = build/app +tempDir = .temp # Check for Windows ifeq ($(OS), Windows_NT) @@ -27,16 +28,16 @@ else endif # Set UNIX commands - cleanCommand = rm $(buildFile) mkdirOptions = -p + cleanCommand = rm $(buildFile); rm -rf $(tempDir) endif run: compile execute clean -all: setup compile execute clean - setup: include lib +test: compile execute check clean + pull: # Pull and update the the build submodules git submodule init; git submodule update @@ -60,9 +61,18 @@ compile: $(compiler) -std=c++17 -I include -L lib/$(platform) src/main.cpp -o $(buildFile) -l raylib $(options) execute: - $(buildFile) # Run the executable and push the output to a log file + mkdir $(mkdirOptions) $(tempDir) + $(buildFile) | tee $(tempDir)/execute.log clean: # Clean up all relevant files $(cleanCommand) + +check: + # Search the execution log for mention of raylib starting + $(eval VAR = $(shell grep -c "raylib" $(tempDir)/execute.log)) + if [[ $(VAR) -gt 0 ]];\ + then echo "Application was started";\ + else echo "Application failed to start"; exit 1;\ + fi