-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add unit tests and run them on github actions see also #240
- Loading branch information
Showing
5 changed files
with
409 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Run Tests via Makefile | ||
|
||
on: | ||
push: | ||
branches: | ||
- "master" | ||
- "devel" | ||
- "docker-github-actions" | ||
- "release/v1" | ||
- "feature/unit-testing" | ||
- "beta" | ||
tags: | ||
- "*" | ||
|
||
jobs: | ||
test: | ||
name: Run Makefile Tests | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
# - name: Install dependencies | ||
# run: | | ||
# sudo apt-get update | ||
# sudo apt-get install -y qemu-user-static binfmt-support | ||
|
||
- name: Run Makefile | ||
run: make test | ||
|
||
- name: Archive test results | ||
if: always() | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: test-results | ||
path: tests/ | ||
retention-days: 60 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Makefile for running shell script tests | ||
|
||
# Shell to use | ||
SHELL := /bin/bash | ||
|
||
# Find all test files | ||
TEST_DIR := tests | ||
TEST_FILES := $(wildcard $(TEST_DIR)/test_*.sh) | ||
|
||
# Colors for output | ||
BLUE := \033[1;34m | ||
GREEN := \033[1;32m | ||
RED := \033[1;31m | ||
NC := \033[0m # No Color | ||
|
||
.PHONY: all test clean help | ||
|
||
# Default target | ||
all: test | ||
|
||
# Help message | ||
help: | ||
@echo "Available targets:" | ||
@echo " make test - Run all tests" | ||
@echo " make clean - Clean up temporary files" | ||
@echo " make help - Show this help message" | ||
|
||
# Run all tests | ||
test: | ||
@echo -e "$(BLUE)Running tests...$(NC)" | ||
@echo "═══════════════════════════════════════" | ||
@success=true; \ | ||
for test in $(TEST_FILES); do \ | ||
echo -e "$(BLUE)Running $$test...$(NC)"; \ | ||
if chmod +x $$test && ./$$test; then \ | ||
echo -e "$(GREEN)✓ $$test passed$(NC)"; \ | ||
else \ | ||
echo -e "$(RED)✗ $$test failed$(NC)"; \ | ||
success=false; \ | ||
fi; \ | ||
echo "───────────────────────────────────────"; \ | ||
done; \ | ||
echo ""; \ | ||
if $$success; then \ | ||
echo -e "$(GREEN)All tests passed successfully!$(NC)"; \ | ||
exit 0; \ | ||
else \ | ||
echo -e "$(RED)Some tests failed!$(NC)"; \ | ||
exit 1; \ | ||
fi | ||
|
||
# Clean up any temporary files (if needed) | ||
clean: | ||
@echo -e "$(BLUE)Cleaning up...$(NC)" | ||
@find $(TEST_DIR) -type f -name "*.tmp" -delete | ||
@find $(TEST_DIR) -type f -name "*.log" -delete | ||
@echo -e "$(GREEN)Cleanup complete$(NC)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.