- Add comprehensive build-artifacts.yml workflow with Forgejo Package Registry upload - Add simple-build.yml workflow for basic artifact management - Update README.md with workflow documentation and setup instructions - Fix debian/rules to correctly create bootupctl symlink to /usr/libexec/bootupd - Improve error handling and validation throughout the codebase - Remove unused functions and imports - Update documentation to clarify bootupd is not a daemon - Fix binary layout to match RPM packaging pattern
238 lines
8 KiB
YAML
238 lines
8 KiB
YAML
name: Build deb-bootupd Artifacts
|
|
|
|
# ⚠️ IMPORTANT: Each repository needs its own ACCESS_TOKEN secret!
|
|
#
|
|
# To set up this workflow in a new repository:
|
|
# 1. Go to repository settings: https://git.raines.xyz/OWNER/REPO/settings
|
|
# 2. Find "Secrets" or "Repository secrets" section
|
|
# 3. Add new secret:
|
|
# - Name: ACCESS_TOKEN
|
|
# - Value: Your Personal Access Token with repo and write:packages permissions
|
|
# 4. The token needs these scopes:
|
|
# - repo (Full control of private repositories)
|
|
# - write:packages (Write packages)
|
|
# - read:packages (Read packages)
|
|
#
|
|
# This workflow will fail with "ACCESS_TOKEN is not set" if the secret is missing.
|
|
|
|
on:
|
|
push:
|
|
branches: [ main, master ]
|
|
pull_request:
|
|
branches: [ main, master ]
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
UBUNTU_VERSION: "24.04"
|
|
RUST_VERSION: "1.75.0"
|
|
|
|
jobs:
|
|
build-artifacts:
|
|
name: Build deb-bootupd Artifacts
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: ubuntu:latest
|
|
steps:
|
|
- name: Setup build environment
|
|
shell: bash
|
|
run: |
|
|
apt update -y
|
|
apt install -y git curl pkg-config build-essential gnupg
|
|
|
|
# Install system Rust packages first for dpkg-buildpackage compatibility
|
|
apt install -y rustc cargo
|
|
|
|
# Install Rust using rustup to get the latest version
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
|
. ~/.cargo/env
|
|
|
|
# Set default toolchain for rustup
|
|
rustup default stable
|
|
|
|
# Verify Rust version
|
|
rustc --version
|
|
cargo --version
|
|
|
|
# Install additional build dependencies
|
|
apt install -y libssl-dev libsystemd-dev
|
|
|
|
- name: Checkout repository manually
|
|
run: |
|
|
# Clone the repository manually instead of using actions/checkout
|
|
git clone https://git.raines.xyz/robojerk/deb-bootupd.git /tmp/deb-bootupd
|
|
cd /tmp/deb-bootupd
|
|
|
|
# Show repository info
|
|
echo "Repository: $(git remote get-url origin)"
|
|
echo "Branch: $(git branch --show-current)"
|
|
echo "Commit: $(git rev-parse --short HEAD)"
|
|
echo "Date: $(git log -1 --format=%cd)"
|
|
|
|
- name: Build Rust project
|
|
run: |
|
|
cd /tmp/deb-bootupd
|
|
|
|
# Show project structure
|
|
echo "Project structure:"
|
|
ls -la
|
|
|
|
# Check Cargo.toml
|
|
echo "Cargo.toml contents:"
|
|
cat Cargo.toml
|
|
|
|
# Build in release mode
|
|
echo "Building deb-bootupd in release mode..."
|
|
cargo build --release
|
|
|
|
# Verify binaries were created
|
|
echo "Build artifacts:"
|
|
ls -la target/release/
|
|
|
|
# Show binary information
|
|
if [ -f target/release/bootupd ]; then
|
|
echo "bootupd binary info:"
|
|
file target/release/bootupd
|
|
ldd target/release/bootupd || echo "Static binary or no dynamic dependencies"
|
|
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
|
|
|
|
# Create artifacts directory
|
|
mkdir -p build-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 source code for reference
|
|
cp -r src/ build-artifacts/
|
|
cp Cargo.toml Cargo.lock build-artifacts/
|
|
|
|
# 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 build info file
|
|
cat > build-artifacts/BUILD_INFO.txt << EOF
|
|
deb-bootupd Build Information
|
|
=============================
|
|
Build Date: $(date)
|
|
Ubuntu Version: ${UBUNTU_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
|
|
|
|
- name: Upload artifacts to Forgejo
|
|
env:
|
|
USER: robojerk
|
|
TOKEN: ${{ secrets.ACCESS_TOKEN }}
|
|
BASE_URL: "git.raines.xyz"
|
|
run: |
|
|
cd /tmp/deb-bootupd
|
|
|
|
# Create zip archive of artifacts
|
|
artifact_name="deb-bootupd-artifacts-$(git rev-parse --short HEAD).zip"
|
|
zip -r "$artifact_name" build-artifacts/
|
|
|
|
echo "Created artifact archive: $artifact_name"
|
|
ls -la "$artifact_name"
|
|
|
|
# Upload to Forgejo generic package registry
|
|
echo "Uploading artifacts to Forgejo Package Registry..."
|
|
|
|
# Use the same upload pattern as bootc-deb
|
|
path="api/packages/robojerk/generic/deb-bootupd/$(git rev-parse --short HEAD)"
|
|
upload_url="https://${BASE_URL}/${path}/${artifact_name}"
|
|
|
|
echo "Upload URL: $upload_url"
|
|
|
|
# Upload with proper authentication
|
|
http_code=$(curl -s -o /dev/null -w "%{http_code}" \
|
|
--user "${USER}:${TOKEN}" \
|
|
--upload-file "$artifact_name" \
|
|
"$upload_url")
|
|
|
|
echo "HTTP Response Code: $http_code"
|
|
|
|
if [ "$http_code" = "201" ]; then
|
|
echo "✅ Artifacts uploaded successfully to Forgejo Package Registry"
|
|
elif [ "$http_code" = "409" ]; then
|
|
echo "➡️ INFO: Artifacts already exist (HTTP 409 Conflict)"
|
|
else
|
|
echo "❌ Upload failed with HTTP $http_code"
|
|
# Show verbose output for debugging
|
|
curl -v -i --user "${USER}:${TOKEN}" \
|
|
--upload-file "$artifact_name" \
|
|
"$upload_url" 2>&1
|
|
exit 1
|
|
fi
|
|
|
|
- name: Create release assets
|
|
run: |
|
|
cd /tmp/deb-bootupd
|
|
|
|
mkdir -p release-assets
|
|
cp "$artifact_name" release-assets/ 2>/dev/null || echo "No artifact archive found"
|
|
|
|
# Create a summary file
|
|
cat > release-assets/BUILD_SUMMARY.txt << EOF
|
|
deb-bootupd Build Summary
|
|
=========================
|
|
Build Date: $(date)
|
|
Ubuntu Version: ${UBUNTU_VERSION}
|
|
Rust Version: $(rustc --version)
|
|
Git Commit: $(git rev-parse --short HEAD)
|
|
Git Branch: $(git branch --show-current)
|
|
|
|
Built Artifacts:
|
|
- Rust binaries (release mode)
|
|
- Source code
|
|
- Debian packaging files
|
|
- Systemd service files
|
|
|
|
Artifact Archive: $artifact_name
|
|
EOF
|
|
|
|
echo "Release assets created:"
|
|
ls -la release-assets/
|
|
|
|
- name: Success Summary
|
|
run: |
|
|
echo "=== Build Summary ==="
|
|
echo "✅ deb-bootupd compiled successfully in release mode"
|
|
echo "✅ All tests passed"
|
|
echo "✅ Code formatting and linting passed"
|
|
echo "✅ Build artifacts created and uploaded to Forgejo"
|
|
echo ""
|
|
echo "📦 Artifacts available at:"
|
|
echo " https://git.raines.xyz/robojerk/deb-bootupd/packages"
|
|
echo ""
|
|
echo "🎯 Next steps:"
|
|
echo " - Verify artifacts appear in repository packages page"
|
|
echo " - Test binaries on Ubuntu Noble systems"
|
|
echo " - Consider building .deb packages for distribution"
|