]>
Commit | Line | Data |
---|---|---|
a04ba49c RBR |
1 | profile := dev |
2 | target = $(shell rustc -vV | grep host | awk '{print $$2}') | |
3 | architectures := x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu | |
43780806 | 4 | app_name := blog |
d620665f RBR |
5 | |
6 | default: build | |
7 | ||
5c7a9258 RBR |
8 | set_rust: |
9 | rustup default stable | |
10 | ||
a04ba49c RBR |
11 | prepare: |
12 | rustup target add $(target) | |
d620665f | 13 | |
a04ba49c RBR |
14 | build: prepare |
15 | cargo build --profile $(profile) --target $(target) | |
16 | ||
d7fef30a RBR |
17 | test: |
18 | cargo test | |
19 | ||
20 | coverage: | |
21 | cargo tarpaulin | |
22 | ||
23 | format: | |
24 | cargo fmt && cargo clippy --fix | |
25 | ||
26 | lint: | |
27 | cargo fmt -- --check && cargo clippy | |
28 | ||
7c6c129b | 29 | release: rpm tar deb |
4dfd8d3d | 30 | @$(eval filename := $(app_name)-$(target)-$(channel)) |
c4b892b1 | 31 | |
a04ba49c | 32 | $(architectures): |
c4b892b1 RBR |
33 | ifneq ($(channel),) |
34 | $(MAKE) -e channel=$(channel) -e target=$@ release | |
43780806 RBR |
35 | else |
36 | $(MAKE) -e target=$@ build | |
c4b892b1 | 37 | endif |
a04ba49c | 38 | |
94b6e2ec | 39 | deb: build |
d26464d1 | 40 | ifeq ($(findstring linux,$(target)),linux) |
94b6e2ec RBR |
41 | @$(eval filename := $(app_name)-$(target)-$(channel)) |
42 | cargo deb --profile $(profile) --target $(target) | |
7c6c129b | 43 | mv target/$(target)/debian/*.deb $(filename).deb |
94b6e2ec RBR |
44 | sha256sum $(filename).deb > $(filename).deb.sha256 |
45 | rsync -avz $(filename).deb deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(app_name) | |
46 | rsync -avz $(filename).deb.sha256 deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(app_name) | |
d26464d1 | 47 | endif |
94b6e2ec | 48 | |
a04ba49c | 49 | rpm: build |
d26464d1 | 50 | ifeq ($(findstring linux,$(target)),linux) |
6b85c7c4 RBR |
51 | @$(eval filename := $(app_name)-$(target)-$(channel)) |
52 | cargo generate-rpm --profile $(profile) --target $(target) | |
53 | mv target/$(target)/generate-rpm/*.rpm $(filename).rpm | |
54 | sha256sum $(filename).rpm > $(filename).rpm.sha256 | |
55 | rsync -avz $(filename).rpm deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(app_name) | |
56 | rsync -avz $(filename).rpm.sha256 deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(app_name) | |
d26464d1 | 57 | endif |
a04ba49c | 58 | |
43780806 | 59 | tar: build |
4dfd8d3d RBR |
60 | @$(eval filename := $(app_name)-$(target)-$(channel)) |
61 | tar -czvf $(filename).tar.gz -C target/$(target)/$(profile)/ $(app_name) | |
6b85c7c4 | 62 | sha256sum $(filename).tar.gz > $(filename).tar.gz.sha256 |
27c166eb | 63 | rsync -avz $(filename).tar.gz deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(app_name) |
6b85c7c4 | 64 | rsync -avz $(filename).tar.gz.sha256 deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(app_name) |
43780806 | 65 | |
a04ba49c RBR |
66 | package: $(architectures) |
67 | ||
d26464d1 RBR |
68 | mac: |
69 | @$(eval mac_architectures := x86_64-apple-darwin aarch64-apple-darwin) | |
70 | ifeq ($(tag),) | |
71 | $(MAKE) -e profile=release -e architectures='$(mac_architectures)' -e channel=unstable package | |
72 | else | |
73 | $(MAKE) -e profile=release -e architectures='$(mac_architectures)' -e channel=$(tag) package | |
74 | endif | |
75 | ||
d7fef30a | 76 | ci: lint coverage |
c4b892b1 | 77 | ifeq ($(GIT_REF),refs/heads/main) |
b12f5ad8 | 78 | $(MAKE) -e profile=release -e channel=unstable package |
c4b892b1 | 79 | else ifneq (,$(findstring refs/tags/,$(GIT_REF))) |
b12f5ad8 | 80 | $(MAKE) -e profile=release -e channel=$(subst refs/tags/,,$(GIT_REF)) package |
c4b892b1 RBR |
81 | endif |
82 | ||
83 | .PHONY: default build $(architectures) rpm package prepare set_rust ci release |