From c6d4c7bbbf22425223a8a0c59b3069dc19415a3c Mon Sep 17 00:00:00 2001 From: VeithMetro Date: Fri, 21 Aug 2026 13:05:19 +0200 Subject: [PATCH] Use the new package install action instead of doing it manually --- .github/workflows/Linux build template.yml | 81 +--------------------- 1 file changed, 3 insertions(+), 78 deletions(-) diff --git a/.github/workflows/Linux build template.yml b/.github/workflows/Linux build template.yml index 41d33fd..369e068 100644 --- a/.github/workflows/Linux build template.yml +++ b/.github/workflows/Linux build template.yml @@ -19,85 +19,10 @@ jobs: # ----- Packages & artifacts ----- name: Build type - ${{matrix.build_type}}${{matrix.architecture == '32' && ' x86' || ''}} steps: - - 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 - APT_OPTS="-o Acquire::Retries=3 -o Acquire::http::Timeout=20 -o Acquire::https::Timeout=20 -o Acquire::ConnectTimeout=10 -o Dpkg::Lock::Timeout=60" - MIRRORS=("archive.ubuntu.com/ubuntu" "mirror.ubuntu.com/ubuntu") - mirror_index=-1 - switch_ubuntu_mirror() { - local mirror="${MIRRORS[$mirror_index]}" - echo "Switching Ubuntu mirror to http://${mirror}" - for source_file in /etc/apt/sources.list /etc/apt/sources.list.d/ubuntu.sources; do - if [ -f "$source_file" ]; then - sudo sed -i -E "s#^(URIs:[[:space:]]+|deb[[:space:]]+)[^[:space:]]+#\1http://${mirror}#" "$source_file" - fi - done - } - updated=0 - for attempt in {1..6}; do - if [ "$attempt" -gt 2 ] && [ $(( (attempt - 1) % 2 )) -eq 0 ]; then - mirror_index=$((mirror_index + 1)) - switch_ubuntu_mirror - fi - if timeout 300s sudo apt-get update ${APT_OPTS}; then - updated=1 - break - fi - echo "apt-get update failed (attempt $attempt), retrying..." - sleep $((attempt*10)) - done - if [ "$updated" -ne 1 ]; then - echo "apt-get update failed after trying 3 Ubuntu mirrors" - exit 1 - fi - - name: Install system dependencies - shell: bash - run: | - set -euo pipefail - export DEBIAN_FRONTEND=noninteractive - APT_OPTS="-o Acquire::Retries=3 -o Acquire::http::Timeout=20 -o Acquire::https::Timeout=20 -o Acquire::ConnectTimeout=10 -o Dpkg::Lock::Timeout=60" - MIRRORS=("archive.ubuntu.com/ubuntu" "mirror.ubuntu.com/ubuntu") - mirror_index=-1 - switch_ubuntu_mirror() { - local mirror="${MIRRORS[$mirror_index]}" - echo "Switching Ubuntu mirror to http://${mirror}" - for source_file in /etc/apt/sources.list /etc/apt/sources.list.d/ubuntu.sources; do - if [ -f "$source_file" ]; then - sudo sed -i -E "s#^(URIs:[[:space:]]+|deb[[:space:]]+)[^[:space:]]+#\1http://${mirror}#" "$source_file" - fi - done - } - 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 - installed=0 - for attempt in {1..6}; do - if [ "$attempt" -gt 2 ] && [ $(( (attempt - 1) % 2 )) -eq 0 ]; then - mirror_index=$((mirror_index + 1)) - switch_ubuntu_mirror - fi - if timeout 300s sudo apt-get install -y --no-install-recommends ${APT_OPTS} $PKGS; then - installed=1 - break - fi - echo "apt-get install failed (attempt $attempt), cleaning up & retrying..." - sleep $((attempt*15)) - done - if [ "$installed" -ne 1 ]; then - echo "apt-get install failed after trying 3 Ubuntu mirrors" - exit 1 - fi + uses: rdkcentral/ThunderTools/.github/actions/apt-dependencies@master + with: + architecture: ${{ matrix.architecture }} - name: Set up Python environment run: |