ci: add install-deps composite action (#8152)

This commit is contained in:
Charles Kerr
2026-01-16 10:10:00 -06:00
committed by GitHub
parent f200bedd57
commit 36ea62cf6e
2 changed files with 395 additions and 176 deletions

320
.github/actions/install-deps/action.yml vendored Normal file
View File

@@ -0,0 +1,320 @@
name: 'Install Dependencies'
description: 'Install build dependencies for Transmission'
inputs:
compiler:
description: 'Compiler suite: clang, gcc, or system-default'
required: false
default: 'clang'
enable-clang-tidy:
description: 'Install clang-tidy-20'
required: false
default: 'false'
enable-debugging:
description: 'Install debugging tools (gdb, lldb, valgrind, etc.)'
required: false
default: 'false'
enable-gtk:
description: 'Install GTK dependencies'
required: false
default: 'false'
enable-qt:
description: 'Install Qt dependencies (qt5 or qt6)'
required: false
default: 'false'
use-sudo:
description: 'Use sudo for package installation (false for containers)'
required: false
default: 'true'
runs:
using: composite
steps:
- name: Detect Platform
shell: bash
run: |
set -ex
if [[ "$(uname -s)" == "Darwin" ]]; then
DETECTED_PLATFORM="macos"
echo "Detected macOS"
elif [[ -f /etc/os-release ]]; then
source /etc/os-release
echo "Detected Linux: ID=$ID, VERSION_ID=$VERSION_ID"
case "$ID" in
ubuntu)
DETECTED_PLATFORM="ubuntu-$VERSION_ID"
;;
debian)
DETECTED_PLATFORM="debian"
;;
fedora)
DETECTED_PLATFORM="fedora"
;;
*)
echo "Warning: Unsupported Linux distribution: $ID"
DETECTED_PLATFORM="unknown"
;;
esac
else
echo "Error: Unable to detect platform"
DETECTED_PLATFORM="unknown"
fi
echo "DETECTED_PLATFORM=$DETECTED_PLATFORM" >> "$GITHUB_ENV"
echo "Final detected platform: $DETECTED_PLATFORM"
- name: Install Linux dependencies
if: env.DETECTED_PLATFORM == 'debian' || env.DETECTED_PLATFORM == 'ubuntu-22.04' || env.DETECTED_PLATFORM == 'ubuntu-24.04' || env.DETECTED_PLATFORM == 'fedora'
shell: bash
run: |
set -ex
if [[ "$DETECTED_PLATFORM" == "fedora" ]]; then
# Fedora/DNF-based installation
dnf install -y \
ca-certificates \
cmake \
gettext \
ninja-build \
pkgconf-pkg-config \
xz
# Transmission-specific libraries with Fedora names
dnf install -y \
fmt-devel \
google-crc32c-devel \
libcurl-devel \
libdeflate-devel \
libevent-devel \
libnatpmp-devel \
libpsl-devel \
miniupnpc-devel \
openssl-devel
# Compiler packages
if [[ "${{ inputs.compiler }}" == "clang" ]]; then
dnf install -y clang
elif [[ "${{ inputs.compiler }}" == "gcc" ]]; then
dnf install -y gcc-c++
fi
# Debugging tools
if [[ "${{ inputs.enable-debugging }}" == "true" ]]; then
dnf install -y gdb valgrind
fi
else
# Debian/Ubuntu/APT-based installation
SUDO_CMD=""
if [[ "${{ inputs.use-sudo }}" == "true" ]]; then
SUDO_CMD="sudo"
fi
# Setup LLVM repo if clang-tidy is needed
if [[ "${{ inputs.enable-clang-tidy }}" == "true" ]]; then
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | $SUDO_CMD apt-key add -
if [[ "$DETECTED_PLATFORM" == "ubuntu-24.04" ]]; then
$SUDO_CMD add-apt-repository "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-20 main"
else
$SUDO_CMD add-apt-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-20 main"
fi
fi
$SUDO_CMD apt-get update
# Base packages
BASE_PACKAGES=(
appstream
ca-certificates
cmake
gettext
libcurl4-openssl-dev
libdeflate-dev
libevent-dev
libfmt-dev
libminiupnpc-dev
libnatpmp-dev
libpsl-dev
libssl-dev
locales
ninja-build
pkg-config
xz-utils
)
# Compiler packages
if [[ "${{ inputs.compiler }}" == "clang" ]]; then
BASE_PACKAGES+=(clang)
elif [[ "${{ inputs.compiler }}" == "gcc" ]]; then
BASE_PACKAGES+=(gcc g++)
fi
# clang-tidy
if [[ "${{ inputs.enable-clang-tidy }}" == "true" ]]; then
BASE_PACKAGES+=(clang-tidy-20)
fi
# Debugging tools
if [[ "${{ inputs.enable-debugging }}" == "true" ]]; then
BASE_PACKAGES+=(gdb libc6-dbg valgrind)
fi
$SUDO_CMD apt-get install -y --no-install-recommends "${BASE_PACKAGES[@]}"
# Setup UTF-8 locale for Qt builds
if [[ "${{ inputs.enable-qt }}" != "false" ]]; then
if [[ "${{ inputs.use-sudo }}" == "true" ]]; then
echo "en_US.UTF-8 UTF-8" | $SUDO_CMD tee /etc/locale.gen
$SUDO_CMD locale-gen
else
echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
locale-gen
fi
echo "LANG=C.UTF-8" >> "$GITHUB_ENV"
echo "LC_ALL=C.UTF-8" >> "$GITHUB_ENV"
fi
fi
- name: Install Linux GTK dependencies
if: (env.DETECTED_PLATFORM == 'debian' || env.DETECTED_PLATFORM == 'ubuntu-22.04' || env.DETECTED_PLATFORM == 'ubuntu-24.04' || env.DETECTED_PLATFORM == 'fedora') && inputs.enable-gtk == 'true'
shell: bash
run: |
if [[ "$DETECTED_PLATFORM" == "fedora" ]]; then
dnf install -y 'pkgconfig(glibmm-2.4)' 'pkgconfig(gtkmm-3.0)'
else
SUDO_CMD=""
if [[ "${{ inputs.use-sudo }}" == "true" ]]; then
SUDO_CMD="sudo"
fi
$SUDO_CMD apt-get install -y --no-install-recommends libglibmm-2.4-dev libgtkmm-3.0-dev
fi
- name: Install Linux Qt dependencies
if: (env.DETECTED_PLATFORM == 'debian' || env.DETECTED_PLATFORM == 'ubuntu-22.04' || env.DETECTED_PLATFORM == 'ubuntu-24.04' || env.DETECTED_PLATFORM == 'fedora') && inputs.enable-qt != 'false'
shell: bash
run: |
if [[ "$DETECTED_PLATFORM" == "fedora" ]]; then
if [[ "${{ inputs.enable-qt }}" == "qt6" ]]; then
dnf install -y qt6-qtbase-devel qt6-qtsvg-devel qt6-qttools-devel xcb-util-cursor
elif [[ "${{ inputs.enable-qt }}" == "qt5" ]]; then
dnf install -y qt5-qtbase-devel qt5-qtsvg-devel qt5-qttools-devel xcb-util-cursor
fi
else
SUDO_CMD=""
if [[ "${{ inputs.use-sudo }}" == "true" ]]; then
SUDO_CMD="sudo"
fi
if [[ "${{ inputs.enable-qt }}" == "qt5" ]]; then
$SUDO_CMD apt-get install -y --no-install-recommends libxcb-cursor0 qtbase5-dev libqt5svg5-dev qttools5-dev
elif [[ "${{ inputs.enable-qt }}" == "qt6" ]]; then
$SUDO_CMD apt-get install -y --no-install-recommends qt6-base-dev qt6-tools-dev qt6-l10n-tools libqt6svg6-dev
fi
fi
- name: Install macOS dependencies
if: env.DETECTED_PLATFORM == 'macos'
shell: bash
run: |
# Base packages for macOS
BASE_PACKAGES=(cmake gettext ninja node pkgconf)
# Additional packages for some builds
if [[ "${{ inputs.enable-gtk }}" == "true" || "${{ inputs.enable-qt }}" != "false" ]]; then
BASE_PACKAGES+=(libdeflate libevent libpsl miniupnpc crc32c)
else
BASE_PACKAGES+=(libdeflate libevent libpsl miniupnpc)
fi
brew install --formulae "${BASE_PACKAGES[@]}"
- name: Install macOS GTK dependencies
if: env.DETECTED_PLATFORM == 'macos' && inputs.enable-gtk == 'true'
shell: bash
run: |
brew install --formula gtkmm3
- name: Install macOS Qt dependencies
if: env.DETECTED_PLATFORM == 'macos' && inputs.enable-qt != 'false'
shell: bash
run: |
brew install --formula qt
- name: Report Installed Versions
shell: bash
run: |
echo "=== Installed Dependency Versions ==="
# Platform info
echo "Platform: $DETECTED_PLATFORM"
if [[ "$DETECTED_PLATFORM" == "macos" ]]; then
sw_vers
else
cat /etc/os-release | head -3
fi
echo ""
# Base build tools
echo "Build Tools:"
cmake --version 2>/dev/null | head -1 || echo "cmake: not found"
ninja --version 2>/dev/null && echo "ninja: $(ninja --version)" || echo "ninja: not found"
pkg-config --version 2>/dev/null && echo "pkg-config: $(pkg-config --version)" || \
pkgconf --version 2>/dev/null && echo "pkgconf: $(pkgconf --version)" || echo "pkg-config: not found"
echo ""
# Compilers
echo "Compilers:"
if [[ "${{ inputs.compiler }}" == "clang" || "${{ inputs.compiler }}" == "system-default" ]]; then
clang --version 2>/dev/null | head -1 || echo "clang: not found"
clang++ --version 2>/dev/null | head -1 || echo "clang++: not found"
fi
if [[ "${{ inputs.compiler }}" == "gcc" || "${{ inputs.compiler }}" == "system-default" ]]; then
gcc --version 2>/dev/null | head -1 || echo "gcc: not found"
g++ --version 2>/dev/null | head -1 || echo "g++: not found"
fi
echo ""
# Core libraries
echo "Core Libraries:"
pkg-config --modversion libcurl 2>/dev/null && echo "libcurl: $(pkg-config --modversion libcurl)" || \
curl --version 2>/dev/null | head -1 | sed 's/curl /libcurl: /' || echo "libcurl: not found"
pkg-config --modversion openssl 2>/dev/null && echo "openssl: $(pkg-config --modversion openssl)" || \
openssl version 2>/dev/null && echo "openssl: $(openssl version)" || echo "openssl: not found"
pkg-config --modversion libevent 2>/dev/null && echo "libevent: $(pkg-config --modversion libevent)" || echo "libevent: not found"
echo ""
# Qt versions (if enabled)
if [[ "${{ inputs.enable-qt }}" != "false" ]]; then
echo "Qt:"
if [[ "${{ inputs.enable-qt }}" == "qt5" ]]; then
pkg-config --modversion Qt5Core 2>/dev/null && echo "Qt5Core: $(pkg-config --modversion Qt5Core)" || echo "Qt5Core: not found"
elif [[ "${{ inputs.enable-qt }}" == "qt6" ]]; then
pkg-config --modversion Qt6Core 2>/dev/null && echo "Qt6Core: $(pkg-config --modversion Qt6Core)" || echo "Qt6Core: not found"
fi
echo ""
fi
# GTK versions (if enabled)
if [[ "${{ inputs.enable-gtk }}" == "true" ]]; then
echo "GTK:"
pkg-config --modversion gtk+-3.0 2>/dev/null && echo "GTK+3: $(pkg-config --modversion gtk+-3.0)" || echo "GTK+3: not found"
pkg-config --modversion gtk4 2>/dev/null && echo "GTK4: $(pkg-config --modversion gtk4)" || echo "GTK4: not found"
echo ""
fi
# Development tools (if enabled)
if [[ "${{ inputs.enable-clang-tidy }}" == "true" ]]; then
echo "Static Analysis:"
clang-tidy-20 --version 2>/dev/null | head -1 || clang-tidy --version 2>/dev/null | head -1 || echo "clang-tidy: not found"
echo ""
fi
if [[ "${{ inputs.enable-debugging }}" == "true" ]]; then
echo "Debugging Tools:"
gdb --version 2>/dev/null | head -1 || echo "gdb: not found"
if [[ "$DETECTED_PLATFORM" == "macos" ]]; then
lldb --version 2>/dev/null | head -1 || echo "lldb: not found"
else
valgrind --version 2>/dev/null || echo "valgrind: not found"
fi
echo ""
fi

View File

@@ -131,33 +131,20 @@ jobs:
echo '${{ toJSON(needs) }}'
echo '${{ toJSON(runner) }}'
cat /etc/os-release
- name: Get Dependencies
run: |
set -ex
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
ca-certificates \
clang \
cmake \
gettext \
libcurl4-openssl-dev \
libdeflate-dev \
libevent-dev \
libfmt-dev \
libminiupnpc-dev \
libnatpmp-dev \
libpsl-dev \
libssl-dev \
ninja-build
- name: Get Source
uses: actions/checkout@v6
with:
submodules: recursive
path: src
- name: Get Dependencies
uses: ./.github/actions/install-deps
with:
compiler: clang
enable-debugging: true
use-sudo: true
- name: Configure
run: |
cmake \
-S src \
-S . \
-B obj \
-G Ninja \
-DCMAKE_BUILD_TYPE=Debug \
@@ -190,17 +177,18 @@ jobs:
echo '${{ toJSON(needs) }}'
echo '${{ toJSON(runner) }}'
sw_vers
- name: Get Dependencies
run: brew install --formulae cmake gettext libdeflate libevent libpsl miniupnpc ninja node pkgconf
- name: Get Source
uses: actions/checkout@v6
with:
submodules: recursive
path: src
- name: Get Dependencies
uses: ./.github/actions/install-deps
with:
compiler: clang
- name: Configure
run: |
cmake \
-S src \
-S . \
-B obj \
-G Ninja \
-DCMAKE_BUILD_TYPE=Debug \
@@ -231,36 +219,20 @@ jobs:
echo '${{ toJSON(needs) }}'
echo '${{ toJSON(runner) }}'
cat /etc/os-release
- name: Get Dependencies
run: |
set -ex
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo add-apt-repository "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-20 main"
sudo apt update
sudo apt install -y --no-install-recommends \
ca-certificates \
clang \
clang-tidy-20 \
cmake \
gettext \
libcurl4-openssl-dev \
libdeflate-dev \
libevent-dev \
libfmt-dev \
libminiupnpc-dev \
libnatpmp-dev \
libpsl-dev \
libssl-dev \
ninja-build
- name: Get Source
uses: actions/checkout@v6
with:
submodules: recursive
path: src
- name: Get Dependencies
uses: ./.github/actions/install-deps
with:
compiler: clang
enable-clang-tidy: true
use-sudo: true
- name: Configure
run: |
cmake \
-S src \
-S . \
-B obj \
-G Ninja \
-DCMAKE_BUILD_TYPE=Debug \
@@ -376,23 +348,20 @@ jobs:
echo '${{ toJSON(needs) }}'
echo '${{ toJSON(runner) }}'
sw_vers
- name: Get Dependencies
run: brew install --formulae cmake gettext libdeflate libevent libpsl miniupnpc ninja node pkgconf crc32c
- name: Get Dependencies (GTK)
if: ${{ needs.what-to-make.outputs.make-gtk == 'true' }}
run: brew install --formula gtkmm3
- name: Get Dependencies (Qt)
if: ${{ needs.what-to-make.outputs.make-qt == 'true' }}
run: brew install --formula qt
- name: Get Source
uses: actions/checkout@v6
with:
path: src
submodules: recursive
- name: Get Dependencies
uses: ./.github/actions/install-deps
with:
compiler: clang
enable-gtk: ${{ needs.what-to-make.outputs.make-gtk == 'true' }}
enable-qt: ${{ needs.what-to-make.outputs.make-qt == 'true' && 'qt6' || 'false' }}
- name: Configure
run: |
cmake \
-S src \
-S . \
-B obj \
-G Ninja \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
@@ -710,42 +679,24 @@ jobs:
echo '${{ toJSON(needs) }}'
echo '${{ toJSON(runner) }}'
cat /etc/os-release
- name: Get Composite Actions
uses: actions/checkout@v6
with:
sparse-checkout: |
.github/actions
sparse-checkout-cone-mode: false
path: composite-actions
- name: Get Dependencies
run: |
set -ex
apt-get update
apt-get install -y --no-install-recommends \
ca-certificates \
cmake \
g++ \
gettext \
libcurl4-openssl-dev \
libdeflate-dev \
libevent-dev \
libfmt-dev \
libminiupnpc-dev \
libnatpmp-dev \
libpsl-dev \
libssl-dev \
locales \
ninja-build \
pkg-config \
xz-utils
# Set UTF-8 locale for Qt
echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
locale-gen
echo "LANG=C.UTF-8" >> "$GITHUB_ENV"
echo "LC_ALL=C.UTF-8" >> "$GITHUB_ENV"
uses: ./composite-actions/.github/actions/install-deps
with:
compiler: gcc
enable-gtk: ${{ needs.what-to-make.outputs.make-gtk == 'true' }}
enable-qt: ${{ needs.what-to-make.outputs.make-qt == 'true' && 'qt5' || 'false' }}
use-sudo: false
- name: Get NPM
uses: actions/setup-node@v6
with:
node-version: lts/*
- name: Get Dependencies (GTK)
if: ${{ needs.what-to-make.outputs.make-gtk == 'true' }}
run: apt-get install -y --no-install-recommends libglibmm-2.4-dev libgtkmm-3.0-dev
- name: Get Dependencies (Qt5)
if: ${{ needs.what-to-make.outputs.make-qt == 'true' }}
run: apt-get install -y --no-install-recommends libxcb-cursor0 qtbase5-dev libqt5svg5-dev qttools5-dev
- name: Get Source
uses: actions/download-artifact@v7
with:
@@ -800,36 +751,24 @@ jobs:
echo '${{ toJSON(needs) }}'
echo '${{ toJSON(runner) }}'
cat /etc/os-release
- name: Get Composite Actions
uses: actions/checkout@v6
with:
sparse-checkout: |
.github/actions
sparse-checkout-cone-mode: false
path: composite-actions
- name: Get Dependencies
run: |
set -ex
dnf install -y \
ca-certificates \
cmake \
fmt-devel \
gcc-c++ \
gettext \
google-crc32c-devel \
libcurl-devel \
libdeflate-devel \
libevent-devel \
libnatpmp-devel \
libpsl-devel \
miniupnpc-devel \
ninja-build \
openssl-devel \
pkgconf-pkg-config \
xz
uses: ./composite-actions/.github/actions/install-deps
with:
compiler: gcc
enable-gtk: ${{ needs.what-to-make.outputs.make-gtk == 'true' }}
enable-qt: ${{ needs.what-to-make.outputs.make-qt == 'true' && 'qt6' || 'false' }}
use-sudo: false
- name: Get NPM
uses: actions/setup-node@v6
with:
node-version: lts/*
- name: Get Dependencies (GTK4)
if: ${{ needs.what-to-make.outputs.make-gtk == 'true' }}
run: dnf install -y glibmm2.68-devel gtkmm4.0-devel
- name: Get Dependencies (Qt6)
if: ${{ needs.what-to-make.outputs.make-qt == 'true' }}
run: dnf install -y qt6-qtbase-devel qt6-qtsvg-devel qt6-qttools-devel xcb-util-cursor
- name: Get Source
uses: actions/download-artifact@v7
with:
@@ -880,41 +819,26 @@ jobs:
echo '${{ toJSON(needs) }}'
echo '${{ toJSON(runner) }}'
cat /etc/os-release
- name: Get Composite Actions
uses: actions/checkout@v6
with:
sparse-checkout: |
.github/actions
sparse-checkout-cone-mode: false
path: composite-actions
- name: Get Dependencies
run: |
set -ex
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
appstream \
ca-certificates \
clang \
cmake \
gettext \
libcurl4-openssl-dev \
libdeflate-dev \
libevent-dev \
libfmt-dev \
libminiupnpc-dev \
libnatpmp-dev \
libpsl-dev \
libssl-dev \
locales \
ninja-build
# Set UTF-8 locale for Qt
echo "en_US.UTF-8 UTF-8" | sudo tee /etc/locale.gen
sudo locale-gen
echo "LANG=C.UTF-8" >> "$GITHUB_ENV"
echo "LC_ALL=C.UTF-8" >> "$GITHUB_ENV"
uses: ./composite-actions/.github/actions/install-deps
with:
compiler: clang
enable-gtk: ${{ needs.what-to-make.outputs.make-gtk == 'true' }}
enable-qt: ${{ needs.what-to-make.outputs.make-qt == 'true' && 'qt5' || 'false' }}
use-sudo: true
- name: Get NPM
uses: actions/setup-node@v6
with:
node-version: lts/*
- name: Get Dependencies (GTK)
if: ${{ needs.what-to-make.outputs.make-gtk == 'true' }}
run: sudo apt-get install -y --no-install-recommends libglibmm-2.4-dev libgtkmm-3.0-dev
- name: Get Dependencies (Qt5)
if: ${{ needs.what-to-make.outputs.make-qt == 'true' }}
run: sudo apt-get install -y --no-install-recommends libxcb-cursor0 qtbase5-dev libqt5svg5-dev qttools5-dev
- name: Get Source
uses: actions/download-artifact@v7
with:
@@ -1013,46 +937,21 @@ jobs:
echo '${{ toJSON(needs) }}'
echo '${{ toJSON(runner) }}'
cat /etc/os-release
- name: Get Dependencies
run: |
set -ex
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
appstream \
ca-certificates \
clang \
cmake \
gettext \
libcurl4-openssl-dev \
libdeflate-dev \
libevent-dev \
libfmt-dev \
libminiupnpc-dev \
libnatpmp-dev \
libpsl-dev \
libssl-dev \
locales \
ninja-build
# Set UTF-8 locale for Qt
echo "en_US.UTF-8 UTF-8" | sudo tee /etc/locale.gen
sudo locale-gen
echo "LANG=C.UTF-8" >> "$GITHUB_ENV"
echo "LC_ALL=C.UTF-8" >> "$GITHUB_ENV"
- name: Get Dependencies (GTK)
if: ${{ needs.what-to-make.outputs.make-gtk == 'true' }}
run: sudo apt-get install -y --no-install-recommends libglibmm-2.4-dev libgtkmm-3.0-dev
- name: Get Dependencies (Qt6)
if: ${{ needs.what-to-make.outputs.make-qt == 'true' }}
run: sudo apt-get install -y --no-install-recommends libxcb-cursor0 qt6-base-dev qt6-svg-dev qt6-tools-dev
- name: Get Source
uses: actions/checkout@v6
with:
submodules: recursive
path: src
- name: Get Dependencies
uses: ./.github/actions/install-deps
with:
compiler: clang
enable-gtk: ${{ needs.what-to-make.outputs.make-gtk == 'true' }}
enable-qt: ${{ needs.what-to-make.outputs.make-qt == 'true' && 'qt6' || 'false' }}
use-sudo: true
- name: Configure
run: |
cmake \
-S src \
-S . \
-B obj \
-G Ninja \
-DCMAKE_CXX_STANDARD=23 \