fix: cargo build rerun id static changed & add a service & Update justfile
3 files changed, 57 insertions(+), 22 deletions(-)
@@ -1,5 +1,7 @@
fn main() {
// Cargo watches this directory recursively; any file added/changed/removed
// under it triggers a rebuild on the next `cargo build`/`cargo run`.
// Cargo watches these directories recursively; any file added/changed/removed
// under them triggers a rebuild on the next `cargo build`/`cargo run`.
println!("cargo:rerun-if-changed=src");
println!("cargo:rerun-if-changed=templates");
println!("cargo:rerun-if-changed=static");
}
@@ -1,0 +1,16 @@
[Unit]
Description=git-rs — Lightweight Git web frontend
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=root
WorkingDirectory=/srv/git
ExecStart=/usr/bin/git-rs --url 0.0.0.0 --port 80 --repos-dir /srv/git
Restart=on-failure
RestartSec=5
AmbientCapabilities=CAP_NET_BIND_SERVICE
[Install]
WantedBy=multi-user.target
@@ -1,29 +1,46 @@
build mode="":
cargo build --{{mode}}
run:
cargo run
debug argument="":
@GIT_LOG=trace cargo run -- {{argument}}
@bat ~/.cache/nmrs-tui/nmrs-tui.log
arm_target := "aarch64-unknown-linux-gnu"
default:
@just --list
# Build debug binary
build *args:
cargo build {{args}}
# Build optimized release binary (x86_64)
build-release:
cargo build --release
# Cross-compile static ARM64 binary for Orange Pi
build-arm:
cargo build --release --target {{arm_target}}
# Build and deploy ARM64 binary + systemd service to Orange Pi
deploy host="pi": build-arm
ssh {{host}} "systemctl stop git-rs || true"
scp target/{{arm_target}}/release/git-rs {{host}}:/usr/bin/git-rs
# scp git-rs.service {{host}}:/etc/systemd/system/git-rs.service
ssh {{host}} "systemctl daemon-reload && systemctl start git-rs"
# Run locally (e.g. `just run -p 8080 -r ./repos`)
run *args:
cargo run -- {{args}}
# Fast type and borrow check
check:
cargo check
package:
cargo package
cargo check --all-targets
publish:
cargo publish
release level="patch":
cargo release {{level}} --execute
# Format all Rust code
fmt:
cargo fmt --all
# Run clippy with warnings denied
lint:
cargo clippy --all-targets --all-features -- -D warnings
# Run format and lint checks
ci: fmt lint
# Remove build artifacts
clean:
cargo clean