Compare commits
4 Commits
v2025.0625
...
v2025.0625
Author | SHA1 | Date | |
---|---|---|---|
a5a36c179b | |||
42b51ef0be | |||
f094d532cf | |||
fffa88482a |
@ -2,6 +2,9 @@
|
||||
set -uo pipefail # Remove -e to handle errors manually
|
||||
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'
|
||||
@ -112,13 +115,35 @@ function buildtestpublish() {
|
||||
cd "$dir" || echo "Failed to cd to $dir"
|
||||
|
||||
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 🔍"
|
||||
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 📦"
|
||||
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"
|
||||
}
|
||||
@ -175,27 +200,27 @@ function print_summary() {
|
||||
# Format status with proper spacing and colors for Unicode characters
|
||||
local build_col test_col publish_col
|
||||
|
||||
# Format build status
|
||||
# Format build status with colors
|
||||
case "$build_status" in
|
||||
"✓") build_col=" ${GREEN}✓${NC} " ;;
|
||||
"✗") build_col=" ${RED}✗${NC} " ;;
|
||||
"SKIP") build_col=" ${YELLOW}-${NC} " ;;
|
||||
"✓") build_col=$(printf " ${GREEN}✓${NC} ") ;;
|
||||
"✗") build_col=$(printf " ${RED}✗${NC} ") ;;
|
||||
"SKIP") build_col=$(printf " ${YELLOW}-${NC} ") ;;
|
||||
*) build_col=" - " ;;
|
||||
esac
|
||||
|
||||
# Format test status
|
||||
# Format test status with colors
|
||||
case "$test_status" in
|
||||
"✓") test_col=" ${GREEN}✓${NC} " ;;
|
||||
"✗") test_col=" ${RED}✗${NC} " ;;
|
||||
"SKIP") test_col=" ${YELLOW}-${NC} " ;;
|
||||
"✓") test_col=$(printf " ${GREEN}✓${NC} ") ;;
|
||||
"✗") test_col=$(printf " ${RED}✗${NC} ") ;;
|
||||
"SKIP") test_col=$(printf " ${YELLOW}-${NC} ") ;;
|
||||
*) test_col=" - " ;;
|
||||
esac
|
||||
|
||||
# Format publish status
|
||||
# Format publish status with colors
|
||||
case "$publish_status" in
|
||||
"✓") publish_col=" ${GREEN}✓${NC} " ;;
|
||||
"✗") publish_col=" ${RED}✗${NC} " ;;
|
||||
"SKIP") publish_col=" ${YELLOW}-${NC} " ;;
|
||||
"✓") publish_col=$(printf " ${GREEN}✓${NC} ") ;;
|
||||
"✗") publish_col=$(printf " ${RED}✗${NC} ") ;;
|
||||
"SKIP") publish_col=$(printf " ${YELLOW}-${NC} ") ;;
|
||||
*) publish_col=" - " ;;
|
||||
esac
|
||||
|
||||
|
@ -16,40 +16,49 @@ rm -f dehydrate_test
|
||||
|
||||
# Build the test program using Docker
|
||||
# The Docker container supports both amd64 and arm64 architectures
|
||||
docker run --rm \
|
||||
-v "$PROJECT_DIR":/workdir \
|
||||
-w /workdir/test \
|
||||
gitea.jde.nz/public/dropshell-build-base:latest \
|
||||
bash -c "
|
||||
# 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
|
||||
echo "Building dehydrate test executable..."
|
||||
|
||||
# Clean any existing binary and compile
|
||||
rm -f dehydrate_test
|
||||
if ! g++ -std=c++23 -static dehydrate_test.cpp -o dehydrate_test; then
|
||||
# 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 \
|
||||
sleep 60
|
||||
|
||||
# Copy source file into container
|
||||
docker cp dehydrate_test.cpp "$CONTAINER_NAME":/dehydrate_test.cpp
|
||||
|
||||
# Compile in container
|
||||
docker exec "$CONTAINER_NAME" bash -c "
|
||||
echo 'Compiling dehydrate test...'
|
||||
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
|
||||
if [ ! -f dehydrate_test ]; then
|
||||
# Verify binary was created
|
||||
if [ ! -f /dehydrate_test ]; then
|
||||
echo 'ERROR: Binary was not created'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Quick architecture check - just verify the binary format
|
||||
if ! file dehydrate_test | grep -q 'executable'; then
|
||||
# Quick architecture check
|
||||
if ! file /dehydrate_test | grep -q 'executable'; then
|
||||
echo 'ERROR: Generated file is not an executable'
|
||||
file dehydrate_test
|
||||
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
|
||||
if [ ! -f "./dehydrate_test" ]; then
|
||||
echo "Error: Failed to compile dehydrate_test - binary not found"
|
||||
|
Reference in New Issue
Block a user