Fix artifact creation: handle explicit target paths, improve binary detection, add diagnostics
Some checks failed
Build deb-bootupd Artifacts / build (push) Failing after 3m56s
Simple Build and Upload / build (push) Failing after 1m59s

This commit is contained in:
robojerk 2025-08-10 09:19:37 -07:00
parent 2f7b484bb1
commit c81e9b8223
2 changed files with 74 additions and 38 deletions

View file

@ -203,41 +203,47 @@ jobs:
run: |
cd /tmp/deb-bootupd
echo "=== BUILD ARTIFACTS ==="
echo "Current directory: $(pwd)"
echo "Target directory contents:"
ls -la target/
echo "Release target directory contents:"
ls -la target/x86_64-unknown-linux-gnu/release/ || echo "Release target not found"
# Check where the binary actually is
BINARY_PATH=""
if [ -f "target/x86_64-unknown-linux-gnu/release/bootupd" ]; then
BINARY_PATH="target/x86_64-unknown-linux-gnu/release/bootupd"
elif [ -f "target/release/bootupd" ]; then
BINARY_PATH="target/release/bootupd"
else
echo "❌ Binary not found in expected locations"
find target/ -name "bootupd" -type f 2>/dev/null || echo "No bootupd binary found anywhere"
exit 1
fi
echo "✅ Found binary at: $BINARY_PATH"
# Create artifacts directory
mkdir -p build-artifacts
mkdir -p artifacts
# Copy compiled binaries
cp target/release/bootupd build-artifacts/
cp target/release/bootupctl build-artifacts/ 2>/dev/null || echo "bootupctl not found (may be symlink)"
# Copy binary with proper permissions
cp "$BINARY_PATH" artifacts/bootupd
chmod +x artifacts/bootupd
# Copy source code for reference
cp -r src/ build-artifacts/
cp Cargo.toml Cargo.lock build-artifacts/
# Get binary info
echo "Binary details:"
file artifacts/bootupd
ls -la artifacts/bootupd
# Copy Debian packaging files
cp -r debian/ build-artifacts/ 2>/dev/null || echo "debian/ directory not found"
cp -r systemd/ build-artifacts/ 2>/dev/null || echo "systemd/ directory not found"
# Create zip archive
cd artifacts
zip -r ../deb-bootupd-artifacts.zip .
cd ..
# Create build info file
cat > build-artifacts/BUILD_INFO.txt << EOF
deb-bootupd Build Information
=============================
Build Date: $(date)
Container Image: rust:1.89
Debian Version: ${DEBIAN_VERSION}
Rust Version: $(rustc --version)
Cargo Version: $(cargo --version)
Git Commit: $(git rev-parse --short HEAD)
Git Branch: $(git branch --show-current)
Build Type: Release
EOF
# Show artifacts
echo "Build artifacts created:"
ls -la build-artifacts/
echo ""
echo "Build info:"
cat build-artifacts/BUILD_INFO.txt
echo "✅ Artifacts created successfully"
ls -la artifacts/
ls -la *.zip
- name: Upload artifacts to Forgejo
env:

View file

@ -196,21 +196,51 @@ jobs:
echo "Checking formatting..."
cargo fmt --check
- name: Create artifacts
- name: Create build artifacts
run: |
cd /tmp/deb-bootupd
echo "=== BUILD ARTIFACTS ==="
echo "Current directory: $(pwd)"
echo "Target directory contents:"
ls -la target/
echo "Release target directory contents:"
ls -la target/x86_64-unknown-linux-gnu/release/ || echo "Release target not found"
# Check where the binary actually is
BINARY_PATH=""
if [ -f "target/x86_64-unknown-linux-gnu/release/bootupd" ]; then
BINARY_PATH="target/x86_64-unknown-linux-gnu/release/bootupd"
elif [ -f "target/release/bootupd" ]; then
BINARY_PATH="target/release/bootupd"
else
echo "❌ Binary not found in expected locations"
find target/ -name "bootupd" -type f 2>/dev/null || echo "No bootupd binary found anywhere"
exit 1
fi
echo "✅ Found binary at: $BINARY_PATH"
# Create artifacts directory
mkdir -p artifacts
cp target/release/bootupd artifacts/
cp -r src/ artifacts/
cp Cargo.toml artifacts/
# Create build info
echo "Build: $(date) - $(git rev-parse --short HEAD)" > artifacts/build-info.txt
echo "Rust Version: $(rustc --version)" >> artifacts/build-info.txt
# Copy binary with proper permissions
cp "$BINARY_PATH" artifacts/bootupd
chmod +x artifacts/bootupd
echo "Artifacts created:"
# Get binary info
echo "Binary details:"
file artifacts/bootupd
ls -la artifacts/bootupd
# Create zip archive
cd artifacts
zip -r ../deb-bootupd-artifacts.zip .
cd ..
echo "✅ Artifacts created successfully"
ls -la artifacts/
ls -la *.zip
- name: Upload artifacts
uses: https://data.forgejo.org/actions/upload-artifact@v3