2 Commits

Author SHA1 Message Date
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
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
2 changed files with 66 additions and 35 deletions

View File

@ -115,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"
} }

View File

@ -16,39 +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
docker run --rm \ echo "Building dehydrate test executable..."
-v "$PROJECT_DIR":/workdir \
-w /workdir/test \ # Use docker cp approach since volume mounting may not work in CI
CONTAINER_NAME="dehydrate-test-build-$$"
# 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
# Verify we can find the source file
if [ ! -f dehydrate_test.cpp ]; then
echo 'ERROR: dehydrate_test.cpp not found in current directory'
echo 'Working directory:' && pwd
echo 'Available files:' && ls -la
exit 1
fi
# Clean any existing binary and compile # Copy source file into container
rm -f dehydrate_test docker cp dehydrate_test.cpp "$CONTAINER_NAME":/dehydrate_test.cpp
if ! g++ -std=c++23 -static dehydrate_test.cpp -o dehydrate_test; then
echo 'ERROR: Compilation failed'
exit 1
fi
# Verify binary was created and is executable # Compile in container
if [ ! -f dehydrate_test ]; then docker exec "$CONTAINER_NAME" bash -c "
echo 'ERROR: Binary was not created' echo 'Compiling dehydrate test...'
exit 1 if ! g++ -std=c++23 -static /dehydrate_test.cpp -o /dehydrate_test; then
fi echo 'ERROR: Compilation failed'
exit 1
fi
# Quick architecture check - just verify the binary format # Verify binary was created
if ! file dehydrate_test | grep -q 'executable'; then if [ ! -f /dehydrate_test ]; then
echo 'ERROR: Generated file is not an executable' echo 'ERROR: Binary was not created'
file dehydrate_test exit 1
exit 1 fi
fi
" # Quick architecture check
if ! file /dehydrate_test | grep -q 'executable'; then
echo 'ERROR: Generated file is not an executable'
file /dehydrate_test
exit 1
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