diff --git a/.forgejo/workflows/simple-build.yml b/.forgejo/workflows/simple-build.yml deleted file mode 100644 index b9f323a..0000000 --- a/.forgejo/workflows/simple-build.yml +++ /dev/null @@ -1,261 +0,0 @@ -name: Simple Build and Upload - -# Simple workflow for building deb-bootupd and uploading artifacts -# Based on patterns from: https://domaindrivenarchitecture.org/pages/dda-pallet/ - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - workflow_dispatch: - -jobs: - build: - runs-on: ubuntu-latest - env: - DEBIAN_VERSION: "13 (Trixie)" - BOOTUPD_VERSION: "0.2.28" - FORK_VERSION: "1" - TARGET_PLATFORM: "debian-trixie" - RUST_BACKTRACE: 1 - FORGEJO_URL: ${{ secrets.FORGEJO_URL || 'https://git.raines.xyz' }} - FORGEJO_HOST: ${{ secrets.FORGEJO_HOST || 'git.raines.xyz' }} - # Use actual IP if available, fallback to hostname - FORGEJO_IP: ${{ secrets.FORGEJO_IP || '' }} - container: - image: 'rust:1.89-slim-trixie' - options: | - --dns=8.8.8.8 - --dns=8.8.4.4 - --add-host=git.raines.xyz:host-gateway - --add-host=forgejo:host-gateway - --memory=4g - --memory-swap=4g - steps: - - name: Checkout code and setup environment - run: | - apt update -y - apt install -y git curl pkg-config libssl-dev libsystemd-dev build-essential file zip nodejs npm iproute2 dnsutils iputils-ping - - # Install required Rust components - rustup component add clippy rustfmt rust-src rust-analysis - - echo "=== NETWORK DIAGNOSTICS ===" - echo "Container hostname: $(hostname)" - echo "Container IP: $(ip route get 8.8.8.8 | awk '{print $7; exit}')" - echo "Container DNS:" - cat /etc/resolv.conf - echo "Container routing:" - ip route - - # Test hostname resolution - echo "=== HOSTNAME RESOLUTION TESTS ===" - echo "Testing forgejo hostname:" - nslookup forgejo 8.8.8.8 || echo "❌ forgejo hostname not resolved" - echo "Testing git.raines.xyz hostname:" - nslookup git.raines.xyz 8.8.8.8 || echo "❌ git.raines.xyz hostname not resolved" - echo "Testing explicit FORGEJO_HOST ($FORGEJO_HOST):" - nslookup $FORGEJO_HOST 8.8.8.8 || echo "❌ FORGEJO_HOST not resolved" - echo "Testing external DNS (google.com):" - nslookup google.com 8.8.8.8 || echo "❌ External DNS not working" - - # Test IP connectivity - echo "=== IP CONNECTIVITY TESTS ===" - echo "Testing Google DNS (8.8.8.8):" - ping -c 3 8.8.8.8 || echo "❌ Google DNS ping failed" - echo "Testing Cloudflare DNS (1.1.1.1):" - ping -c 3 1.1.1.1 || echo "❌ Cloudflare DNS ping failed" - - # Try to resolve the Forgejo server IP - echo "=== RESOLVING FORGEJO SERVER IP ===" - FORGEJO_IP=$(nslookup $FORGEJO_HOST 8.8.8.8 2>/dev/null | grep -A1 "Name:" | tail -1 | awk '{print $2}') - if [ -n "$FORGEJO_IP" ] && [ "$FORGEJO_IP" != "NXDOMAIN" ]; then - echo "✅ Resolved $FORGEJO_HOST to IP: $FORGEJO_IP" - echo "FORGEJO_IP=$FORGEJO_IP" >> $GITHUB_ENV - else - echo "❌ Could not resolve $FORGEJO_HOST to IP" - fi - - # Test direct IP connectivity if available - if [ -n "$FORGEJO_IP" ]; then - echo "Testing direct IP connectivity to $FORGEJO_IP:" - ping -c 3 $FORGEJO_IP || echo "❌ Direct IP ping failed" - fi - - echo "=== RUST ENVIRONMENT ===" - echo "Available Rust components:" - rustup component list --installed - echo "✅ Using pre-installed Rust from official image:" - rustc --version - cargo --version - - # Verify Rust toolchain health - echo "=== RUST TOOLCHAIN VERIFICATION ===" - echo "Testing rustc compilation..." - echo 'fn main() { println!("Hello, Rust!"); }' > /tmp/test.rs - rustc /tmp/test.rs -o /tmp/test || { - echo "❌ Rust compiler test failed - toolchain may be corrupted" - exit 1 - } - /tmp/test || { - echo "❌ Rust binary execution test failed" - exit 1 - } - echo "✅ Rust toolchain verification passed" - - # Test cargo operations - echo "Testing cargo operations..." - cargo new /tmp/test-project --bin || { - echo "❌ Cargo project creation failed" - exit 1 - } - cd /tmp/test-project - cargo check || { - echo "❌ Cargo check failed" - exit 1 - } - echo "✅ Cargo operations test passed" - cd /tmp/deb-bootupd - - # Clone repository - git clone https://git.raines.xyz/robojerk/deb-bootupd.git /tmp/deb-bootupd - cd /tmp/deb-bootupd - - echo "Repository: ${GITHUB_REPOSITORY:-$(git remote get-url origin 2>/dev/null || echo "unknown")}" - echo "Branch: ${GITHUB_REF_NAME:-$(git branch --show-current 2>/dev/null || echo "unknown")}" - echo "Commit: ${GITHUB_SHA:-$(git rev-parse --short HEAD 2>/dev/null || echo "unknown")}" - - # Verify Rust version meets requirements (need 1.84.1+) - RUST_VERSION=$(rustc --version | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+' | head -1) - echo "Rust version: $RUST_VERSION" - - if [ "$(printf '%s\n' "1.84.1" "$RUST_VERSION" | sort -V | head -n1)" != "1.84.1" ]; then - echo "❌ Rust version $RUST_VERSION is too old, need 1.84.1+" - exit 1 - else - echo "✅ Rust version $RUST_VERSION meets requirement (1.84.1+)" - fi - - # Rust environment is already set up in the container - echo "Rust environment ready:" - echo "RUSTUP_HOME: $RUSTUP_HOME" - echo "CARGO_HOME: $CARGO_HOME" - echo "PATH includes: $PATH" - - - name: Build Rust project - run: | - cd /tmp/deb-bootupd - - # Set Rust compilation safeguards - export RUSTFLAGS="-C target-cpu=native" - export CARGO_INCREMENTAL=0 - export CARGO_NET_RETRY=3 - - # Set memory limits for compilation - ulimit -v 3145728 # 3GB virtual memory limit - - echo "Building deb-bootupd in release mode..." - echo "Rust flags: $RUSTFLAGS" - echo "Memory limit: $(ulimit -v) KB" - echo "Current target: $(rustc --print target-list | grep x86_64-unknown-linux-gnu)" - - # Ensure we have the correct target - rustup target add x86_64-unknown-linux-gnu - - # Try building with release mode first - RUST_BACKTRACE=1 cargo build --release --target x86_64-unknown-linux-gnu --verbose || { - echo "❌ Release build failed, trying with debug mode..." - RUST_BACKTRACE=1 cargo build --target x86_64-unknown-linux-gnu --verbose || { - echo "❌ Debug build also failed, checking Rust installation..." - rustc --version --verbose - cargo --version --verbose - echo "Available targets:" - rustup target list --installed - exit 1 - } - } - - echo "Build artifacts:" - ls -la target/release/ || ls -la target/debug/ - - # Show binary info - if [ -f target/release/bootupd ]; then - echo "bootupd binary info:" - file target/release/bootupd - elif [ -f target/debug/bootupd ]; then - echo "bootupd binary info (debug):" - file target/debug/bootupd - fi - - - name: Run tests - run: | - cd /tmp/deb-bootupd - - echo "Running tests..." - cargo test --release - - echo "Running clippy..." - cargo clippy --release - - echo "Checking formatting..." - cargo fmt --check - - - 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 - - # Copy binary with proper permissions - cp "$BINARY_PATH" artifacts/bootupd - chmod +x artifacts/bootupd - - # 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 .. - - # Create versioned artifact name - VERSIONED_ARTIFACT="bootupd-${BOOTUPD_VERSION}-${FORK_VERSION}-${TARGET_PLATFORM}-$(git rev-parse --short HEAD).zip" - mv "deb-bootupd-artifacts.zip" "$VERSIONED_ARTIFACT" - - echo "✅ Artifacts created successfully" - echo "📦 Versioned artifact: $VERSIONED_ARTIFACT" - ls -la artifacts/ - ls -la *.zip - - - name: Upload artifacts - uses: https://data.forgejo.org/actions/upload-artifact@v3 - with: - name: deb-bootupd-build - path: /tmp/deb-bootupd/artifacts/ - if-no-files-found: error - retention-days: 30