-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
94 lines (69 loc) · 2.42 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
RUST_SOURCE = Cargo.toml Cargo.lock $(shell find crates/ -name "*.rs" -or -name "*.toml" | sed 's/ /\\ /g')
RUST_TARGET_DIR := target/x86_64-unknown-linux-gnu
# FEATURES ?= ""
# /tmp/scmscx.com/FEATURES: .phony
# mkdir -p "$(@D)"
# @if [[ `cat ARGS 2>&1` != '$(FEATURES)' ]]; then echo -n $(FEATURES) >$@; fi
SHELL=/bin/bash
$(RUST_TARGET_DIR)/debug/scmscx-com: $(RUST_SOURCE)
cargo build --bin scmscx-com
$(RUST_TARGET_DIR)/release/scmscx-com: $(RUST_SOURCE)
cargo build --release --bin scmscx-com
package-lock.json node_modules &: package.json
npm i
touch node_modules
touch package-lock.json
dist/vite: node_modules vite.config.ts tsconfig.json $(shell find app | sed 's/ /\\ /g')
mkdir -p dist/vite
npm run build
touch $@
dist/debug: $(RUST_TARGET_DIR)/debug/scmscx-com dist/vite
mkdir -p dist/debug
cp -pr $(RUST_TARGET_DIR)/debug/scmscx-com dist/debug
cp -pr app/web/uiv2 dist/debug
cp -pr app/web/public dist/debug
cp -a dist/vite dist/debug/dist
touch $@
dist/release: $(RUST_TARGET_DIR)/release/scmscx-com dist/vite
mkdir -p dist/release
cp -pr $(RUST_TARGET_DIR)/release/scmscx-com dist/release
cp -pr app/web/uiv2 dist/release
cp -pr app/web/public dist/release
cp -a dist/vite dist/release/dist
touch $@
image-debug: dist/debug
podman-compose build --build-arg PROFILE="debug"
image-release: dist/release
podman-compose build --build-arg PROFILE="release"
check: $(RUST_SOURCE)
cargo check --workspace --all-targets
build: $(RUST_SOURCE)
cargo build --workspace --all-targets
test: $(RUST_SOURCE)
cargo test --no-fail-fast --workspace --all-targets
cargo test --no-fail-fast --workspace --doc
fmt: $(RUST_SOURCE)
cargo fmt --all -- --check
clippy: $(RUST_SOURCE)
# cargo clippy -- -Dclippy::all -Dclippy::pedantic
cargo clippy --workspace --all-targets -- \
-A clippy::all \
-D clippy::correctness \
-D clippy::suspicious \
-D clippy::complexity \
-A clippy::clone-on-copy # I think .clone() is much clearer than deref + implcit copy
ci: check build test fmt clippy image-debug
run: image-debug
podman-compose down
podman-compose up
run-release: image-release
podman-compose down
podman-compose up
push: image-release
podman push oni.zxcv.io/scmscx.com
dev:
npm run dev
deploy:
ssh -i~/.ssh/stan -C [email protected] podman pull oni.zxcv.io/scmscx.com
ssh -i~/.ssh/stan -C [email protected] systemctl restart scmscx.com
.PHONY: .phony check build test fmt clippy ci run run-release push dev deploy