Skip to content

Commit e12c01a

Browse files
committed
Merge branch 'pj/ci-unit-test'
* pj/ci-unit-test: CI: makefile improvements CI: add unit tests
2 parents 6381667 + cf9b1f1 commit e12c01a

File tree

7 files changed

+424
-1
lines changed

7 files changed

+424
-1
lines changed

.github/workflows/aunit_tests.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: arduino-timer unit tests
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
8+
runs-on: ubuntu-18.04
9+
10+
steps:
11+
- uses: actions/checkout@v2
12+
13+
- name: Build
14+
run: |
15+
make -C extras/tests
16+
- name: Run
17+
run: |
18+
make -C extras/tests runtests
19+

.github/workflows/githubci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: arduino-timer Library CI
1+
name: arduino-timer platform builds
22

33
on: [pull_request, push, repository_dispatch]
44

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@
44
Doxyfile*
55
doxygen_sqlite3.db
66
html
7+
*.out
8+
*.o
9+
*.swp

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ $(NAME)-$(VERSION).zip:
66

77
tag:
88
git tag $(VERSION)
9+
10+
test:
11+
$(MAKE) -C extras/tests/ test

extras/tests/Makefile

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
TESTS := $(wildcard *Test)
2+
3+
UNIXHOSTDUINO := ../../../UnixHostDuino/UnixHostDuino.mk
4+
UNIXHOSTDUINO_URL := https://github.com/bxparks/UnixHostDuino
5+
UNIXHOSTDUINO_TAG := 1936444e0097a37ad268e5e3d6e6cca8d957a86b
6+
AUNIT := ../../../AUnit/
7+
AUNIT_URL := https://github.com/bxparks/AUnit
8+
AUNIT_TAG := e0aa8dfb635101d170cdb9fd9669e1d8047e2db1
9+
10+
### ### ###
11+
12+
UHD_DIR := $(dir $(UNIXHOSTDUINO))
13+
AU_DIR := $(dir $(AUNIT))
14+
SUB_DIRS := $(addsuffix /, $(TESTS))
15+
TEST_DIRS := $(join $(SUB_DIRS), $(TESTS))
16+
17+
INOS := $(addsuffix .ino, $(join $(SUB_DIRS), $(TESTS)))
18+
BINS := $(addsuffix .out, $(TEST_DIRS))
19+
RUNS := $(addsuffix .run, $(BINS))
20+
CLEANS := $(addsuffix .clean, $(SUB_DIRS))
21+
22+
all: $(BINS)
23+
24+
$(UHD_DIR):
25+
git clone $(UNIXHOSTDUINO_URL) $@
26+
cd $@; git checkout $(UNIXHOSTDUINO_TAG)
27+
28+
$(AU_DIR):
29+
git clone $(AUNIT_URL) $@
30+
cd $@; git checkout $(AUNIT_TAG)
31+
32+
$(BINS): $(INOS) $(UHD_DIR) $(AU_DIR)
33+
# ==== Building: $(dir $@)
34+
$(MAKE) UNIXHOSTDUINO=../$(UNIXHOSTDUINO) -C $(dir $@)
35+
36+
$(RUNS): $(BINS)
37+
# ==== Running: $(@:.run=)
38+
$(@:.run=)
39+
40+
$(CLEANS):
41+
# ==== Cleaning: $(@:.clean=)
42+
$(MAKE) UNIXHOSTDUINO=../$(UNIXHOSTDUINO) -C $(@:.clean=) clean
43+
44+
tests: $(BINS)
45+
46+
runtests: $(RUNS)
47+
48+
clean: $(CLEANS)
49+
50+
test: runtests clean

extras/tests/timerTest/Makefile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# See https://github.com/bxparks/UnixHostDuino for documentation about this
2+
# Makefile to compile and run Arduino programs natively on Linux or MacOS.
3+
#
4+
5+
APP_NAME := timerTest
6+
ARDUINO_LIBS := AUnit arduino-timer
7+
CPPFLAGS += -Werror
8+
9+
include $(UNIXHOSTDUINO)

0 commit comments

Comments
 (0)