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: build-and-test:
name: Build and Test name: Build and Test
runs-on: ubuntu-latest 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: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Configure apt to use cacher - name: Setup apt-cacher-ng
run: | run: |
# Try to configure apt-cacher-ng, fallback to direct if unavailable echo "Setting up apt-cacher-ng for faster builds..."
if wget --quiet --tries=1 --spider http://localhost:3143/acng-report.html 2>/dev/null; then # Start apt-cacher-ng in background
echo "Configuring apt to use cacher on port 3143" 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"
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 # Wait for it to be ready
echo 'Acquire::http::Proxy::security.debian.org "DIRECT";' | tee -a /etc/apt/apt.conf.d/01proxy 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"
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 - name: Build libfuse in Debian container
echo 'Acquire::http::Proxy::security.ubuntu.com "DIRECT";' | tee -a /etc/apt/apt.conf.d/01proxy 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 else
echo "Apt-cacher-ng not available, using direct connection" 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 fi
- name: Wait for apt-cacher-ng to be ready # Update and install dependencies
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: |
apt-get update apt-get update
apt-get install -y \ apt-get install -y \
build-essential \ build-essential \
@ -66,49 +57,32 @@ jobs:
git \ git \
wget \ wget \
curl \ curl \
dpkg-dev dpkg-dev \
signify-openbsd \
python3-pytest
- name: Download libfuse source # Download and verify libfuse source
run: |
# Download libfuse 3.10.0 source (required for composefs compatibility)
# Note: Using 3.10.0 specifically to satisfy composefs dependency requirement
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
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.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 tar -xf fuse-3.10.0.tar.xz
cd fuse-3.10.0 cd fuse-3.10.0
- name: Verify libfuse signature # Build libfuse
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
mkdir build && cd build mkdir build && cd build
meson setup --prefix=/usr --libdir=lib/x86_64-linux-gnu .. meson setup --prefix=/usr --libdir=lib/x86_64-linux-gnu ..
ninja ninja
- name: Run libfuse tests # Run 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)
python3 -m pytest test/ || echo "Some tests may require root privileges" python3 -m pytest test/ || echo "Some tests may require root privileges"
- name: Install libfuse # Install
run: |
cd fuse-3.10.0/build
ninja install ninja install
ldconfig ldconfig
- name: Create Debian package # Create Debian package
run: | cd /workspace
# Create a simple .deb package
mkdir -p libfuse3-3_3.10.0-1_amd64/DEBIAN 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/lib/x86_64-linux-gnu
mkdir -p libfuse3-3_3.10.0-1_amd64/usr/include/fuse3 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/ cp /usr/lib/pkgconfig/fuse3.pc libfuse3-3_3.10.0-1_amd64/usr/lib/pkgconfig/
# Create control file # 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 Package: libfuse3-3
Version: 3.10.0-1 Version: 3.10.0-1
Section: libs Section: libs
@ -140,11 +114,28 @@ jobs:
create and mount their own filesystem implementations. create and mount their own filesystem implementations.
. .
This package contains the FUSE v3 shared library. This package contains the FUSE v3 shared library.
EOF CONTROL_EOF
# Build the package # Build the package
dpkg-deb --build libfuse3-3_3.10.0-1_amd64 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 - name: Upload artifacts
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
@ -152,26 +143,18 @@ jobs:
path: libfuse3-3_3.10.0-1_amd64.deb path: libfuse3-3_3.10.0-1_amd64.deb
retention-days: 30 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 - name: Show apt-cacher statistics
run: | run: |
echo "=== Apt-Cacher-NG Statistics ===" 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" echo "Cache statistics retrieved successfully"
else else
echo "Apt-cacher-ng not available or no statistics found" echo "Apt-cacher-ng not available or no statistics found"
fi fi
- name: Clean up proxy configuration - name: Cleanup
if: always() if: always()
run: | 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