feat: add build system and integration tests

- Update Makefile with test-coverage and verify targets
- Add build.sh script for cross-platform builds with SHA256 checksums
- Implement integration tests for full workflow (add/list/get/update/export/delete)
- Add config integration test
- Update project state documentation
This commit is contained in:
swanadiva
2026-06-23 14:03:08 +07:00
parent 30b57f6084
commit c2d6aabea0
4 changed files with 229 additions and 7 deletions
Executable
+48
View File
@@ -0,0 +1,48 @@
#!/bin/bash
# Build script for multiple platforms
set -e
VERSION=${VERSION:-$(git describe --tags --always --dirty 2>/dev/null || echo "dev")}
BUILD_DIR=${BUILD_DIR:-"build"}
BINARY_NAME="hostkeeper"
echo "Building Hostkeeper v${VERSION}"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
rm -rf ${BUILD_DIR}
mkdir -p ${BUILD_DIR}
platforms=(
"linux/amd64"
"linux/arm64"
"linux/arm"
"darwin/amd64"
"darwin/arm64"
"windows/amd64"
)
for platform in "${platforms[@]}"; do
IFS='/' read -r os arch <<< "$platform"
output_name="${BINARY_NAME}-${os}-${arch}"
if [ "$os" = "windows" ]; then
output_name="${output_name}.exe"
fi
echo " Building for ${os}/${arch}..."
GOOS=$os GOARCH=$arch go build \
-ldflags "-X main.version=${VERSION} -X main.buildTime=$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
-o "${BUILD_DIR}/${output_name}" \
./cmd/hostkeeper
if command -v shasum &> /dev/null; then
(cd ${BUILD_DIR} && shasum -a 256 "${output_name}" > "${output_name}.sha256")
fi
done
echo ""
echo "Build complete! Binaries in ${BUILD_DIR}/"
echo ""
echo "Available binaries:"
ls -lh ${BUILD_DIR}/