5 Commits

Author SHA1 Message Date
0aafc2cc1e docs: Update 3 files
All checks were successful
Build-Test-Publish / build (linux/amd64) (push) Successful in 1m21s
Build-Test-Publish / build (linux/arm64) (push) Successful in 2m15s
Build-Test-Publish / test-install-from-scratch (linux/amd64) (push) Successful in 7s
Build-Test-Publish / test-install-from-scratch (linux/arm64) (push) Successful in 8s
2025-06-26 21:23:10 +12:00
2067caf253 Modify bb64/src/bb64.cpp
All checks were successful
Build-Test-Publish / build (linux/amd64) (push) Successful in 1m18s
Build-Test-Publish / build (linux/arm64) (push) Successful in 2m15s
Build-Test-Publish / test-install-from-scratch (linux/amd64) (push) Successful in 8s
Build-Test-Publish / test-install-from-scratch (linux/arm64) (push) Successful in 8s
2025-06-26 21:09:06 +12:00
4d500cbddd Update 2 files
All checks were successful
Build-Test-Publish / build (linux/amd64) (push) Successful in 1m19s
Build-Test-Publish / build (linux/arm64) (push) Successful in 2m14s
Build-Test-Publish / test-install-from-scratch (linux/amd64) (push) Successful in 7s
Build-Test-Publish / test-install-from-scratch (linux/arm64) (push) Successful in 8s
2025-06-25 22:47:45 +12:00
884609f661 Modify buildtestpublish_all.sh
Some checks failed
Build-Test-Publish / build (linux/amd64) (push) Successful in 1m19s
Build-Test-Publish / build (linux/arm64) (push) Failing after 2m14s
Build-Test-Publish / test-install-from-scratch (linux/amd64) (push) Has been skipped
Build-Test-Publish / test-install-from-scratch (linux/arm64) (push) Has been skipped
2025-06-25 22:42:52 +12:00
a5a36c179b Modify dehydrate/test/build_dehydrate_test.sh
Some checks failed
Build-Test-Publish / build (linux/amd64) (push) Failing after 1m17s
Build-Test-Publish / build (linux/arm64) (push) Successful in 2m15s
Build-Test-Publish / test-install-from-scratch (linux/amd64) (push) Has been skipped
Build-Test-Publish / test-install-from-scratch (linux/arm64) (push) Has been skipped
2025-06-25 22:41:01 +12:00
8 changed files with 241 additions and 80 deletions

View File

@ -60,6 +60,8 @@ getpkg version
### Information ### Information
- **`getpkg list`** - List all available packages with status
- **`getpkg clean`** - Clean up orphaned configs and symlinks
- **`getpkg version`** - Show getpkg version - **`getpkg version`** - Show getpkg version
- **`getpkg help`** - Show detailed help - **`getpkg help`** - Show detailed help
- **`getpkg autocomplete`** - Show available commands for completion - **`getpkg autocomplete`** - Show available commands for completion
@ -99,14 +101,14 @@ Tools are automatically downloaded for your architecture, with fallback to unive
### Installing Popular Tools ### Installing Popular Tools
```bash ```bash
# Install development tools # Install available tools
getpkg whatsdirty # Fast grep alternative getpkg install dehydrate # File to C++ code generator
getpkg fd # Fast find alternative getpkg install bb64 # Bash base64 encoder/decoder
getpkg bat # Cat with syntax highlighting
# Install system utilities # Development tools (for repository development)
getpkg whatsdirty # Check git repo status getpkg install whatsdirty # Check git repo status
getpkg sos # Simple object storage client getpkg install sos # Simple object storage client
getpkg install gp # Git push utility
``` ```
### Publishing Your Own Tools ### Publishing Your Own Tools

View File

@ -26,6 +26,8 @@ Usage:
bb64 -[i|d] BASE64COMMAND Displays the decoded command bb64 -[i|d] BASE64COMMAND Displays the decoded command
bb64 -e COMMAND Encodes the command and prints the result bb64 -e COMMAND Encodes the command and prints the result
bb64 -u Updates bb64 to the latest version (uses docker) bb64 -u Updates bb64 to the latest version (uses docker)
bb64 -v Prints the version number
bb64 version Prints the version number
``` ```
# Implementation Notes # Implementation Notes

View File

@ -77,40 +77,60 @@ if ! git config user.email >/dev/null 2>&1; then
git config user.name "CI Bot" git config user.name "CI Bot"
fi fi
# Check if tag already exists # Check if tag already exists locally
if git rev-parse "$TAG" >/dev/null 2>&1; then if git rev-parse "$TAG" >/dev/null 2>&1; then
echo "Tag $TAG already exists, deleting it first..." echo "Tag $TAG already exists locally, deleting it first..."
git tag -d "$TAG" git tag -d "$TAG"
git push origin --delete "$TAG" || true
fi fi
git tag -a "$TAG" -m "Release $TAG" # Check if tag exists on remote
if ! git push origin "$TAG"; then if git ls-remote --tags origin | grep -q "refs/tags/$TAG"; then
echo "Failed to push tag $TAG to origin" >&2 echo "Tag $TAG already exists on remote - this is expected for multi-architecture builds"
# Try to delete local tag if push failed echo "Skipping tag creation and proceeding with release attachment..."
git tag -d "$TAG" else
exit 1 echo "Creating new tag $TAG..."
git tag -a "$TAG" -m "Release $TAG"
if ! git push origin "$TAG"; then
echo "Failed to push tag $TAG to origin" >&2
# Try to delete local tag if push failed
git tag -d "$TAG"
exit 1
fi
echo "Successfully created and pushed tag $TAG"
fi fi
echo "Creating release $TAG on Gitea..." echo "Getting or creating release $TAG on Gitea..."
RELEASE_RESPONSE=$(curl -s -X POST "$API_URL/releases" \
-H "Content-Type: application/json" \
-H "Authorization: token $RELEASE_WRITE_TOKEN" \
-d "$RELEASE_DATA")
echo "Release API response: $RELEASE_RESPONSE" # First try to get existing release
EXISTING_RELEASE=$(curl -s -X GET "$API_URL/releases/tags/$TAG" \
-H "Authorization: token $RELEASE_WRITE_TOKEN")
RELEASE_ID=$(echo "$RELEASE_RESPONSE" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2) if echo "$EXISTING_RELEASE" | grep -q '"id":[0-9]*'; then
# Release already exists, get its ID
RELEASE_ID=$(echo "$EXISTING_RELEASE" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
echo "Release $TAG already exists with ID: $RELEASE_ID"
else
# Create new release
echo "Creating new release $TAG on Gitea..."
RELEASE_RESPONSE=$(curl -s -X POST "$API_URL/releases" \
-H "Content-Type: application/json" \
-H "Authorization: token $RELEASE_WRITE_TOKEN" \
-d "$RELEASE_DATA")
if [ -z "$RELEASE_ID" ]; then echo "Release API response: $RELEASE_RESPONSE"
echo "Failed to create release on Gitea." >&2
echo "API URL: $API_URL/releases" >&2 RELEASE_ID=$(echo "$RELEASE_RESPONSE" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
echo "Release data: $RELEASE_DATA" >&2
exit 1 if [ -z "$RELEASE_ID" ]; then
echo "Failed to create release on Gitea." >&2
echo "API URL: $API_URL/releases" >&2
echo "Release data: $RELEASE_DATA" >&2
exit 1
fi
echo "Created new release with ID: $RELEASE_ID"
fi fi
echo "Created release with ID: $RELEASE_ID"
# Upload binaries and install.sh # Upload binaries and install.sh
echo "Uploading assets to release..." echo "Uploading assets to release..."
for FILE in ${PROJECT}.${ARCH_ALIAS} ${PROJECT}.${ARCH} install.sh; do for FILE in ${PROJECT}.${ARCH_ALIAS} ${PROJECT}.${ARCH} install.sh; do

View File

@ -150,6 +150,7 @@ Usage:
bb64 -u Updates bb64 to the latest version (uses docker) bb64 -u Updates bb64 to the latest version (uses docker)
bb64 -v Prints the version number bb64 -v Prints the version number
bb64 version Prints the version number
)" << std::endl; )" << std::endl;
return -1; return -1;
@ -161,7 +162,7 @@ Usage:
{ {
if (mode == "-u") if (mode == "-u")
return update_bb64(); return update_bb64();
else if (mode == "-v") else if (mode == "-v" || mode == "version")
{ {
std::cout << VERSION << std::endl; std::cout << VERSION << std::endl;
return 0; return 0;

135
bb64/test.sh Executable file
View File

@ -0,0 +1,135 @@
#!/bin/bash
set -euo pipefail
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
PROJECT="bb64"
BB64="$SCRIPT_DIR/output/$PROJECT"
TEST_DIR="$SCRIPT_DIR/test_temp"
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Test counters
TESTS_PASSED=0
TESTS_FAILED=0
# Function to print test results
print_test_result() {
local test_name="$1"
local result="$2"
if [ "$result" -eq 0 ]; then
echo -e "${GREEN}${NC} $test_name"
TESTS_PASSED=$((TESTS_PASSED + 1))
else
echo -e "${RED}${NC} $test_name"
TESTS_FAILED=$((TESTS_FAILED + 1))
fi
}
# Function to cleanup test artifacts
cleanup() {
echo -e "\n${YELLOW}Cleaning up test artifacts...${NC}"
rm -rf "$TEST_DIR"
}
# Set up trap to ensure cleanup runs
trap cleanup EXIT
# Create test directory
mkdir -p "$TEST_DIR"
echo -e "${YELLOW}Running bb64 tests...${NC}\n"
# Check if bb64 binary exists
if [ ! -f "$BB64" ]; then
echo -e "${RED}Error: bb64 binary not found at $BB64${NC}"
echo "Please run ./build.sh first to build bb64"
exit 1
fi
if [ ! -x "$BB64" ]; then
echo -e "${RED}Error: bb64 binary is not executable${NC}"
exit 1
fi
echo "Using bb64 binary: $BB64"
# Test 1: Version command with -v flag
echo "Test 1: Version command (-v flag)"
VERSION_OUTPUT=$("$BB64" -v 2>&1 || true)
# Version output should be just the version number
VERSION=$(echo "$VERSION_OUTPUT" | head -n 1)
if [[ "$VERSION" =~ ^[0-9]{4}\.[0-9]{4}\.[0-9]{4}$ ]]; then
print_test_result "Version format with -v flag (YYYY.MMDD.HHMM)" 0
else
print_test_result "Version format with -v flag (YYYY.MMDD.HHMM)" 1
echo " Expected: YYYY.MMDD.HHMM format, got: '$VERSION'"
fi
# Test 2: Version command with 'version' argument
printf "\nTest 2: Version command (version argument)\n"
VERSION_OUTPUT2=$("$BB64" version 2>&1 || true)
# Version output should be just the version number
VERSION2=$(echo "$VERSION_OUTPUT2" | head -n 1)
if [[ "$VERSION2" =~ ^[0-9]{4}\.[0-9]{4}\.[0-9]{4}$ ]]; then
print_test_result "Version format with 'version' argument (YYYY.MMDD.HHMM)" 0
else
print_test_result "Version format with 'version' argument (YYYY.MMDD.HHMM)" 1
echo " Expected: YYYY.MMDD.HHMM format, got: '$VERSION2'"
fi
# Test 3: Both version commands should return the same version
printf "\nTest 3: Version consistency\n"
if [ "$VERSION" = "$VERSION2" ]; then
print_test_result "Both -v and version return same version" 0
else
print_test_result "Both -v and version return same version" 1
echo " -v returned: '$VERSION'"
echo " version returned: '$VERSION2'"
fi
# Test 4: Basic encoding test
echo -e "\nTest 4: Basic encoding test"
TEST_STRING="hello world"
ENCODED_OUTPUT=$("$BB64" -e <<< "$TEST_STRING" 2>&1 || true)
if [ -n "$ENCODED_OUTPUT" ]; then
print_test_result "Basic encoding produces output" 0
else
print_test_result "Basic encoding produces output" 1
fi
# Test 5: Basic decoding test (using -d flag)
echo -e "\nTest 5: Basic decoding test"
# Encode "echo hello" and then decode it
ENCODED_ECHO=$(echo "echo hello" | "$BB64" -e)
if [ -n "$ENCODED_ECHO" ]; then
DECODED_OUTPUT=$("$BB64" -d "$ENCODED_ECHO" 2>&1 || true)
if [[ "$DECODED_OUTPUT" == *"echo hello"* ]]; then
print_test_result "Basic decoding works correctly" 0
else
print_test_result "Basic decoding works correctly" 1
echo " Expected to contain 'echo hello', got: '$DECODED_OUTPUT'"
fi
else
print_test_result "Basic decoding works correctly" 1
echo " Failed to encode test string"
fi
cleanup
# Print summary
echo -e "\n${YELLOW}Test Summary:${NC}"
echo -e "Tests passed: ${GREEN}${TESTS_PASSED}${NC}"
echo -e "Tests failed: ${RED}${TESTS_FAILED}${NC}"
if [ "$TESTS_FAILED" -eq 0 ]; then
echo -e "\n${GREEN}All tests passed!${NC}"
exit 0
else
echo -e "\n${RED}Some tests failed!${NC}"
exit 1
fi

View File

@ -202,25 +202,25 @@ function print_summary() {
# Format build status with colors # Format build status with colors
case "$build_status" in case "$build_status" in
"✓") build_col=$(printf " ${GREEN}${NC} ") ;; "✓") build_col=$(printf " %s✓%s " "$GREEN" "$NC") ;;
"✗") build_col=$(printf " ${RED}${NC} ") ;; "✗") build_col=$(printf " %s✗%s " "$RED" "$NC") ;;
"SKIP") build_col=$(printf " ${YELLOW}-${NC} ") ;; "SKIP") build_col=$(printf " %s-%s " "$YELLOW" "$NC") ;;
*) build_col=" - " ;; *) build_col=" - " ;;
esac esac
# Format test status with colors # Format test status with colors
case "$test_status" in case "$test_status" in
"✓") test_col=$(printf " ${GREEN}${NC} ") ;; "✓") test_col=$(printf " %s✓%s " "$GREEN" "$NC") ;;
"✗") test_col=$(printf " ${RED}${NC} ") ;; "✗") test_col=$(printf " %s✗%s " "$RED" "$NC") ;;
"SKIP") test_col=$(printf " ${YELLOW}-${NC} ") ;; "SKIP") test_col=$(printf " %s-%s " "$YELLOW" "$NC") ;;
*) test_col=" - " ;; *) test_col=" - " ;;
esac esac
# Format publish status with colors # Format publish status with colors
case "$publish_status" in case "$publish_status" in
"✓") publish_col=$(printf " ${GREEN}${NC} ") ;; "✓") publish_col=$(printf " %s✓%s " "$GREEN" "$NC") ;;
"✗") publish_col=$(printf " ${RED}${NC} ") ;; "✗") publish_col=$(printf " %s✗%s " "$RED" "$NC") ;;
"SKIP") publish_col=$(printf " ${YELLOW}-${NC} ") ;; "SKIP") publish_col=$(printf " %s-%s " "$YELLOW" "$NC") ;;
*) publish_col=" - " ;; *) publish_col=" - " ;;
esac esac

View File

@ -16,47 +16,48 @@ rm -f dehydrate_test
# Build the test program using Docker # Build the test program using Docker
# The Docker container supports both amd64 and arm64 architectures # The Docker container supports both amd64 and arm64 architectures
echo "PROJECT_DIR: $PROJECT_DIR" echo "Building dehydrate test executable..."
echo "SCRIPT_DIR: $SCRIPT_DIR"
echo "Current directory: $(pwd)"
echo "Files in current directory:"
ls -la
docker run --rm \ # Use docker cp approach since volume mounting may not work in CI
-v "$SCRIPT_DIR":/workdir \ CONTAINER_NAME="dehydrate-test-build-$$"
-w /workdir \
# Start container in detached mode
docker run -d --name "$CONTAINER_NAME" \
gitea.jde.nz/public/dropshell-build-base:latest \ gitea.jde.nz/public/dropshell-build-base:latest \
bash -c " sleep 60
echo 'Docker working directory:' && pwd
echo 'Docker available files:' && ls -la
# Verify we can find the source file # Copy source file into container
if [ ! -f dehydrate_test.cpp ]; then docker cp dehydrate_test.cpp "$CONTAINER_NAME":/dehydrate_test.cpp
echo 'ERROR: dehydrate_test.cpp not found in current directory'
echo 'Available files:' && ls -la
exit 1
fi
# Clean any existing binary and compile # Compile in container
rm -f dehydrate_test docker exec "$CONTAINER_NAME" bash -c "
if ! g++ -std=c++23 -static dehydrate_test.cpp -o dehydrate_test; then echo 'Compiling dehydrate test...'
echo 'ERROR: Compilation failed' if ! g++ -std=c++23 -static /dehydrate_test.cpp -o /dehydrate_test; then
exit 1 echo 'ERROR: Compilation failed'
fi exit 1
fi
# Verify binary was created and is executable # Verify binary was created
if [ ! -f dehydrate_test ]; then if [ ! -f /dehydrate_test ]; then
echo 'ERROR: Binary was not created' echo 'ERROR: Binary was not created'
exit 1 exit 1
fi fi
# Quick architecture check - just verify the binary format # Quick architecture check
if ! file dehydrate_test | grep -q 'executable'; then if ! file /dehydrate_test | grep -q 'executable'; then
echo 'ERROR: Generated file is not an executable' echo 'ERROR: Generated file is not an executable'
file dehydrate_test file /dehydrate_test
exit 1 exit 1
fi fi
"
echo 'Compilation successful'
"
# Copy binary back to host
docker cp "$CONTAINER_NAME":/dehydrate_test ./dehydrate_test
# Clean up container
docker rm -f "$CONTAINER_NAME"
# Check if compilation succeeded # Check if compilation succeeded
if [ ! -f "./dehydrate_test" ]; then if [ ! -f "./dehydrate_test" ]; then

2
gp/gp
View File

@ -350,7 +350,7 @@ case "${1:-}" in
exit 0 exit 0
;; ;;
version) version)
echo "gp version 2.0.0" echo "2.0.1"
exit 0 exit 0
;; ;;
esac esac