-
-
Notifications
You must be signed in to change notification settings - Fork 61
/
Copy pathMakefile
66 lines (54 loc) · 1.82 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
SHELL := /bin/bash
pg_port ?= 5499
mysql_port ?= 3317
postgres_url ?= postgres://root:password@localhost:$(pg_port)/rainfrog?sslmode=disable
mysql_url ?= mysql://root:password@localhost:$(mysql_port)/rainfrog?useSSL=false
sqlite_url ?= sqlite://./dev/rainfrog.sqlite3
url ?= $(postgres_url)
version ?= ""
.DEFAULT_GOAL := restart
.PHONY: dev profile restart release
dev:
cargo run -- -u $(url)
dev-postgres:
cargo run -- -u $(postgres_url)
dev-mysql:
cargo run -- -u $(mysql_url)
dev-sqlite:
cargo run -- -u $(sqlite_url)
dev-termux:
cargo run --features termux --no-default-features -- -u $(url)
dev-termux-sqlite:
cargo run --features termux --no-default-features -- -u $(sqlite_url)
profile:
cargo flamegraph --post-process flamelens --root -- -u $(url)
db-up:
sqlite3 ./dev/rainfrog.sqlite3 < ./dev/sqlite_init.sql
PG_PORT=$(pg_port) MYSQL_PORT=$(mysql_port) docker compose up -d --wait
sleep 1
db-down:
rm -f ./dev/rainfrog.sqlite3
docker compose kill
docker compose rm -f -v
restart: db-down db-up dev
release:
@if [ -z "$(version)" ]; then echo "version is required"; exit 1; fi
git checkout main
git pull
@if [ $$(git tag -l "v$(version)") ]; then echo "version already exists"; exit 1; fi
git checkout -b release/v$(version) && git push -u origin release/v$(version)
sed -i "" "s/^version = .*/version = \"$(version)\"/" ./Cargo.toml
cargo build
git status
git add Cargo.toml
git add Cargo.lock
git commit -m "bump to v$(version)"
git push
gh pr create --fill --label no-release-notes
gh pr diff | cat
@read -n 1 -p "are you sure you want to release v$(version)? [Y/n] " confirmation && if [ "$$confirmation" = "Y" ]; then echo " continuing..."; else echo " aborting..."; exit 1; fi
gh pr merge --admin --squash --delete-branch
git checkout main
git pull
git tag "v$(version)" main
git push origin "v$(version)"