Skip to content

Commit bff5080

Browse files
committed
ci: add build test targets
In order to unify a github actions per *any* workflow, add a proof of concept implementation to allow target CI trees to recognize the required steps they need for 1) build and 2) test) so we can just use a runner to issue these commands regardless of what tree we are using: make ci-build-test make ci-test If you have a repo which has a respective target CI set up then you can just run 'make help' and it will list the commands for each. For example if you use the linux-modules-kpd tree with something like this: make LINUX_TREE=https://github.com/linux-kdevops/linux-modules-kpd \ LINUX_TREE_REF=968c2b7cdd6375df4ad08166536a376f64560aa5 \ defconfig-linux-modules-kpd make help ... kdevops built-in CI build tests for linux-modules-kpd: ci-build-test - Git clones a linux git tree, build Linux, installs and reboots into it make selftests kdevops built-in run time tests for linux-modules-kpd: ci-test - Git clones a linux git tree, build Linux, installs and reboots into it make selftests-baseline If your configured tree has none of these files this target is not allowed. So this is a no-op for trees used which don't have a CI yet setup. Signed-off-by: Luis Chamberlain <[email protected]>
1 parent a400440 commit bff5080

File tree

4 files changed

+55
-0
lines changed

4 files changed

+55
-0
lines changed

.ci/build-test/linux-modules-kpd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
make selftests

.ci/test/linux-modules-kpd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
make selftests-baseline

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ $(KDEVOPS_NODES) $(KDEVOPS_VAGRANT): .config $(KDEVOPS_NODES_TEMPLATE)
235235
DEFAULT_DEPS += $(LOCALHOST_SETUP_WORK)
236236

237237
include scripts/tests.Makefile
238+
include scripts/ci.Makefile
238239

239240
PHONY += clean
240241
clean:

scripts/ci.Makefile

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# SPDX-License-Identifier: copyleft-next-0.3.1
2+
3+
# Collection of CI build targets per kernel repo
4+
5+
ifeq (y,$(CONFIG_BOOTLINUX))
6+
BOOTLINUX_BASENAME := $(shell basename $(CONFIG_BOOTLINUX_TREE))
7+
ifneq ($(wildcard .ci/build-test/$(BOOTLINUX_BASENAME)),)
8+
ifneq ($(wildcard .ci/test/$(BOOTLINUX_BASENAME)),)
9+
10+
ci-build-test: build-test-$(BOOTLINUX_BASENAME)
11+
12+
PHONY += build-test
13+
14+
ci-build-test-%::
15+
@set -e; \
16+
while IFS= read -r line || [ -n "$$line" ]; do \
17+
echo "Running: $$line"; \
18+
$$line; \
19+
done < .ci/build-test/$(BOOTLINUX_BASENAME); \
20+
21+
ci-build-test-help-menu:
22+
@echo "kdevops built-in CI build tests for $(BOOTLINUX_BASENAME):"
23+
@echo "ci-build-test - Git clones a linux git tree, build Linux, installs and reboots into it"
24+
@while IFS= read -r line || [ -n "$$line" ]; do \
25+
echo -e "\t$$line"; \
26+
done < .ci/build-test/$(BOOTLINUX_BASENAME)
27+
@echo
28+
29+
HELP_TARGETS += ci-build-test-help-menu
30+
31+
ci-test: build-test-$(BOOTLINUX_BASENAME)
32+
33+
ci-test-%::
34+
@set -e; \
35+
while IFS= read -r line || [ -n "$$line" ]; do \
36+
echo "Running: $$line"; \
37+
$$line; \
38+
done < .ci/test/$(BOOTLINUX_BASENAME); \
39+
40+
ci-test-help-menu:
41+
@echo "kdevops built-in run time tests for $(BOOTLINUX_BASENAME):"
42+
@echo "ci-test - Git clones a linux git tree, build Linux, installs and reboots into it"
43+
@while IFS= read -r line || [ -n "$$line" ]; do \
44+
echo -e "\t$$line"; \
45+
done < .ci/test/$(BOOTLINUX_BASENAME)
46+
@echo
47+
48+
HELP_TARGETS += ci-test-help-menu
49+
50+
endif # We have ci tests entries
51+
endif # We have ci build tests entries
52+
endif # CONFIG_BOOTLINUX

0 commit comments

Comments
 (0)