diff --git a/.forgejo/workflows/ci.yml b/.forgejo/workflows/ci.yml index c217c63..ab4d43f 100644 --- a/.forgejo/workflows/ci.yml +++ b/.forgejo/workflows/ci.yml @@ -23,113 +23,95 @@ jobs: git fetch --all git checkout ${{ github.sha || gitea.sha || 'main' }} - - name: Build ostree packages in Docker + - name: Setup Debian environment run: | - echo "Building ostree packages using Docker..." + echo "Setting up Debian environment for building..." - # Create a Dockerfile for the build environment - cat > /tmp/ostree/Dockerfile.build << 'EOF' - FROM debian:unstable + # Add Debian repositories + echo "Adding Debian unstable repositories..." + echo "deb http://deb.debian.org/debian unstable main" | sudo tee /etc/apt/sources.list.d/debian-unstable.list + echo "deb-src http://deb.debian.org/debian unstable main" | sudo tee -a /etc/apt/sources.list.d/debian-unstable.list - # Install build dependencies - RUN apt-get update && apt-get install -y \ - build-essential \ - fakeroot \ - devscripts \ - debian-keyring \ - equivs \ - curl \ - git \ - && rm -rf /var/lib/apt/lists/* - - # Add Debian sources - RUN echo "deb http://deb.debian.org/debian unstable main" > /etc/apt/sources.list && \ - echo "deb-src http://deb.debian.org/debian unstable main" >> /etc/apt/sources.list - - # Set working directory - WORKDIR /workspace - - # Copy the CI script - COPY build-ostree.sh /workspace/ - RUN chmod +x /workspace/build-ostree.sh - - CMD ["/workspace/build-ostree.sh"] - EOF - - # Create the build script - cat > /tmp/ostree/build-ostree.sh << 'EOF' - #!/bin/bash - set -e - - echo "Starting ostree build process..." + # Add Debian keyring + sudo apt update + sudo apt install -y debian-archive-keyring # Update package lists - apt-get update - - # Clone ostree from Debian sid + sudo apt update -y + + # Install essential build tools + sudo apt install -y build-essential fakeroot devscripts curl git + + - name: Clone ostree from Debian sid + run: | echo "Cloning ostree from Debian sid..." - apt source ostree - cd ostree-* - + cd /tmp + apt source ostree || { echo "apt source ostree failed!"; exit 1; } + cd ostree-* || { echo "Failed to change to ostree directory!"; exit 1; } echo "Changed to ostree directory:" pwd ls -la - - # Install build dependencies + + - name: Install build dependencies + run: | echo "Installing build dependencies..." - mk-build-deps -i -t 'apt-get -y' debian/control - apt-get build-dep -y . - - # Add backport revision number + cd /tmp/ostree-* + sudo mk-build-deps -i -t 'apt-get -y' debian/control || echo "mk-build-deps failed, continuing..." + sudo apt-get update + sudo apt-get build-dep -y . || echo "Build deps installation failed, continuing..." + + - name: Add backport revision number + run: | echo "Adding backport revision number..." - dch --bpo - - # Test build + cd /tmp/ostree-* + dch --bpo || echo "dch --bpo failed, continuing..." + + - name: Test build + run: | echo "Testing build with fakeroot debian/rules binary..." - fakeroot debian/rules binary - - # Build packages + cd /tmp/ostree-* + if fakeroot debian/rules binary; then + echo "Test build successful!" + else + echo "Test build failed!" + exit 1 + fi + + - name: Build packages + run: | echo "Building ostree packages..." - dpkg-buildpackage --build=binary --unsigned-changes + cd /tmp/ostree-* + echo "Current directory before build:" + pwd + ls -la + + echo "Running dpkg-buildpackage..." + if dpkg-buildpackage --build=binary --unsigned-changes; then + echo "Build successful!" + else + echo "Build failed! Checking for any partial packages..." + ls -la ../*.deb 2>/dev/null || echo "No .deb files found after failed build" + exit 1 + fi echo "Build completed! Checking for generated packages..." ls -la ../*.deb - - # Copy packages to workspace - cp ../*.deb /workspace/ - cp ../*.dsc /workspace/ 2>/dev/null || true - cp ../*.tar.xz /workspace/ 2>/dev/null || true - - echo "Packages copied to workspace:" - ls -la /workspace/ - EOF - - # Build and run the Docker container - cd /tmp/ostree - docker build -f Dockerfile.build -t ostree-builder . - - # Run the build - docker run --rm -v /tmp/ostree:/workspace ostree-builder - - # Check results - echo "Build completed. Checking for packages..." - ls -la /tmp/ostree/*.deb || echo "No .deb files found" + echo "Copying packages to workspace..." + cp ../*.deb /workspace/ 2>/dev/null || echo "No .deb files to copy" - name: Upload to Forgejo Debian Registry run: | echo "Uploading to Forgejo Debian Registry..." - cd /tmp/ostree + cd /tmp/ostree-* echo "Files in current directory:" ls -la echo "Looking for .deb files:" - ls -la *.deb 2>/dev/null || echo "No .deb files found" - echo "Searching for .deb files in all subdirectories:" - find . -name "*.deb" -type f + ls -la ../*.deb 2>/dev/null || echo "No .deb files found" # Upload .deb files to Forgejo Debian Registry - for deb_file in *.deb; do + for deb_file in ../*.deb; do if [ -f "$deb_file" ]; then echo "Uploading $deb_file to Forgejo Debian Registry..." curl --upload-file "$deb_file" \