Use TCP_NODELAY for TCP connections #150
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
build: | |
timeout-minutes: 50 | |
strategy: | |
fail-fast: false | |
matrix: | |
target: | |
- os: linux | |
cpu: amd64 | |
- os: linux | |
cpu: i386 | |
- os: macos | |
cpu: amd64 | |
- os: macos | |
cpu: arm64 | |
- os: windows | |
cpu: amd64 | |
build-system: [cmake, autotools] | |
libs: [system, vendored] | |
include: | |
- target: | |
os: linux | |
builder: ubuntu-24.04 | |
shell: bash | |
- target: | |
os: macos | |
cpu: amd64 | |
builder: macos-latest-large | |
shell: bash | |
- target: | |
os: macos | |
cpu: arm64 | |
builder: macos-latest | |
shell: bash | |
- target: | |
os: windows | |
builder: windows-2019 | |
shell: msys2 {0} | |
defaults: | |
run: | |
shell: ${{ matrix.shell }} | |
name: '${{ matrix.target.os }}-${{ matrix.target.cpu }} (${{ matrix.build-system }}, ${{ matrix.libs }} libs)' | |
runs-on: ${{ matrix.builder }} | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: 'recursive' | |
- name: Environment variables | |
shell: bash | |
run: | | |
CFLAGS="-O3 -march=native -pipe" | |
CXXFLAGS="-O3 -march=native -pipe" | |
CPPFLAGS="" | |
LDFLAGS="" | |
NCPU="" | |
MAKE_CMD="make" | |
QMAKE="qmake" | |
case "${{ runner.os }}" in | |
"Linux") | |
NCPU="$(nproc)" | |
echo "DEBIAN_FRONTEND=noninteractive" >> ${GITHUB_ENV} | |
echo "TZ=Etc/UTC" >> ${GITHUB_ENV} | |
if [[ "${{ matrix.target.cpu }}" == "i386" ]]; then | |
CFLAGS="${CFLAGS} -m32" | |
CXXFLAGS="${CXXFLAGS} -m32" | |
CPPFLAGS="${CPPFLAGS} -I/usr/include/i386-linux-gnu/" | |
LDFLAGS="${LDFLAGS} -m32 -L/usr/lib/i386-linux-gnu/" | |
QMAKE="/usr/lib/i386-linux-gnu/qt5/bin/qmake" | |
echo "/usr/lib/i386-linux-gnu/qt5/bin" >> ${GITHUB_PATH} | |
echo "PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig" >> ${GITHUB_ENV} | |
fi | |
;; | |
"macOS") | |
NCPU="$(sysctl -n hw.logicalcpu)" | |
CPPFLAGS="${CPPFLAGS} -I/opt/homebrew/opt/gettext/include" | |
LDFLAGS="${LDFLAGS} -L/opt/homebrew/opt/gettext/lib" | |
echo "/opt/homebrew/opt/qt@5/bin" >> ${GITHUB_PATH} | |
echo "/opt/homebrew/opt/gettext/bin" >> ${GITHUB_PATH} | |
echo "PKG_CONFIG_PATH=/opt/homebrew/opt/qt@5/lib/pkgconfig:/opt/homebrew/opt/openssl@1.1/lib/pkgconfig" >> ${GITHUB_ENV} | |
echo "MACOSX_DEPLOYMENT_TARGET=12.0" >> ${GITHUB_ENV} | |
;; | |
"Windows") | |
NCPU="${NUMBER_OF_PROCESSORS}" | |
MAKE_CMD="mingw32-make" | |
# avoid random failure: "aclocal-1.16: error: aclocal: file '/a/_temp/msys64/usr/share/aclocal/tcl.m4' does not exist" | |
echo "ACLOCAL_PATH=/d/a/_temp/msys64/usr/share/aclocal/:${ACLOCAL_PATH}" >> ${GITHUB_ENV} | |
;; | |
esac | |
echo "CFLAGS=${CFLAGS}" >> ${GITHUB_ENV} | |
echo "CXXFLAGS=${CXXFLAGS}" >> ${GITHUB_ENV} | |
echo "CPPFLAGS=${CPPFLAGS}" >> ${GITHUB_ENV} | |
echo "LDFLAGS=${LDFLAGS}" >> ${GITHUB_ENV} | |
[[ -z "${NCPU}" || ${NCPU} -le 0 ]] && NCPU="1" | |
echo "NCPU=${NCPU}" >> ${GITHUB_ENV} | |
echo "MAKE_CMD=${MAKE_CMD}" >> ${GITHUB_ENV} | |
echo "QMAKE=${QMAKE}" >> ${GITHUB_ENV} | |
- name: Install build dependencies (Linux i386) | |
if: runner.os == 'Linux' && matrix.target.cpu == 'i386' | |
run: | | |
sudo -E dpkg --add-architecture i386 | |
sudo -E apt-get update -qq | |
sudo -E eatmydata apt-get install --no-install-recommends --allow-downgrades -yq \ | |
g++-multilib \ | |
gcc-multilib \ | |
gettext:i386 \ | |
intltool:i386 \ | |
libatomic1:i386 \ | |
libc6:i386 \ | |
libcurl4-openssl-dev:i386 \ | |
libevent-dev:i386 \ | |
libgcc-s1:i386 \ | |
libglib2.0-dev:i386 \ | |
libgomp1:i386 \ | |
libgtk-3-dev:i386 \ | |
libnotify-dev:i386 \ | |
libssl-dev:i386 \ | |
libstdc++6:i386 \ | |
libsystemd-dev:i386 \ | |
qttools5-dev:i386 \ | |
zlib1g-dev:i386 | |
- name: Install build dependencies (Linux AMD64) | |
if: runner.os == 'Linux' && matrix.target.cpu == 'amd64' | |
run: | | |
sudo -E apt-get update -qq | |
sudo -E eatmydata apt-get install --no-install-recommends -yq \ | |
build-essential \ | |
gettext \ | |
intltool \ | |
libayatana-appindicator3-dev \ | |
libcurl4-openssl-dev \ | |
libevent-dev \ | |
libglib2.0-dev \ | |
libgtk-3-dev \ | |
libminiupnpc-dev \ | |
libnatpmp-dev \ | |
libnotify-dev \ | |
libssl-dev \ | |
libsystemd-dev \ | |
qttools5-dev \ | |
zlib1g-dev | |
- name: Select the Xcode version | |
if: runner.os == 'macOS' | |
uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: '15' # 14 seems buggy: https://github.com/actions/runner-images/issues/6642 | |
- name: Install build dependencies (macOS) | |
if: runner.os == 'macOS' | |
run: | | |
brew install \ | |
autoconf \ | |
automake \ | |
cmake \ | |
gettext \ | |
gtk+3 \ | |
intltool \ | |
libevent \ | |
libnatpmp \ | |
miniupnpc \ | |
openssl@1.1 \ | |
pkg-config \ | |
qt@5 | |
- name: MSYS2 (Windows amd64) | |
if: runner.os == 'Windows' && matrix.target.cpu == 'amd64' | |
uses: msys2/setup-msys2@v2 | |
with: | |
path-type: inherit | |
install: >- | |
base-devel | |
intltool | |
mingw-w64-x86_64-autotools | |
mingw-w64-x86_64-cmake | |
mingw-w64-x86_64-curl | |
mingw-w64-x86_64-dht | |
mingw-w64-x86_64-gtk3 | |
mingw-w64-x86_64-libb64 | |
mingw-w64-x86_64-libevent | |
mingw-w64-x86_64-libnatpmp | |
mingw-w64-x86_64-libnotify | |
mingw-w64-x86_64-libutp | |
mingw-w64-x86_64-miniupnpc | |
mingw-w64-x86_64-openssl | |
mingw-w64-x86_64-qt5-base | |
mingw-w64-x86_64-qt5-tools | |
mingw-w64-x86_64-qt5-winextras | |
mingw-w64-x86_64-toolchain | |
mingw-w64-x86_64-zlib | |
- name: Build binaries and run tests | |
run: | | |
if [[ "${{ matrix.build-system }}" == "cmake" ]]; then | |
mkdir build | |
cd build | |
CMAKE_ARGS=( | |
-DENABLE_DAEMON=ON | |
-DENABLE_UTILS=ON | |
-DENABLE_CLI=ON | |
-DENABLE_GTK=ON | |
-DENABLE_QT=ON | |
-DWITH_CRYPTO=openssl | |
-DUSE_SYSTEM_UTP=OFF # latest version redefines "bool" for C compilers | |
) | |
if [[ "${{ matrix.libs }}" == "system" ]]; then | |
CMAKE_ARGS+=( | |
-DUSE_SYSTEM_EVENT2=ON | |
-DUSE_SYSTEM_MINIUPNPC=ON | |
) | |
else # force vendored libs | |
CMAKE_ARGS+=( | |
-DUSE_SYSTEM_B64=OFF | |
-DUSE_SYSTEM_DHT=OFF | |
-DUSE_SYSTEM_EVENT2=OFF | |
-DUSE_SYSTEM_MINIUPNPC=OFF | |
-DUSE_SYSTEM_NATPMP=OFF | |
) | |
fi | |
if [[ "${{ runner.os }}" == "Windows" ]]; then | |
CMAKE_ARGS+=( | |
-G "MinGW Makefiles" | |
) | |
if [[ "${{ matrix.libs }}" == "system" ]]; then | |
CMAKE_ARGS+=( | |
-DUSE_SYSTEM_B64=ON | |
-DUSE_SYSTEM_DHT=ON | |
-DUSE_SYSTEM_NATPMP=ON | |
) | |
fi | |
elif [[ "${{ runner.os }}" == "macOS" ]]; then | |
CMAKE_ARGS+=( | |
-DENABLE_MAC=ON | |
-DOPENSSL_ROOT_DIR=/opt/homebrew/opt/openssl | |
) | |
elif [[ "${{ runner.os }}" == "Linux" ]]; then | |
if [[ "${{ matrix.libs }}" == "system" ]]; then | |
CMAKE_ARGS+=( | |
-DUSE_SYSTEM_NATPMP=ON | |
) | |
fi | |
if [[ "${{ matrix.target.cpu }}" == "i386" ]]; then | |
CMAKE_ARGS+=( | |
-DCMAKE_LIBRARY_PATH=/usr/lib/i386-linux-gnu/ | |
-DCMAKE_INCLUDE_PATH=/usr/include/i386-linux-gnu/ | |
# packages not available for i386: | |
-DUSE_SYSTEM_MINIUPNPC=OFF | |
-DUSE_SYSTEM_NATPMP=OFF | |
) | |
fi | |
fi | |
cmake "${CMAKE_ARGS[@]}" .. | |
${MAKE_CMD} -j${NCPU} VERBOSE=1 | |
${MAKE_CMD} test || ${MAKE_CMD} VERBOSE=1 ARGS="--rerun-failed --output-on-failure" test | |
fi # CMake | |
if [[ "${{ matrix.build-system }}" == "autotools" ]]; then | |
CONFIGURE_ARGS=( | |
--enable-utp | |
--enable-cli | |
--enable-daemon | |
--with-crypto=openssl | |
--with-gtk | |
--with-qt | |
--disable-external-utp # latest version redefines "bool" for C compilers | |
QMAKE="${QMAKE}" # the 64-bit version overrides the 32-bit one, otherwise | |
) | |
if [[ "${{ matrix.libs }}" == "system" ]]; then | |
CONFIGURE_ARGS+=( | |
--enable-external-libevent | |
--enable-external-miniupnpc | |
) | |
fi | |
if [[ "${{ runner.os }}" == "Windows" ]]; then | |
if [[ "${{ matrix.libs }}" == "system" ]]; then | |
CONFIGURE_ARGS+=( | |
--enable-external-b64 | |
--enable-external-dht | |
--enable-external-natpmp | |
) | |
fi | |
elif [[ "${{ runner.os }}" == "macOS" ]]; then | |
if [[ "${{ matrix.libs }}" == "system" ]]; then | |
CPPFLAGS="${CPPFLAGS} -I/opt/homebrew/opt/miniupnpc/include" | |
LDFLAGS="${LDFLAGS} -L/opt/homebrew/opt/miniupnpc/lib" | |
fi | |
elif [[ "${{ runner.os }}" == "Linux" ]]; then | |
if [[ "${{ matrix.libs }}" == "system" ]]; then | |
CONFIGURE_ARGS+=( | |
--enable-external-natpmp | |
) | |
fi | |
if [[ "${{ matrix.target.cpu }}" == "i386" ]]; then | |
# packages not available for i386: | |
CONFIGURE_ARGS+=( | |
--disable-external-miniupnpc | |
--disable-external-natpmp | |
) | |
fi | |
fi | |
./configure "${CONFIGURE_ARGS[@]}" | |
${MAKE_CMD} -j${NCPU} V=1 | |
# A third way to build the Qt client, using "qmake". | |
if [[ "${{ runner.os }}" != "macOS" ]]; then | |
${MAKE_CMD} -C qt clean | |
${MAKE_CMD} -j${NCPU} V=1 -C qt qmake-build | |
fi | |
# Tests. | |
# (random failure on Windows if we enable Make's parallelism here) | |
${MAKE_CMD} V=1 -C libtransmission check || { cat libtransmission/test-suite.log; exit 1; } | |
fi # Autotools |