Added test target to Makefile and updated workflow definitions

This commit is contained in:
Jonathan Moallem 2020-11-24 15:13:40 +11:00
parent c9f35add85
commit f18ea43e9e
4 changed files with 24 additions and 14 deletions

View File

@ -1,4 +1,4 @@
name: macOS-build name: macOS
on: on:
push: push:
@ -8,11 +8,11 @@ on:
branches: [ main ] branches: [ main ]
jobs: jobs:
macOS-build: build:
runs-on: macos-latest runs-on: macos-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: make setup - name: make setup
run: make setup run: make setup
- name: make - name: make test
run: make run: make test

View File

@ -1,4 +1,4 @@
name: ubuntu-build name: ubuntu
on: on:
push: push:
@ -8,7 +8,7 @@ on:
branches: [ main ] branches: [ main ]
jobs: jobs:
ubuntu-build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - 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 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 - name: make setup
run: make setup run: make setup
- name: make - name: make test
run: make run: make test

View File

@ -1,5 +1,5 @@
name: windows-build name: windows
on: on:
push: push:
@ -9,7 +9,7 @@ on:
branches: [ main ] branches: [ main ]
jobs: jobs:
windows-build: build:
runs-on: windows-latest runs-on: windows-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2

View File

@ -1,5 +1,6 @@
# Set general macros # Set general macros
buildFile = build/app buildFile = build/app
tempDir = .temp
# Check for Windows # Check for Windows
ifeq ($(OS), Windows_NT) ifeq ($(OS), Windows_NT)
@ -27,16 +28,16 @@ else
endif endif
# Set UNIX commands # Set UNIX commands
cleanCommand = rm $(buildFile)
mkdirOptions = -p mkdirOptions = -p
cleanCommand = rm $(buildFile); rm -rf $(tempDir)
endif endif
run: compile execute clean run: compile execute clean
all: setup compile execute clean
setup: include lib setup: include lib
test: compile execute check clean
pull: pull:
# Pull and update the the build submodules # Pull and update the the build submodules
git submodule init; git submodule update 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) $(compiler) -std=c++17 -I include -L lib/$(platform) src/main.cpp -o $(buildFile) -l raylib $(options)
execute: execute:
$(buildFile)
# Run the executable and push the output to a log file # Run the executable and push the output to a log file
mkdir $(mkdirOptions) $(tempDir)
$(buildFile) | tee $(tempDir)/execute.log
clean: clean:
# Clean up all relevant files # Clean up all relevant files
$(cleanCommand) $(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