chore: added Debian packaging using cargo-deb

This commit is contained in:
Jef Roosens 2026-04-19 16:03:43 +02:00
parent f0d5522661
commit e1bf2cb467
Signed by: Jef Roosens
GPG key ID: 21FD3D77D56BAF49
4 changed files with 39 additions and 12 deletions

View file

@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased](https://git.rustybever.be/Chewing_Bever/alex/src/branch/dev) ## [Unreleased](https://git.rustybever.be/Chewing_Bever/alex/src/branch/dev)
### Added
* Debian packages are now available in the [package registry](https://git.rustybever.be/Chewing_Bever/alex/packages)
## [0.5.0](https://git.rustybever.be/Chewing_Bever/alex/src/tag/0.5.0) ## [0.5.0](https://git.rustybever.be/Chewing_Bever/alex/src/tag/0.5.0)
### Added ### Added

View file

@ -10,6 +10,7 @@ members = [
version = "0.5.0" version = "0.5.0"
authors = ["Jef Roosens"] authors = ["Jef Roosens"]
edition = "2021" edition = "2021"
license-file = "LICENSE"
[workspace.dependencies] [workspace.dependencies]
chrono = { version = "0.4.26", features = ["serde"] } chrono = { version = "0.4.26", features = ["serde"] }

View file

@ -1,20 +1,25 @@
# Build the local development build
[group('build')] [group('build')]
build: build:
cargo build --frozen --workspace cargo build --frozen --workspace
alias b := build alias b := build
# Build release binaries for the supported architectures
[group('build')] [group('build')]
build-release target: build-release:
cargo build \ cargo build \
--release \ --release \
--frozen \ --frozen \
--workspace \ --workspace \
--target '{{ target }}' --target x86_64-unknown-linux-musl \
--target aarch64-unknown-linux-musl
# Run all tests in the workspace
test: test:
cargo test --frozen --workspace cargo test --frozen --workspace
alias t := test alias t := test
# Run cargofmt and clippy
check: check:
cargo fmt --check --all cargo fmt --check --all
cargo clippy \ cargo clippy \
@ -23,6 +28,7 @@ check:
--no-deps \ --no-deps \
--deny 'clippy::all' --deny 'clippy::all'
alias c := check alias c := check
alias lint := check
fetch: fetch:
cargo fetch --locked cargo fetch --locked
@ -43,19 +49,33 @@ run:
--java '/usr/lib/jvm/java-21-openjdk/bin/java' \ --java '/usr/lib/jvm/java-21-openjdk/bin/java' \
--layers '2min,2,4,4;3min,3,2,2' --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 # Publish the binaries and packages for a new release
publish-release tag: (build-release 'x86_64-unknown-linux-musl') (build-release 'aarch64-unknown-linux-musl') [group('package')]
publish-release tag: build-release package-deb
# Check the binaries are proper static binaries # 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/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 ] [ "$(readelf -d target/aarch64-unknown-linux-musl/release/alex | grep NEEDED | wc -l)" = 0 ]
curl \ curl \
--netrc \ --parallel --fail-early \
--fail \ --netrc --upload-file target/x86_64-unknown-linux-musl/release/alex \
--upload-file target/x86_64-unknown-linux-musl/release/alex \ https://git.rustybever.be/api/packages/Chewing_Bever/generic/alex/"{{ tag }}"/alex-linux-amd64 \
https://git.rustybever.be/api/packages/Chewing_Bever/generic/alex/"{{ tag }}"/alex-linux-amd64 --next \
curl \ --netrc --upload-file target/aarch64-unknown-linux-musl/release/alex \
--netrc \ https://git.rustybever.be/api/packages/Chewing_Bever/generic/alex/"{{ tag }}"/alex-linux-arm64 \
--fail \ --next \
--upload-file target/aarch64-unknown-linux-musl/release/alex \ --netrc --upload-file target/debian/alex_{{ tag }}-1_amd64.deb \
https://git.rustybever.be/api/packages/Chewing_Bever/generic/alex/"{{ tag }}"/alex-linux-arm64 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

View file

@ -3,6 +3,8 @@ name = "alex"
description = "Wrapper around Minecraft server processes, designed to complement Docker image installations." description = "Wrapper around Minecraft server processes, designed to complement Docker image installations."
version.workspace = true version.workspace = true
edition.workspace = true edition.workspace = true
authors.workspace = true
license-file.workspace = true
[dependencies] [dependencies]
backup = { path = "../backup" } backup = { path = "../backup" }