forked from kellnr/kellnr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjustfile
127 lines (94 loc) · 3.55 KB
/
justfile
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
############################################
# Just commands for Kellnr
#
# It's recommended to use the just commands
# instead of the cargo commands, as they
# provide additional functionality.
############################################
##########################################
# Common commands
##########################################
check:
cargo check
build:
cargo build --features vendored-openssl
build-release:
cargo build --release --features vendored-openssl
run: npm-build build
cargo run
clean:
cargo clean
test: # Run all tests except the Postgresql integration tests, which require Docker
cargo nextest run --workspace -E 'not binary_id(db::postgres_test)'
test-all:
{{test_all}}
clean-node:
rm -rf ui/node_modules
rm -rf ui/package-lock.json
clean-all: clean clean-node
npm-build: npm-install
cd ui && npm run build
mkdir -p static
cp -r ui/dist/* static/
npm-install:
cd ui && npm install
##########################################
# Commands used by the Nix package manager
##########################################
# Used to create the needed Nix expressions for the Node.js dependencies.
# Run this command everytime you edit the ui/package.json file.
node2nix: clean-node patch-package
node2nix --development \
--input ui/nix/package.json \
--node-env ui/nix/node-env.nix \
--composition ui/nix/default.nix \
--output ui/nix/node-package.nix
patch-package:
jd -o ui/nix/package.json \
-p \
-f patch ui/nix/package-patch.json ui/package.json || true
##########################################
# Commands used by the Github Actions CI
##########################################
# Set the target for the ci-release command.
# The target can be "x86_64-unknown-linux-gnu", "aarch64-unknown-linux-gnu",
# "armv7-unknown-linux-gnueabihf", "x86_64-unknown-linux-musl", "aarch64-unknown-linux-musl",
# "armv7-unknown-linux-musleabihf".
# It's used by the Github Actions CI to build the release binary for the specified target.
target := "x86_64-unknown-linux-gnu"
ci-test: npm-build
cargo test --workspace --profile ci-dev
ci-release: npm-build
cross build --profile ci-release --target {{target}} --features vendored-openssl
##########################################
# Commands for cross-rs to build the
# release binary for different targets
##########################################
x-aarch64-musl:
cross build --target aarch64-unknown-linux-musl --features vendored-openssl
x-aarch64-gnu:
cross build --target aarch64-unknown-linux-gnu --features vendored-openssl
x-x86_64-musl:
cross build --target x86_64-unknown-linux-musl --features vendored-openssl
x-x86_64-gnu:
cross build --target x86_64-unknown-linux-gnu --features vendored-openssl
x-armv7-musl:
cross build --target armv7-unknown-linux-musleabihf --features vendored-openssl
x-armv7-gnu:
cross build --target armv7-unknown-linux-gnueabihf --features vendored-openssl
x-all: x-aarch64-musl x-aarch64-gnu x-x86_64-musl x-x86_64-gnu x-armv7-musl x-armv7-gnu
##########################################
# Aliases
##########################################
alias b := build
alias br := build-release
alias r := run
alias t := test
alias ta := test-all
alias c := check
# "true" if docker is installed, "false" otherwise
# Docker is needed for the Postgresql integration tests
has_docker := if `command -v docker > /dev/null 2>&1; echo $?` == "0" { "true" } else { "false" }
test_all := if has_docker == "true" { "cargo nextest run --workspace" } else { "echo 'ERROR: Docker is not installed. The Postgresql integration tests require Docker'" }
docker:
echo "{{has_docker}}"