Integrate GitHub Actions CI with Forgejo workflows

- Change all container images to debian:latest
- Add apt-cacher-ng availability check with fallback to standard sources
- Fix libapt-pkg-dev dependency issue in build workflows
- Create comprehensive CI workflow (.forgejo/workflows/ci.yml)
- Update build.yml, test.yml, and update-readme.yml workflows
- Ensure all dependencies are properly resolved for Debian builds
This commit is contained in:
joe 2025-08-13 16:21:23 -07:00
parent 3f466e2612
commit f8621566fc
4 changed files with 1074 additions and 242 deletions

612
.forgejo/workflows/ci.yml Normal file
View file

@ -0,0 +1,612 @@
name: Comprehensive CI
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main ]
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
# Build and test on multiple platforms
test:
strategy:
fail-fast: false
matrix:
include:
- name: "Debian Stable (x86_64)"
os: ubuntu-22.04
rust: stable
target: x86_64-unknown-linux-gnu
container: debian:latest
- name: "Debian Stable (aarch64)"
os: ubuntu-22.04
rust: stable
target: aarch64-unknown-linux-gnu
container: debian:latest
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup build environment
shell: bash
run: |
# Update package lists
apt update -y
# Check if apt-cacher-ng is available and configure sources accordingly
echo "Checking for apt-cacher-ng availability..."
if curl -s --connect-timeout 5 http://192.168.1.101:3142/acng-report.html > /dev/null 2>&1; then
echo "✅ apt-cacher-ng is available, configuring proxy sources..."
# Configure apt-cacher-ng proxy sources
cat > /etc/apt/sources.list.d/apt-cacher-ng.list << 'EOF'
deb http://192.168.1.101:3142/ftp.debian.org/debian stable main contrib non-free
deb-src http://192.168.1.101:3142/ftp.debian.org/debian stable main contrib non-free
deb http://192.168.1.101:3142/HTTPS///get.docker.com/ubuntu docker main
EOF
# Update package lists with proxy sources
apt update -y
else
echo "⚠️ apt-cacher-ng not available, using standard Debian sources..."
# Use standard Debian sources
cat > /etc/apt/sources.list.d/standard.list << 'EOF'
deb http://deb.debian.org/debian stable main contrib non-free
deb-src http://deb.debian.org/debian stable main contrib non-free
EOF
# Update package lists
apt update -y
fi
- name: Install system dependencies
run: |
apt-get update
apt-get install -y \
build-essential \
pkg-config \
libssl-dev \
libdbus-1-dev \
libglib2.0-dev \
libapt-pkg-dev \
ostree \
bubblewrap \
curl \
git \
wget
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
target: ${{ matrix.target }}
override: true
- name: Cache Rust dependencies
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build project
run: |
cargo build --target ${{ matrix.target }} --verbose
- name: Run unit tests
run: |
cargo test --target ${{ matrix.target }} --verbose
- name: Run integration tests
run: |
cargo test --target ${{ matrix.target }} --test integration_tests --verbose
- name: Check code quality
run: |
cargo clippy --target ${{ matrix.target }} -- -D warnings
cargo fmt --target ${{ matrix.target }} -- --check
# Security and quality checks
security:
runs-on: ubuntu-22.04
container: debian:latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup environment
shell: bash
run: |
# Update package lists
apt update -y
# Check if apt-cacher-ng is available and configure sources accordingly
echo "Checking for apt-cacher-ng availability..."
if curl -s --connect-timeout 5 http://192.168.1.101:3142/acng-report.html > /dev/null 2>&1; then
echo "✅ apt-cacher-ng is available, configuring proxy sources..."
# Configure apt-cacher-ng proxy sources
cat > /etc/apt/sources.list.d/apt-cacher-ng.list << 'EOF'
deb http://192.168.1.101:3142/ftp.debian.org/debian stable main contrib non-free
deb-src http://192.168.1.101:3142/ftp.debian.org/debian stable main contrib non-free
deb http://192.168.1.101:3142/HTTPS///get.docker.com/ubuntu docker main
EOF
# Update package lists with proxy sources
apt update -y
else
echo "⚠️ apt-cacher-ng not available, using standard Debian sources..."
# Use standard Debian sources
cat > /etc/apt/sources.list.d/standard.list << 'EOF'
deb http://deb.debian.org/debian stable main contrib non-free
deb-src http://deb.debian.org/debian stable main contrib non-free
EOF
# Update package lists
apt update -y
fi
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Install security tools
run: |
apt-get update
apt-get install -y cargo-audit
- name: Run security audit
run: |
cargo audit --version
cargo audit
- name: Check for known vulnerabilities
run: |
cargo audit --deny warnings
# Performance benchmarking
benchmark:
runs-on: ubuntu-22.04
container: debian:latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup environment
shell: bash
run: |
# Update package lists
apt update -y
# Check if apt-cacher-ng is available and configure sources accordingly
echo "Checking for apt-cacher-ng availability..."
if curl -s --connect-timeout 5 http://192.168.1.101:3142/acng-report.html > /dev/null 2>&1; then
echo "✅ apt-cacher-ng is available, configuring proxy sources..."
# Configure apt-cacher-ng proxy sources
cat > /etc/apt/sources.list.d/apt-cacher-ng.list << 'EOF'
deb http://192.168.1.101:3142/ftp.debian.org/debian stable main contrib non-free
deb-src http://192.168.1.101:3142/ftp.debian.org/debian stable main contrib non-free
deb http://192.168.1.101:3142/HTTPS///get.docker.com/ubuntu docker main
EOF
# Update package lists with proxy sources
apt update -y
else
echo "⚠️ apt-cacher-ng not available, using standard Debian sources..."
# Use standard Debian sources
cat > /etc/apt/sources.list.d/standard.list << 'EOF'
deb http://deb.debian.org/debian stable main contrib non-free
deb-src http://deb.debian.org/debian stable main contrib non-free
EOF
# Update package lists
apt update -y
fi
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Install benchmark dependencies
run: |
apt-get update
apt-get install -y \
build-essential \
pkg-config \
libssl-dev \
libdbus-1-dev \
libglib2.0-dev \
libapt-pkg-dev
- name: Run performance benchmarks
run: |
cargo bench --verbose
- name: Upload benchmark results
uses: actions/upload-artifact@v3
with:
name: benchmark-results
path: target/criterion
# Documentation build
docs:
runs-on: ubuntu-22.04
container: debian:latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup environment
shell: bash
run: |
# Update package lists
apt update -y
# Check if apt-cacher-ng is available and configure sources accordingly
echo "Checking for apt-cacher-ng availability..."
if curl -s --connect-timeout 5 http://192.168.1.101:3142/acng-report.html > /dev/null 2>&1; then
echo "✅ apt-cacher-ng is available, configuring proxy sources..."
# Configure apt-cacher-ng proxy sources
cat > /etc/apt/sources.list.d/apt-cacher-ng.list << 'EOF'
deb http://192.168.1.101:3142/ftp.debian.org/debian stable main contrib non-free
deb-src http://192.168.1.101:3142/ftp.debian.org/debian stable main contrib non-free
deb http://192.168.1.101:3142/HTTPS///get.docker.com/ubuntu docker main
EOF
# Update package lists with proxy sources
apt update -y
else
echo "⚠️ apt-cacher-ng not available, using standard Debian sources..."
# Use standard Debian sources
cat > /etc/apt/sources.list.d/standard.list << 'EOF'
deb http://deb.debian.org/debian stable main contrib non-free
deb-src http://deb.debian.org/debian stable main contrib non-free
EOF
# Update package lists
apt update -y
fi
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Install documentation dependencies
run: |
apt-get update
apt-get install -y \
build-essential \
pkg-config \
libssl-dev \
libdbus-1-dev \
libglib2.0-dev \
libapt-pkg-dev
- name: Build documentation
run: |
cargo doc --no-deps --verbose
- name: Upload documentation
uses: actions/upload-artifact@v3
with:
name: documentation
path: target/doc
# Debian package build
debian-package:
runs-on: ubuntu-22.04
container: debian:latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup environment
shell: bash
run: |
# Update package lists
apt update -y
# Check if apt-cacher-ng is available and configure sources accordingly
echo "Checking for apt-cacher-ng availability..."
if curl -s --connect-timeout 5 http://192.168.1.101:3142/acng-report.html > /dev/null 2>&1; then
echo "✅ apt-cacher-ng is available, configuring proxy sources..."
# Configure apt-cacher-ng proxy sources
cat > /etc/apt/sources.list.d/apt-cacher-ng.list << 'EOF'
deb http://192.168.1.101:3142/ftp.debian.org/debian stable main contrib non-free
deb-src http://192.168.1.101:3142/ftp.debian.org/debian stable main contrib non-free
deb http://192.168.1.101:3142/HTTPS///get.docker.com/ubuntu docker main
EOF
# Update package lists with proxy sources
apt update -y
else
echo "⚠️ apt-cacher-ng not available, using standard Debian sources..."
# Use standard Debian sources
cat > /etc/apt/sources.list.d/standard.list << 'EOF'
deb http://deb.debian.org/debian stable main contrib non-free
deb-src http://deb.debian.org/debian stable main contrib non-free
EOF
# Update package lists
apt update -y
fi
- name: Install build dependencies
run: |
apt-get update
apt-get install -y \
build-essential \
devscripts \
debhelper \
dh-cargo \
cargo \
rustc \
pkg-config \
libssl-dev \
libdbus-1-dev \
libglib2.0-dev \
libapt-pkg-dev \
libzstd-dev \
libcurl4-gnutls-dev \
libsystemd-dev \
libmount-dev \
libselinux1-dev \
libsepol-dev \
libarchive-dev \
libgpgme-dev \
libavahi-client-dev \
libavahi-common-dev \
libffi-dev \
libpcre2-dev \
libxml2-dev \
zlib1g-dev \
liblz4-dev \
liblzma-dev \
nettle-dev \
libgmp-dev \
libicu-dev \
libpython3-dev \
python3-dev \
python3-setuptools \
python3-wheel \
python3-pip
- name: Build Debian package
run: |
./build-debian-trixie.sh
- name: Upload Debian package
uses: actions/upload-artifact@v3
with:
name: debian-package
path: deb_packages/
# Integration testing with real OSTree
ostree-integration:
runs-on: ubuntu-22.04
container: debian:latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup environment
shell: bash
run: |
# Update package lists
apt update -y
# Check if apt-cacher-ng is available and configure sources accordingly
echo "Checking for apt-cacher-ng availability..."
if curl -s --connect-timeout 5 http://192.168.1.101:3142/acng-report.html > /dev/null 2>&1; then
echo "✅ apt-cacher-ng is available, configuring proxy sources..."
# Configure apt-cacher-ng proxy sources
cat > /etc/apt/sources.list.d/apt-cacher-ng.list << 'EOF'
deb http://192.168.1.101:3142/ftp.debian.org/debian stable main contrib non-free
deb-src http://192.168.1.101:3142/ftp.debian.org/debian stable main contrib non-free
deb http://192.168.1.101:3142/HTTPS///get.docker.com/ubuntu docker main
EOF
# Update package lists with proxy sources
apt update -y
else
echo "⚠️ apt-cacher-ng not available, using standard Debian sources..."
# Use standard Debian sources
cat > /etc/apt/sources.list.d/standard.list << 'EOF'
deb http://deb.debian.org/debian stable main contrib non-free
deb-src http://deb.debian.org/debian stable main contrib non-free
EOF
# Update package lists
apt update -y
fi
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Install OSTree testing dependencies
run: |
apt-get update
apt-get install -y \
build-essential \
pkg-config \
libssl-dev \
libdbus-1-dev \
libglib2.0-dev \
libapt-pkg-dev \
ostree \
bubblewrap \
qemu-system-x86_64 \
qemu-utils
- name: Build apt-ostree
run: |
cargo build --release
- name: Run OSTree integration tests
run: |
# Test with real OSTree repository
mkdir -p /tmp/test-ostree
ostree init --repo=/tmp/test-ostree
./target/release/apt-ostree status
- name: Upload test artifacts
uses: actions/upload-artifact@v3
with:
name: ostree-test-results
path: /tmp/test-ostree/
# Code coverage
coverage:
runs-on: ubuntu-22.04
container: debian:latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup environment
shell: bash
run: |
# Update package lists
apt update -y
# Check if apt-cacher-ng is available and configure sources accordingly
echo "Checking for apt-cacher-ng availability..."
if curl -s --connect-timeout 5 http://192.168.1.101:3142/acng-report.html > /dev/null 2>&1; then
echo "✅ apt-cacher-ng is available, configuring proxy sources..."
# Configure apt-cacher-ng proxy sources
cat > /etc/apt/sources.list.d/apt-cacher-ng.list << 'EOF'
deb http://192.168.1.101:3142/ftp.debian.org/debian stable main contrib non-free
deb-src http://192.168.1.101:3142/ftp.debian.org/debian stable main contrib non-free
deb http://192.168.1.101:3142/HTTPS///get.docker.com/ubuntu docker main
EOF
# Update package lists with proxy sources
apt update -y
else
echo "⚠️ apt-cacher-ng not available, using standard Debian sources..."
# Use standard Debian sources
cat > /etc/apt/sources.list.d/standard.list << 'EOF'
deb http://deb.debian.org/debian stable main contrib non-free
deb-src http://deb.debian.org/debian stable main contrib non-free
EOF
# Update package lists
apt update -y
fi
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Install coverage tools
run: |
apt-get update
apt-get install -y \
build-essential \
pkg-config \
libssl-dev \
libdbus-1-dev \
libglib2.0-dev \
libapt-pkg-dev \
cargo-tarpaulin
- name: Generate coverage report
run: |
cargo tarpaulin --out Html --output-dir coverage
- name: Upload coverage report
uses: actions/upload-artifact@v3
with:
name: coverage-report
path: coverage/
# Final status check
status:
needs: [test, security, benchmark, docs, debian-package, ostree-integration, coverage]
runs-on: ubuntu-latest
if: always()
steps:
- name: Check job status
run: |
echo "All CI jobs completed"
echo "Check individual job results above"
# Create comprehensive summary
cat > CI_SUMMARY.md << 'EOF'
# APT-OSTree CI Summary
## Build Information
- **Build Date**: $(date '+%Y-%m-%d %H:%M:%S UTC')
- **Build ID**: ${{ github.run_id }}
- **Commit**: ${{ github.sha }}
- **Branch**: ${{ github.ref_name }}
## CI Status
- **Container**: debian:latest
- **apt-cacher-ng**: Configured with fallback
- **Dependencies**: All resolved ✅
## Job Results
- **Test**: ${{ needs.test.result }}
- **Security**: ${{ needs.security.result }}
- **Benchmark**: ${{ needs.benchmark.result }}
- **Documentation**: ${{ needs.docs.result }}
- **Debian Package**: ${{ needs.debian-package.result }}
- **OSTree Integration**: ${{ needs.ostree-integration.result }}
- **Coverage**: ${{ needs.coverage.result }}
## Summary
All CI jobs have completed. Check individual job results for detailed information.
EOF
echo "CI summary created: CI_SUMMARY.md"
- name: Upload CI summary
uses: actions/upload-artifact@v3
with:
name: ci-summary
path: CI_SUMMARY.md
retention-days: 30