Fix CI workflow: use Docker instead of container directive
Some checks failed
Build libfuse / Build and Test (push) Failing after 1s

- Remove container directive and services that caused premature termination
- Use Docker run command to execute build in Debian Trixie container
- Consolidate all build steps into a single script for better reliability
- Maintain apt-cacher-ng support with proper host networking
- Simplify workflow structure to avoid Forgejo/Gitea Actions limitations
- Add proper cleanup of Docker containers

This should resolve the premature termination issue seen in run #2.
This commit is contained in:
robojerk 2025-09-07 15:42:29 -07:00
parent 3568c2f06d
commit 6b419d2d00

View file

@ -12,47 +12,38 @@ jobs:
build-and-test:
name: Build and Test
runs-on: ubuntu-latest
container:
image: debian:trixie
services:
apt-cacher-ng:
image: sameersbn/apt-cacher-ng:latest
ports:
- 3143:3142
options: >-
--health-cmd "wget --quiet --tries=1 --spider http://localhost:3143/acng-report.html"
--health-interval 30s
--health-timeout 10s
--health-retries 3
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Configure apt to use cacher
- name: Setup apt-cacher-ng
run: |
# Try to configure apt-cacher-ng, fallback to direct if unavailable
if wget --quiet --tries=1 --spider http://localhost:3143/acng-report.html 2>/dev/null; then
echo "Configuring apt to use cacher on port 3143"
echo 'Acquire::http::Proxy "http://localhost:3143";' | tee /etc/apt/apt.conf.d/01proxy
echo 'Acquire::https::Proxy "http://localhost:3143";' | tee -a /etc/apt/apt.conf.d/01proxy
echo 'Acquire::http::Proxy::security.debian.org "DIRECT";' | tee -a /etc/apt/apt.conf.d/01proxy
echo 'Acquire::http::Proxy::deb.debian.org "DIRECT";' | tee -a /etc/apt/apt.conf.d/01proxy
echo 'Acquire::http::Proxy::archive.ubuntu.com "DIRECT";' | tee -a /etc/apt/apt.conf.d/01proxy
echo 'Acquire::http::Proxy::security.ubuntu.com "DIRECT";' | tee -a /etc/apt/apt.conf.d/01proxy
echo "Setting up apt-cacher-ng for faster builds..."
# Start apt-cacher-ng in background
docker run -d --name apt-cacher-ng -p 3143:3142 sameersbn/apt-cacher-ng:latest || echo "Apt-cacher-ng already running or failed to start"
# Wait for it to be ready
timeout 30 bash -c 'until curl -s http://localhost:3143/acng-report.html > /dev/null 2>&1; do sleep 2; done' || echo "Apt-cacher-ng not ready, continuing without cache"
- name: Build libfuse in Debian container
run: |
# Create a script to run inside the container
cat > build_libfuse.sh << 'EOF'
set -e
# Configure apt to use cacher if available
if curl -s http://host.docker.internal:3143/acng-report.html > /dev/null 2>&1; then
echo "Configuring apt to use cacher"
echo 'Acquire::http::Proxy "http://host.docker.internal:3143";' > /etc/apt/apt.conf.d/01proxy
echo 'Acquire::https::Proxy "http://host.docker.internal:3143";' >> /etc/apt/apt.conf.d/01proxy
echo 'Acquire::http::Proxy::security.debian.org "DIRECT";' >> /etc/apt/apt.conf.d/01proxy
echo 'Acquire::http::Proxy::deb.debian.org "DIRECT";' >> /etc/apt/apt.conf.d/01proxy
else
echo "Apt-cacher-ng not available, using direct connection"
echo '# Apt-cacher-ng not available, using direct connection' | tee /etc/apt/apt.conf.d/01proxy
fi
- name: Wait for apt-cacher-ng to be ready
run: |
# Wait for cacher with timeout, but don't fail if unavailable
timeout 30 bash -c 'until wget --quiet --tries=1 --spider http://localhost:3143/acng-report.html; do sleep 2; done' || echo "Apt-cacher-ng not ready, continuing without cache"
- name: Set up build environment
run: |
# Update and install dependencies
apt-get update
apt-get install -y \
build-essential \
@ -66,49 +57,32 @@ jobs:
git \
wget \
curl \
dpkg-dev
- name: Download libfuse source
run: |
# Download libfuse 3.10.0 source (required for composefs compatibility)
# Note: Using 3.10.0 specifically to satisfy composefs dependency requirement
dpkg-dev \
signify-openbsd \
python3-pytest
# Download and verify libfuse source
wget https://github.com/libfuse/libfuse/releases/download/fuse-3.10.0/fuse-3.10.0.tar.xz
wget https://github.com/libfuse/libfuse/releases/download/fuse-3.10.0/fuse-3.10.0.tar.xz.asc
wget https://github.com/libfuse/libfuse/releases/download/fuse-3.10.0/fuse-3.10.pub
signify -V -m fuse-3.10.0.tar.xz -p fuse-3.10.pub
tar -xf fuse-3.10.0.tar.xz
cd fuse-3.10.0
- name: Verify libfuse signature
run: |
# Install signify for signature verification
apt-get install -y signify-openbsd
# Download and verify the signature
wget https://github.com/libfuse/libfuse/releases/download/fuse-3.10.0/fuse-3.10.pub
signify -V -m fuse-3.10.0.tar.xz -p fuse-3.10.pub
- name: Configure and build libfuse
run: |
cd fuse-3.10.0
# Build libfuse
mkdir build && cd build
meson setup --prefix=/usr --libdir=lib/x86_64-linux-gnu ..
ninja
- name: Run libfuse tests
run: |
cd fuse-3.10.0/build
# Install pytest for running tests
apt-get install -y python3-pytest
# Run tests (most can run as regular user)
# Run tests
python3 -m pytest test/ || echo "Some tests may require root privileges"
- name: Install libfuse
run: |
cd fuse-3.10.0/build
# Install
ninja install
ldconfig
- name: Create Debian package
run: |
# Create a simple .deb package
# Create Debian package
cd /workspace
mkdir -p libfuse3-3_3.10.0-1_amd64/DEBIAN
mkdir -p libfuse3-3_3.10.0-1_amd64/usr/lib/x86_64-linux-gnu
mkdir -p libfuse3-3_3.10.0-1_amd64/usr/include/fuse3
@ -126,7 +100,7 @@ jobs:
cp /usr/lib/pkgconfig/fuse3.pc libfuse3-3_3.10.0-1_amd64/usr/lib/pkgconfig/
# Create control file
cat > libfuse3-3_3.10.0-1_amd64/DEBIAN/control << EOF
cat > libfuse3-3_3.10.0-1_amd64/DEBIAN/control << 'CONTROL_EOF'
Package: libfuse3-3
Version: 3.10.0-1
Section: libs
@ -140,11 +114,28 @@ jobs:
create and mount their own filesystem implementations.
.
This package contains the FUSE v3 shared library.
EOF
CONTROL_EOF
# Build the package
dpkg-deb --build libfuse3-3_3.10.0-1_amd64
# Test package installation
dpkg -i libfuse3-3_3.10.0-1_amd64.deb || true
apt-get install -f -y
# Verify the library is available
ldconfig -p | grep libfuse3
pkg-config --exists fuse3 && echo "fuse3.pc found" || echo "fuse3.pc not found"
EOF
# Run the build script in Debian container
docker run --rm \
--add-host=host.docker.internal:host-gateway \
-v $(pwd):/workspace \
-w /workspace \
debian:trixie \
bash /workspace/build_libfuse.sh
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
@ -152,26 +143,18 @@ jobs:
path: libfuse3-3_3.10.0-1_amd64.deb
retention-days: 30
- name: Test package installation
run: |
# Test that the package can be installed
dpkg -i libfuse3-3_3.10.0-1_amd64.deb || true
apt-get install -f -y
# Verify the library is available
ldconfig -p | grep libfuse3
pkg-config --exists fuse3 && echo "fuse3.pc found" || echo "fuse3.pc not found"
- name: Show apt-cacher statistics
run: |
echo "=== Apt-Cacher-NG Statistics ==="
if wget -qO- http://localhost:3143/acng-report.html 2>/dev/null | grep -E "(Hits|Misses|Bytes|Files)"; then
if curl -s http://localhost:3143/acng-report.html 2>/dev/null | grep -E "(Hits|Misses|Bytes|Files)"; then
echo "Cache statistics retrieved successfully"
else
echo "Apt-cacher-ng not available or no statistics found"
fi
- name: Clean up proxy configuration
- name: Cleanup
if: always()
run: |
rm -f /etc/apt/apt.conf.d/01proxy
# Clean up apt-cacher-ng container
docker stop apt-cacher-ng 2>/dev/null || true
docker rm apt-cacher-ng 2>/dev/null || true