chore: reformat recipes, add server/docker recipes, strip symbols for release

This commit is contained in:
Ryan Walters
2025-09-17 01:30:04 -05:00
parent f69a5c7d52
commit 264478bdaa
2 changed files with 38 additions and 9 deletions

View File

@@ -15,6 +15,8 @@ publish = false
[workspace.dependencies] [workspace.dependencies]
[profile.dev]
incremental = true
# Release profile for profiling (essentially the default 'release' profile with debug enabled) # Release profile for profiling (essentially the default 'release' profile with debug enabled)
[profile.profile] [profile.profile]
@@ -23,7 +25,8 @@ debug = true
# Undo the customizations for our release profile # Undo the customizations for our release profile
opt-level = 3 opt-level = 3
lto = false lto = false
panic = 'unwind' panic = "abort"
strip = "symbols"
# Optimized release profile for size # Optimized release profile for size
[profile.release] [profile.release]

View File

@@ -1,24 +1,25 @@
set shell := ["bash", "-c"] set shell := ["bash", "-c"]
set windows-shell := ["powershell.exe", "-NoLogo", "-Command"] set windows-shell := ["powershell.exe", "-NoLogo", "-Command"]
binary_extension := if os() == "windows" { ".exe" } else { "" } binary_extension := if os() == "windows" { ".exe" } else { "" }
# !!! --ignore-filename-regex should be used on both reports & coverage testing # Display available recipes
# !!! --remap-path-prefix prevents the absolute path from being used in the generated report default:
just --list
# Generate HTML report (for humans, source line inspection) # Open HTML coverage report
html: coverage html: coverage
cargo llvm-cov report \ cargo llvm-cov report \
# prevents the absolute path from being used in the generated report
--remap-path-prefix \ --remap-path-prefix \
--html \ --html \
--open --open
# Display report (for humans) # Display coverage report
report-coverage: coverage report-coverage: coverage
cargo llvm-cov report --remap-path-prefix cargo llvm-cov report --remap-path-prefix
# Run & generate LCOV report (as base report) # Generate baseline LCOV report
coverage: coverage:
cargo +nightly llvm-cov \ cargo +nightly llvm-cov \
--lcov \ --lcov \
@@ -28,7 +29,7 @@ coverage:
--profile coverage \ --profile coverage \
--no-fail-fast nextest --no-fail-fast nextest
# Profile the project using 'samply' # Profile the project using samply
samply: samply:
cargo build --profile profile cargo build --profile profile
samply record ./target/profile/pacman{{ binary_extension }} samply record ./target/profile/pacman{{ binary_extension }}
@@ -38,11 +39,36 @@ web *args:
bun run pacman/web.build.ts {{args}}; bun run pacman/web.build.ts {{args}};
caddy file-server --root pacman/dist caddy file-server --root pacman/dist
# Run cargo fix # Fix linting errors & formatting
fix: fix:
cargo fix --workspace --lib --allow-dirty cargo fix --workspace --lib --allow-dirty
cargo fmt --all cargo fmt --all
# Push commits & tags
push: push:
git push origin --tags; git push origin --tags;
git push git push
# Build the server image
server-image:
# build the server image
docker build \
--platform linux/amd64 \
--file ./pacman-server/Dockerfile \
--tag pacman-server \
.
# Build and run the server in a Docker container
run-server: server-image
# remove the server container if it exists
docker rm --force --volumes pacman-server
# run the server container
docker run \
--rm \
--stop-timeout 2 \
--name pacman-server \
--publish 3000:3000 \
--env PORT=3000 \
--env-file pacman-server/.env \
pacman-server