Compare commits

...
3 Commits
Author SHA1 Message Date
Tobias Gesellchen 3cc45ebd20 debug: add comprehensive directory listings to diagnose build conflicts
Add ls -la output for:
- Working directory before/after build
- Go build cache location and contents
- Go module cache contents
- Post-build state verification

Simple directory listings often reveal file permission issues,
cached artifacts, or leftover files that cause 'File exists' errors
better than complex debugging output.
2026-01-10 01:08:13 +01:00
Tobias Gesellchen a30251854c fix: add debugging and improve build robustness for file conflicts
- Clean build environment before building (remove existing files, clean cache)
- Add atomic checksum generation using temp directory
- Improve error handling with explicit build failure detection
- Add debugging output to diagnose 'File exists' errors
- Use basename in temp operations to avoid path issues

This should resolve the 'Cannot open: File exists' errors occurring
during the darwin/arm64 build process.
2026-01-10 01:07:41 +01:00
Tobias Gesellchen 1a1d37b885 fix: resolve directory overwrite error in checksums generation
Use find -mindepth 2 to only move files from subdirectories, avoiding
the 'mv: cannot overwrite directory' error when flattening the artifact
directory structure. This ensures only the actual binary and checksum
files are moved, not the directories themselves.

Fixes the sha256sum failure in the Generate Checksums workflow step.
2026-01-10 01:04:49 +01:00
+49 -9
View File
@@ -132,11 +132,38 @@ jobs:
echo "Building: $OUTPUT_NAME"
# Debug: Show current state
echo "Working directory: $(pwd)"
echo "Go version: $(go version)"
echo "Files before build:"
ls -la
# Debug: Show Go cache and module cache
echo "Go build cache location: $(go env GOCACHE)"
echo "Go module cache location: $(go env GOMODCACHE)"
echo "Go build cache contents:"
ls -la "$(go env GOCACHE)" 2>/dev/null || echo "Cache directory not accessible"
echo "Go module cache contents (top level):"
ls -la "$(go env GOMODCACHE)" 2>/dev/null || echo "Module cache directory not accessible"
# Ensure clean build environment
rm -f "$OUTPUT_NAME" "$OUTPUT_NAME.sha256" "$OUTPUT_NAME.sha512"
go clean -cache
# Build with optimizations and version info
go build \
if ! go build \
-ldflags="-s -w -X main.version=v${{ needs.validate.outputs.version }} -X main.commit=${{ github.sha }} -X main.date=$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
-o "$OUTPUT_NAME" \
./cmd/soundtouch-cli
./cmd/soundtouch-cli; then
echo "❌ Build failed"
echo "Files after failed build:"
ls -la
exit 1
fi
# Debug: Show post-build state
echo "Files after successful build:"
ls -la
# Verify binary was created and is executable
ls -la "$OUTPUT_NAME"
@@ -148,12 +175,25 @@ jobs:
- name: Generate individual checksum
run: |
OUTPUT_NAME="${{ steps.build.outputs.binary_name }}"
sha256sum "$OUTPUT_NAME" > "$OUTPUT_NAME.sha256"
sha512sum "$OUTPUT_NAME" > "$OUTPUT_NAME.sha512"
echo "📋 Generated individual checksums:"
cat "$OUTPUT_NAME.sha256"
cat "$OUTPUT_NAME.sha512"
# Use atomic operations to avoid conflicts
TEMP_DIR=$(mktemp -d)
echo "Building checksums for: $OUTPUT_NAME"
echo "Matrix: ${{ matrix.goos }}-${{ matrix.goarch }}"
# Generate checksums in temp directory first
sha256sum "$OUTPUT_NAME" > "${TEMP_DIR}/$(basename "$OUTPUT_NAME").sha256"
sha512sum "$OUTPUT_NAME" > "${TEMP_DIR}/$(basename "$OUTPUT_NAME").sha512"
# Move to final location atomically
mv "${TEMP_DIR}/$(basename "$OUTPUT_NAME").sha256" "$OUTPUT_NAME.sha256"
mv "${TEMP_DIR}/$(basename "$OUTPUT_NAME").sha512" "$OUTPUT_NAME.sha512"
# Cleanup
rm -rf "$TEMP_DIR"
echo "✅ Checksums generated successfully"
- name: Upload build artifact
uses: actions/upload-artifact@v6
@@ -185,8 +225,8 @@ jobs:
find . -type f -name "soundtouch-cli-*"
# Flatten directory structure (artifacts are in subdirs)
# Move all binary files to current directory
find . -type f -name "soundtouch-cli-*" -exec mv {} . \;
# Move all binary and checksum files to current directory
find . -mindepth 2 -type f -name "soundtouch-cli-*" -exec mv {} . \;
# Remove empty directories
find . -type d -empty -delete