diff --git a/.forgejo/workflows/ci.yml b/.forgejo/workflows/ci.yml index 6ebbf7e..c2bf2f1 100644 --- a/.forgejo/workflows/ci.yml +++ b/.forgejo/workflows/ci.yml @@ -19,9 +19,9 @@ jobs: apt-cacher-ng: image: sameersbn/apt-cacher-ng:latest ports: - - 3142:3142 + - 3143:3142 options: >- - --health-cmd "wget --quiet --tries=1 --spider http://localhost:3142/acng-report.html" + --health-cmd "wget --quiet --tries=1 --spider http://localhost:3143/acng-report.html" --health-interval 30s --health-timeout 10s --health-retries 3 @@ -32,16 +32,24 @@ jobs: - name: Configure apt to use cacher run: | - echo 'Acquire::http::Proxy "http://localhost:3142";' | sudo tee /etc/apt/apt.conf.d/01proxy - echo 'Acquire::https::Proxy "http://localhost:3142";' | sudo tee -a /etc/apt/apt.conf.d/01proxy - echo 'Acquire::http::Proxy::security.debian.org "DIRECT";' | sudo tee -a /etc/apt/apt.conf.d/01proxy - echo 'Acquire::http::Proxy::deb.debian.org "DIRECT";' | sudo tee -a /etc/apt/apt.conf.d/01proxy - echo 'Acquire::http::Proxy::archive.ubuntu.com "DIRECT";' | sudo tee -a /etc/apt/apt.conf.d/01proxy - echo 'Acquire::http::Proxy::security.ubuntu.com "DIRECT";' | sudo tee -a /etc/apt/apt.conf.d/01proxy + # 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 + 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: | - timeout 60 bash -c 'until wget --quiet --tries=1 --spider http://localhost:3142/acng-report.html; do sleep 2; done' + # 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: | @@ -157,7 +165,11 @@ jobs: - name: Show apt-cacher statistics run: | echo "=== Apt-Cacher-NG Statistics ===" - wget -qO- http://localhost:3142/acng-report.html | grep -E "(Hits|Misses|Bytes|Files)" || echo "Statistics not available" + if wget -qO- 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 if: always()