alex/Justfile

81 lines
2.5 KiB
Makefile

# Build the local development build
[group('build')]
build:
cargo build --frozen --workspace
alias b := build
# Build release binaries for the supported architectures
[group('build')]
build-release:
cargo build \
--release \
--frozen \
--workspace \
--target x86_64-unknown-linux-musl \
--target aarch64-unknown-linux-musl
# Run all tests in the workspace
test:
cargo test --frozen --workspace
alias t := test
# Run cargofmt and clippy
check:
cargo fmt --check --all
cargo clippy \
--frozen \
--all -- \
--no-deps \
--deny 'clippy::all'
alias c := check
alias lint := check
fetch:
cargo fetch --locked
clean:
cargo clean
doc:
cargo doc --workspace --frozen
run:
mkdir -p data
cargo run --frozen --package alex -- run \
--config data/config \
--backup data/backups \
--world data/worlds \
--jar ./paper-1.21.5-77.jar \
--java '/usr/lib/jvm/java-21-openjdk/bin/java' \
--layers '2min,2,4,4;3min,3,2,2'
# Package the static release binaries as a Debian package
[group('package')]
package-deb: build-release
cargo deb \
--package alex \
--frozen \
--no-build \
--target x86_64-unknown-linux-musl \
--target aarch64-unknown-linux-musl
# Publish the binaries and packages for a new release
[group('package')]
publish-release tag: build-release package-deb
# Check the binaries are proper static binaries
[ "$(readelf -d target/x86_64-unknown-linux-musl/release/alex | grep NEEDED | wc -l)" = 0 ]
[ "$(readelf -d target/aarch64-unknown-linux-musl/release/alex | grep NEEDED | wc -l)" = 0 ]
curl \
--parallel --fail-early \
--netrc --upload-file target/x86_64-unknown-linux-musl/release/alex \
https://git.rustybever.be/api/packages/Chewing_Bever/generic/alex/"{{ tag }}"/alex-linux-amd64 \
--next \
--netrc --upload-file target/aarch64-unknown-linux-musl/release/alex \
https://git.rustybever.be/api/packages/Chewing_Bever/generic/alex/"{{ tag }}"/alex-linux-arm64 \
--next \
--netrc --upload-file target/debian/alex_{{ tag }}-1_amd64.deb \
https://git.rustybever.be/api/packages/Chewing_Bever/debian/pool/any/main/upload \
--next \
--netrc --upload-file target/debian/alex_{{ tag }}-1_arm64.deb \
https://git.rustybever.be/api/packages/Chewing_Bever/debian/pool/any/main/upload > /dev/null