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

This commit is contained in:
Your Name 2025-06-25 22:41:01 +12:00
parent 42b51ef0be
commit a5a36c179b

View File

@ -16,48 +16,49 @@ rm -f dehydrate_test
# Build the test program using Docker
# 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
echo "Building dehydrate test executable..."
docker run --rm \
-v "$SCRIPT_DIR":/workdir \
-w /workdir \
# 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 \
bash -c "
echo 'Docker working directory:' && pwd
echo 'Docker available files:' && ls -la
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 'Available files:' && ls -la
exit 1
fi
# Copy source file into container
docker cp dehydrate_test.cpp "$CONTAINER_NAME":/dehydrate_test.cpp
# Clean any existing binary and compile
rm -f dehydrate_test
if ! g++ -std=c++23 -static dehydrate_test.cpp -o dehydrate_test; then
# 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"