8 Commits

Author SHA1 Message Date
42b51ef0be test: Update 2 files
Some checks failed
Build-Test-Publish / build (linux/amd64) (push) Failing after 1m8s
Build-Test-Publish / build (linux/arm64) (push) Failing after 1m57s
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:38:12 +12:00
f094d532cf Modify buildtestpublish_all.sh
Some checks failed
Build-Test-Publish / build (linux/amd64) (push) Failing after 1m27s
Build-Test-Publish / build (linux/arm64) (push) Failing after 2m41s
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:33:09 +12:00
fffa88482a Modify buildtestpublish_all.sh
Some checks failed
Build-Test-Publish / build (linux/arm64) (push) Failing after 30s
Build-Test-Publish / build (linux/amd64) (push) Failing after 32s
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:32:04 +12:00
54af706032 Modify buildtestpublish_all.sh
Some checks failed
Build-Test-Publish / build (linux/amd64) (push) Failing after 25s
Build-Test-Publish / build (linux/arm64) (push) Failing after 28s
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:25:21 +12:00
ef7470dcce Modify dehydrate/src/argparse.cpp
Some checks failed
Build-Test-Publish / build (linux/arm64) (push) Failing after 40s
Build-Test-Publish / build (linux/amd64) (push) Failing after 39s
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:22:24 +12:00
d18f875c0e docs: Update 4 files
Some checks failed
Build-Test-Publish / build (linux/amd64) (push) Failing after 32s
Build-Test-Publish / build (linux/arm64) (push) Failing after 39s
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:18:43 +12:00
6f525b4f6c Modify bb64/publish.sh
Some checks failed
Build-Test-Publish / build (linux/amd64) (push) Failing after 24s
Build-Test-Publish / build (linux/arm64) (push) Failing after 27s
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:14:08 +12:00
ed13bdb5b5 Modify bb64/publish.sh
Some checks failed
Build-Test-Publish / build (linux/amd64) (push) Failing after 24s
Build-Test-Publish / build (linux/arm64) (push) Failing after 26s
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:11:44 +12:00
8 changed files with 116 additions and 25 deletions

View File

@ -5,7 +5,8 @@ if(NOT DEFINED PROJECT_NAME)
message(FATAL_ERROR "PROJECT_NAME is not defined. Pass it via -DPROJECT_NAME=<name>") message(FATAL_ERROR "PROJECT_NAME is not defined. Pass it via -DPROJECT_NAME=<name>")
endif() endif()
project(${PROJECT_NAME}) string(TIMESTAMP PROJECT_VERSION "%Y.%m%d.%H%M")
project(${PROJECT_NAME} VERSION ${PROJECT_VERSION} LANGUAGES CXX)
# Build configuration # Build configuration
set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD 23)
@ -21,6 +22,8 @@ add_executable(${PROJECT_NAME}
src/b64ed.cpp src/b64ed.cpp
) )
# Configure version.hpp
configure_file("src/version.hpp.in" "src/autogen/version.hpp" @ONLY)
# Include directories # Include directories
target_include_directories(${PROJECT_NAME} PRIVATE target_include_directories(${PROJECT_NAME} PRIVATE

View File

@ -12,19 +12,10 @@ if [ "$ARCH" = "aarch64" ]; then
ARCH_ALIAS="arm64" ARCH_ALIAS="arm64"
fi fi
# Increment version # Get version from CMake timestamp
VERSION_FILE="${SCRIPT_DIR}/src/version.h" VERSION=$(date +"%Y.%m%d.%H%M")
if [ ! -f "${VERSION_FILE}" ]; then TAG="v$VERSION"
echo "${VERSION_FILE} not found!" >&2 echo "Building version $VERSION" >&2
exit 1
else
v=$(cat "${VERSION_FILE}" | grep -o 'static const char \*VERSION = "[0-9.]*";' | cut -d'"' -f2)
oldv=$v
v=$((v+1))
echo "Incrementing version from $oldv to $v" >&2
echo "static const char *VERSION = \"$v\";" > "${VERSION_FILE}"
fi
TAG="v$v"
# build release version # build release version
export CMAKE_BUILD_TYPE="Release" export CMAKE_BUILD_TYPE="Release"
@ -77,6 +68,30 @@ if [ -z "$RELEASE_WRITE_TOKEN" ]; then
exit 1 exit 1
fi fi
# Create and push git tag
echo "Creating git tag $TAG..."
# Configure git identity if not set (for CI environments)
if ! git config user.email >/dev/null 2>&1; then
git config user.email "ci@gitea.jde.nz"
git config user.name "CI Bot"
fi
# Check if tag already exists
if git rev-parse "$TAG" >/dev/null 2>&1; then
echo "Tag $TAG already exists, deleting it first..."
git tag -d "$TAG"
git push origin --delete "$TAG" || true
fi
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 "Creating release $TAG on Gitea..." echo "Creating release $TAG on Gitea..."
RELEASE_RESPONSE=$(curl -s -X POST "$API_URL/releases" \ RELEASE_RESPONSE=$(curl -s -X POST "$API_URL/releases" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
@ -125,7 +140,7 @@ for FILE in ${PROJECT}.${ARCH_ALIAS} ${PROJECT}.${ARCH} install.sh; do
fi fi
done done
echo "Published bb64 version $v to $REPO_URL (tag $TAG) with binaries for $ARCH_ALIAS / $ARCH." echo "Published bb64 version $VERSION to $REPO_URL (tag $TAG) with binaries for $ARCH_ALIAS / $ARCH."
#-------------------------------------------------------------------------------- #--------------------------------------------------------------------------------

View File

@ -5,7 +5,7 @@
#include <cstring> #include <cstring>
#include <sstream> #include <sstream>
#include <filesystem> #include <filesystem>
#include "version.h" #include "version.hpp"
#include "b64ed.hpp" #include "b64ed.hpp"
// Recursively decode and print if nested bb64 command is found // Recursively decode and print if nested bb64 command is found

View File

@ -1 +0,0 @@
static const char *VERSION = "39";

1
bb64/src/version.hpp.in Normal file
View File

@ -0,0 +1 @@
static const char *VERSION = "@PROJECT_VERSION@";

View File

@ -2,6 +2,15 @@
set -uo pipefail # Remove -e to handle errors manually set -uo pipefail # Remove -e to handle errors manually
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
docker builder prune -f
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Arrays to track results # Arrays to track results
declare -A BUILD_RESULTS declare -A BUILD_RESULTS
declare -A TEST_RESULTS declare -A TEST_RESULTS
@ -106,13 +115,35 @@ function buildtestpublish() {
cd "$dir" || echo "Failed to cd to $dir" cd "$dir" || echo "Failed to cd to $dir"
subtitle "🔨 BUILDING $TOOLNAME_UPPER 🔨" subtitle "🔨 BUILDING $TOOLNAME_UPPER 🔨"
dothis build "$dir" "$TOOLNAME" if dothis build "$dir" "$TOOLNAME"; then
BUILD_SUCCESS=true
else
BUILD_SUCCESS=false
fi
subtitle "🔍 TESTING $TOOLNAME_UPPER 🔍" subtitle "🔍 TESTING $TOOLNAME_UPPER 🔍"
dothis test "$dir" "$TOOLNAME" if [ "$BUILD_SUCCESS" = true ]; then
if dothis test "$dir" "$TOOLNAME"; then
TEST_SUCCESS=true
else
TEST_SUCCESS=false
fi
else
echo "Skipping tests - build failed"
TEST_RESULTS["$TOOLNAME"]="SKIP"
TEST_SUCCESS=false
fi
subtitle "📦 PUBLISHING $TOOLNAME_UPPER 📦" subtitle "📦 PUBLISHING $TOOLNAME_UPPER 📦"
dothis publish "$dir" "$TOOLNAME" if [ "$BUILD_SUCCESS" = true ] && [ "$TEST_SUCCESS" = true ]; then
dothis publish "$dir" "$TOOLNAME"
elif [ "$BUILD_SUCCESS" = true ] && [ "${TEST_RESULTS[$TOOLNAME]}" = "SKIP" ]; then
# If tests are skipped (no test script), allow publish if build succeeded
dothis publish "$dir" "$TOOLNAME"
else
echo "Skipping publish - build or tests failed"
PUBLISH_RESULTS["$TOOLNAME"]="SKIP"
fi
echo "Done" echo "Done"
} }
@ -166,9 +197,36 @@ function print_summary() {
local test_status="${TEST_RESULTS[$project]:-'-'}" local test_status="${TEST_RESULTS[$project]:-'-'}"
local publish_status="${PUBLISH_RESULTS[$project]:-'-'}" local publish_status="${PUBLISH_RESULTS[$project]:-'-'}"
printf "│ %-*s │ %-7s │ %-7s │ %-7s │\n" \ # Format status with proper spacing and colors for Unicode characters
local build_col test_col publish_col
# Format build status with colors
case "$build_status" in
"✓") build_col=$(printf " ${GREEN}${NC} ") ;;
"✗") build_col=$(printf " ${RED}${NC} ") ;;
"SKIP") build_col=$(printf " ${YELLOW}-${NC} ") ;;
*) build_col=" - " ;;
esac
# Format test status with colors
case "$test_status" in
"✓") test_col=$(printf " ${GREEN}${NC} ") ;;
"✗") test_col=$(printf " ${RED}${NC} ") ;;
"SKIP") test_col=$(printf " ${YELLOW}-${NC} ") ;;
*) test_col=" - " ;;
esac
# Format publish status with colors
case "$publish_status" in
"✓") publish_col=$(printf " ${GREEN}${NC} ") ;;
"✗") publish_col=$(printf " ${RED}${NC} ") ;;
"SKIP") publish_col=$(printf " ${YELLOW}-${NC} ") ;;
*) publish_col=" - " ;;
esac
printf "│ %-*s │%b│%b│%b│\n" \
$max_project_width "$project" \ $max_project_width "$project" \
"$build_status" "$test_status" "$publish_status" "$build_col" "$test_col" "$publish_col"
done done
# Print bottom border # Print bottom border

View File

@ -17,12 +17,19 @@ Examples:
dehydrate src/ output/ Creates _src.cpp and _src.hpp in output/ dehydrate src/ output/ Creates _src.cpp and _src.hpp in output/
dehydrate -u Updates dehydrate to the latest version dehydrate -u Updates dehydrate to the latest version
dehydrate -v Shows version number dehydrate -v Shows version number
dehydrate version Shows version number
)"; )";
Args parse_args(int argc, char* argv[]) { Args parse_args(int argc, char* argv[]) {
Args args; Args args;
int idx = 1; int idx = 1;
// Check for "version" as first argument (no dash)
if (argc > 1 && std::string(argv[1]) == "version") {
args.version = true;
return args;
}
// Parse flags // Parse flags
while (idx < argc && argv[idx][0] == '-') { while (idx < argc && argv[idx][0] == '-') {
std::string flag = argv[idx]; std::string flag = argv[idx];

View File

@ -16,15 +16,23 @@ 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 "SCRIPT_DIR: $SCRIPT_DIR"
echo "Current directory: $(pwd)"
echo "Files in current directory:"
ls -la
docker run --rm \ docker run --rm \
-v "$PROJECT_DIR":/workdir \ -v "$SCRIPT_DIR":/workdir \
-w /workdir/test \ -w /workdir \
gitea.jde.nz/public/dropshell-build-base:latest \ gitea.jde.nz/public/dropshell-build-base:latest \
bash -c " bash -c "
echo 'Docker working directory:' && pwd
echo 'Docker available files:' && ls -la
# Verify we can find the source file # Verify we can find the source file
if [ ! -f dehydrate_test.cpp ]; then if [ ! -f dehydrate_test.cpp ]; then
echo 'ERROR: dehydrate_test.cpp not found in current directory' echo 'ERROR: dehydrate_test.cpp not found in current directory'
echo 'Working directory:' && pwd
echo 'Available files:' && ls -la echo 'Available files:' && ls -la
exit 1 exit 1
fi fi