diff --git a/.github/workflows/Linux build template.yml b/.github/workflows/Linux build template.yml index 04846ff..3604301 100644 --- a/.github/workflows/Linux build template.yml +++ b/.github/workflows/Linux build template.yml @@ -16,22 +16,49 @@ jobs: # ----- Packages & artifacts ----- name: Build type - ${{matrix.build_type}}${{matrix.architecture == '32' && ' x86' || ''}} steps: - - name: Install necessary packages - uses: nick-fields/retry@v3 - with: - timeout_minutes: 10 - max_attempts: 10 - command: | - sudo gem install apt-spy2 - sudo apt-spy2 fix --commit --launchpad --country=US - echo "deb http://archive.ubuntu.com/ubuntu/ jammy main universe restricted multiverse" | sudo tee -a /etc/apt/sources.list - echo "deb http://archive.ubuntu.com/ubuntu/ jammy-updates main universe restricted multiverse" | sudo tee -a /etc/apt/sources.list - sudo dpkg --add-architecture i386 - sudo apt-get update - sudo apt install python3-pip build-essential cmake ninja-build libusb-1.0-0-dev ${{matrix.architecture == '32' && 'zlib1g-dev:i386 libssl-dev:i386 gcc-13-multilib g++-13-multilib' || 'zlib1g-dev libssl-dev'}} - python3 -m venv venv - source venv/bin/activate - pip install jsonref + - name: Prepare apt (add i386 if needed) + if: ${{ matrix.architecture == '32' }} + run: | + sudo dpkg --add-architecture i386 + + - name: Update apt indices (with retries) + shell: bash + run: | + set -euo pipefail + for attempt in {1..5}; do + if sudo apt-get update -o Acquire::Retries=5 -o Acquire::http::Timeout=30; then + break + fi + echo "apt-get update failed (attempt $attempt), retrying..." + sleep $((attempt*10)) + done + + - name: Install system dependencies + shell: bash + run: | + set -euo pipefail + export DEBIAN_FRONTEND=noninteractive + PKGS="python3-venv python3-pip build-essential cmake ninja-build libusb-1.0-0-dev" + if [ "${{ matrix.architecture }}" = "32" ]; then + PKGS="$PKGS zlib1g-dev:i386 libssl-dev:i386 libsbc-dev:i386 gcc-13-multilib g++-13-multilib" + else + PKGS="$PKGS zlib1g-dev libssl-dev libsbc-dev" + fi + for attempt in {1..4}; do + if sudo apt-get install -y --no-install-recommends $PKGS; then + break + fi + echo "apt-get install failed (attempt $attempt), cleaning up & retrying..." + sudo apt-get clean + sleep $((attempt*15)) + done + + - name: Set up Python environment + run: | + python3 -m venv venv + source venv/bin/activate + pip install --upgrade pip + pip install jsonref - name: Download artifacts uses: actions/download-artifact@v4