-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
61 lines (51 loc) · 1.73 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#
# Copyright (C) 2021 CloudTruth, Inc.
#
.DEFAULT = ci
.PHONY = all
.PHONY += build
.PHONY += ci
.PHONY += clean
.PHONY += gen
.PHONY += help
.PHONY += precommit
.PHONY += docker
.PHONY += gha-matrices
.PHONY += help-text
.PHONY += targets
.PHONY += CLEANED # forces rebuild of generated files when directory is cleaned
.PHONY += RUST_SOURCES # forces build of Rust sources
actions_files := $(shell ls gha-matrices/*.json 2> /dev/null || echo CLEANED)
docker_files := $(shell ls docker/Dockerfile* 2> /dev/null || echo CLEANED)
config_files := config.yaml ../xtask/templates/Dockerfile
ci: clean gha-matrices docker
clean:
@echo "Cleaning generated CICD files.."
@rm -f $(shell ls ../cicd/gha-matrices/*.json ../cicd/docker/Dockerfile* 2>/dev/null)
# rm ~/.actrc
precommit: gha-matrices docker
@git ls-files -m -mo --exclude-standard |\
grep -E '^docker/Dockerfile.*|^gha-matrices/.*\.json$$' ||\
exit 0 ;\
echo 'Found unstaged changes to generated CI files. Please add them to the commit.' &&\
exit 1
gha-matrices: $(actions_files) $(config_files)
cargo xtask generate-gha-matrices --verbose
@touch gha-matrices
docker: $(docker_files) $(config_files)
cargo xtask generate-docker --verbose
@touch docker
build:
cargo build --release
help: targets
targets:
@echo ""
@echo "build - build the executable "
@echo "ci - generate CI artifacts (equivalent to make docker and make gha-matrices)"
@echo "clean - remove generated docker files"
@echo "docker - generate CI Dockerfiles"
@echo "gha-matrices - generate GHA job matrices"
@echo "precommit - makes sure CI files are up-to-date"
@echo ""
# needed when running "make all" so make doesn't complain about missing targets
$(docker_files) $(actions_files):