apt-ostree/.forgejo/workflows/ci.yml
joe 434ccc1261 Fix critical heredoc issues with echo commands
- Replace all heredocs with echo commands to avoid YAML indentation problems
- Eliminate 'unexpected end of file' shell syntax errors
- Maintain proper YAML structure while ensuring shell compatibility
- Fix all workflow files: build.yml, test.yml, update-readme.yml, ci.yml
- All files now pass yq validation
2025-08-13 18:18:29 -07:00

221 lines
7.6 KiB
YAML

name: Simple CI
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main ]
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
# Simple build and test
build-and-test:
name: Build and Test
runs-on: ubuntu-latest
container:
image: debian:latest
steps:
- name: Checkout code
run: |
# Clone the repository manually
git clone https://git.raines.xyz/robojerk/apt-ostree.git /tmp/apt-ostree
cp -r /tmp/apt-ostree/* .
cp -r /tmp/apt-ostree/.* . 2>/dev/null || true
- name: Setup environment
run: |
# Update package lists
apt update -y
# Check if apt-cacher-ng is available
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..."
echo "deb http://192.168.1.101:3142/ftp.debian.org/debian stable main contrib non-free" > /etc/apt/sources.list.d/apt-cacher-ng.list
echo "deb-src http://192.168.1.101:3142/ftp.debian.org/debian stable main contrib non-free" >> /etc/apt/sources.list.d/apt-cacher-ng.list
echo "deb http://192.168.1.101:3142/HTTPS///get.docker.com/ubuntu docker main" >> /etc/apt/sources.list.d/apt-cacher-ng.list
apt update -y
else
echo "⚠️ apt-cacher-ng not available, using standard Debian sources..."
echo "deb http://deb.debian.org/debian stable main contrib non-free" > /etc/apt/sources.list.d/standard.list
echo "deb-src http://deb.debian.org/debian stable main contrib non-free" >> /etc/apt/sources.list.d/standard.list
apt update -y
fi
- name: Install dependencies
run: |
apt-get update
apt-get install -y \
build-essential \
pkg-config \
libssl-dev \
libdbus-1-dev \
libglib2.0-dev \
libapt-pkg-dev \
curl \
git \
wget
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
. ~/.cargo/env
rustup default stable
- name: Build project
run: |
. ~/.cargo/env
cargo build --release
- name: Run tests
run: |
. ~/.cargo/env
cargo test
- name: Create summary
run: |
echo "Build and test completed successfully!"
echo "✅ CI completed! 🎉"
# Security check
security:
name: Security Audit
runs-on: ubuntu-latest
container:
image: debian:latest
steps:
- name: Checkout code
run: |
git clone https://git.raines.xyz/robojerk/apt-ostree.git /tmp/apt-ostree
cp -r /tmp/apt-ostree/* .
cp -r /tmp/apt-ostree/.* . 2>/dev/null || true
- name: Setup environment
run: |
apt update -y
if curl -s --connect-timeout 5 http://192.168.1.101:3142/acng-report.html > /dev/null 2>&1; then
echo "deb http://192.168.1.101:3142/ftp.debian.org/debian stable main contrib non-free" > /etc/apt/sources.list.d/apt-cacher-ng.list
echo "deb-src http://192.168.1.101:3142/ftp.debian.org/debian stable main contrib non-free" >> /etc/apt/sources.list.d/apt-cacher-ng.list
apt update -y
else
echo "deb http://deb.debian.org/debian stable main contrib non-free" > /etc/apt/sources.list.d/standard.list
echo "deb-src http://deb.debian.org/debian stable main contrib non-free" >> /etc/apt/sources.list.d/standard.list
apt update -y
fi
- name: Install Rust and security tools
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
. ~/.cargo/env
apt-get update
apt-get install -y cargo-audit
- name: Run security audit
run: |
. ~/.cargo/env
cargo audit
- name: Create summary
run: |
echo "Security audit completed successfully!"
echo "✅ Security check completed! 🎉"
# Package build
package:
name: Build Package
runs-on: ubuntu-latest
container:
image: debian:latest
steps:
- name: Checkout code
run: |
git clone https://git.raines.xyz/robojerk/apt-ostree.git /tmp/apt-ostree
cp -r /tmp/apt-ostree/* .
cp -r /tmp/apt-ostree/.* . 2>/dev/null || true
- name: Setup environment
run: |
apt update -y
if curl -s --connect-timeout 5 http://192.168.1.101:3142/acng-report.html > /dev/null 2>&1; then
echo "deb http://192.168.1.101:3142/ftp.debian.org/debian stable main contrib non-free" > /etc/apt/sources.list.d/apt-cacher-ng.list
echo "deb-src http://192.168.1.101:3142/ftp.debian.org/debian stable main contrib non-free" >> /etc/apt/sources.list.d/apt-cacher-ng.list
apt update -y
else
echo "deb http://deb.debian.org/debian stable main contrib non-free" > /etc/apt/sources.list.d/standard.list
echo "deb-src http://deb.debian.org/debian stable main contrib non-free" >> /etc/apt/sources.list.d/standard.list
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
- name: Build package
run: |
if [ -f "./build-debian-trixie.sh" ]; then
chmod +x ./build-debian-trixie.sh
./build-debian-trixie.sh
else
echo "Build script not found, attempting manual build..."
dpkg-buildpackage -us -uc -b
fi
- name: Create summary
run: |
echo "Package build completed!"
ls -la ../*.deb 2>/dev/null || echo "No packages found"
echo "✅ Package build completed! 🎉"
# Final status
status:
name: Final Status
needs: [build-and-test, security, package]
runs-on: ubuntu-latest
if: always()
steps:
- name: Check results
run: |
echo "All jobs completed"
echo "Build and Test: Completed"
echo "Security: Completed"
echo "Package: Completed"
echo "# APT-OSTree CI Summary" > CI_SUMMARY.md
echo "" >> CI_SUMMARY.md
echo "## Build Information" >> CI_SUMMARY.md
echo "- **Build Date**: $(date '+%Y-%m-%d %H:%M:%S UTC')" >> CI_SUMMARY.md
echo "- **Build ID**: $(date +%s)" >> CI_SUMMARY.md
echo "- **Commit**: $(git rev-parse --short HEAD 2>/dev/null || echo "Unknown")" >> CI_SUMMARY.md
echo "- **Branch**: $(git branch --show-current 2>/dev/null || echo "Unknown")" >> CI_SUMMARY.md
echo "" >> CI_SUMMARY.md
echo "## Job Results" >> CI_SUMMARY.md
echo "- **Build and Test**: Completed" >> CI_SUMMARY.md
echo "- **Security**: Completed" >> CI_SUMMARY.md
echo "- **Package**: Completed" >> CI_SUMMARY.md
echo "" >> CI_SUMMARY.md
echo "## Summary" >> CI_SUMMARY.md
echo "CI completed. Check individual job results above." >> CI_SUMMARY.md
echo "CI summary created: CI_SUMMARY.md"
echo "✅ All CI jobs completed! 🎉"