Skip to content

test: Don't check .ltrans0.ltrans.su files in -flto tests #1273

test: Don't check .ltrans0.ltrans.su files in -flto tests

test: Don't check .ltrans0.ltrans.su files in -flto tests #1273

Workflow file for this run

name: Build
on:
push:
pull_request:
workflow_dispatch:
inputs:
test_tag:
description: 'Optional tag name to simulate release'
required: false
env:
CTEST_OUTPUT_ON_FAILURE: ON
VERBOSE: 1
defaults:
run:
shell: bash
permissions:
contents: read
jobs:
build_and_test:
timeout-minutes: 30
env:
CMAKE_GENERATOR: Ninja
name: ${{ matrix.os }}-${{ matrix.compiler }}-${{ matrix.version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04
compiler: gcc
version: "11"
- os: ubuntu-22.04
compiler: clang
version: "14"
- os: ubuntu-22.04-arm
compiler: gcc
version: "11"
- os: ubuntu-24.04
compiler: gcc
version: "13"
- os: ubuntu-24.04
compiler: gcc
version: "14"
- os: ubuntu-24.04
compiler: clang
version: "18"
- os: ubuntu-24.04-arm
compiler: gcc
version: "13"
- os: macOS-14
compiler: xcode
version: "15.4"
- os: macOS-15
compiler: xcode
version: "16.4"
- os: macOS-26
compiler: xcode
version: "26.2"
steps:
- name: Install dependencies on Linux
if: runner.os == 'Linux'
run: |
sudo apt-get update
cmake_params=(-D CMAKE_BUILD_TYPE=CI)
packages=(
elfutils
libhiredis-dev
libzstd-dev
python3
redis-server
redis-tools
)
# Install ld.gold (binutils) and ld.lld (lld) on different runs.
if [ "${{ matrix.os }}" = "ubuntu-22.04" ]; then
packages+=(binutils)
else
packages+=(lld)
fi
if [ "${{ matrix.os }}" = "ubuntu-22.04" ]; then
packages+=(doctest-dev)
packages+=(libfmt-dev)
packages+=(libxxhash-dev)
else
cmake_params+=(-D DEP_DOCTEST=DOWNLOAD)
cmake_params+=(-D DEP_XXHASH=DOWNLOAD)
fi
sudo apt-get install -y "${packages[@]}"
if [ "${{ matrix.compiler }}" = "gcc" ]; then
echo "CC=gcc-${{ matrix.version }}" >> $GITHUB_ENV
echo "CXX=g++-${{ matrix.version }}" >> $GITHUB_ENV
sudo apt-get install -y g++-${{ matrix.version }}
if [ "${{ !endsWith(matrix.os, '-arm') }}" = "true" ]; then
# The -multilib packages are only available on x86.
sudo apt-get install -y g++-${{ matrix.version }}-multilib
fi
else
echo "CC=clang-${{ matrix.version }}" >> $GITHUB_ENV
echo "CXX=clang++-${{ matrix.version }}" >> $GITHUB_ENV
sudo apt-get install -y clang-${{ matrix.version }} g++-multilib lld-${{ matrix.version }}
fi
case "${{ matrix.os }}" in
ubuntu-*)
cmake_params+=(-D DEPS=LOCAL)
;;
*)
;;
esac
echo "CMAKE_PARAMS=${cmake_params[*]}" >> $GITHUB_ENV
- name: Install dependencies on macOS
if: runner.os == 'macOS'
run: |
HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALL_CLEANUP=1 \
brew install hiredis redis
if [ "${{ matrix.compiler }}" = "gcc" ]; then
brew install gcc@${{ matrix.version }}
echo "CC=gcc-${{ matrix.version }}" >> $GITHUB_ENV
echo "CXX=g++-${{ matrix.version }}" >> $GITHUB_ENV
else
sudo xcode-select -switch /Applications/Xcode_${{ matrix.version }}.app
echo "CC=clang" >> $GITHUB_ENV
echo "CXX=clang++" >> $GITHUB_ENV
fi
- name: Get source
uses: actions/checkout@v4
- name: Build and test
run: ci/build
- name: Collect testdir from failed tests
if: failure()
run: ci/collect-testdir
- name: Upload testdir from failed tests
if: failure()
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-${{ matrix.compiler }}-${{ matrix.version }}-testdir.tar.xz
path: testdir.tar.xz
build_and_test_msys:
timeout-minutes: 30
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- sys: mingw64
compiler: gcc
os: windows-2025
- sys: mingw64
compiler: clang
extra_cmake_params: -DCMAKE_CXX_FLAGS=-Wno-deprecated # doctest issue #900
os: windows-2025
- sys: clangarm64
compiler: clang
extra_cmake_params: -DENABLE_TESTING=OFF # occasionally crashes with "Exception: SegFault"
os: windows-11-arm
name: 'Windows MSYS2 ${{ matrix.sys }} ${{ matrix.compiler }}'
defaults:
run:
shell: msys2 {0}
steps:
- name: '${{ matrix.sys }} Set up MSYS2'
uses: msys2/setup-msys2@v2
with:
msystem: ${{matrix.sys}}
update: true
install: >-
git
diffutils
tar
pacboy: >-
toolchain:p
cmake:p
ninja:p
hiredis:p
lld:p
${{matrix.compiler}}:p
- name: Set up environment
run: |
if [ "${{ matrix.compiler }}" = "gcc" ]; then
echo "CC=gcc" >> $GITHUB_ENV
echo "CXX=g++" >> $GITHUB_ENV
else
echo "CC=clang" >> $GITHUB_ENV
echo "CXX=clang++" >> $GITHUB_ENV
fi
cmake_params=(-DCMAKE_BUILD_TYPE=CI)
cmake_params+=(${{matrix.extra_cmake_params}})
echo "CMAKE_PARAMS=${cmake_params[*]}" >> $GITHUB_ENV
- name: Get source
uses: actions/checkout@v4
- name: Build and test
run: ci/build
continue-on-error: ${{ matrix.allow_test_failures == true &&
steps.build-and-test.outputs.exit_status == 8 }}
env:
CMAKE_GENERATOR: Ninja
TEST_CC: ${{ matrix.compiler }}
- name: Collect testdir from failed tests
if: failure()
run: ci/collect-testdir
- name: Upload testdir from failed tests
if: failure()
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.sys }}-${{ matrix.compiler }}-testdir.tar.xz
path: testdir.tar.xz
build_documentation:
timeout-minutes: 30
name: Documentation
runs-on: ubuntu-24.04
env:
CMAKE_GENERATOR: Ninja
steps:
- name: Get source
uses: actions/checkout@v4
- name: Prepare environment
run: |
sudo apt-get install -y asciidoctor pandoc
- name: Build documentation
run: ci/build-docs
- name: Upload documentation
uses: actions/upload-artifact@v4
with:
name: docs
path: |
doc/install.md
GPL-3.0.txt
install
README.md
build_linux_aarch64_binary_glibc:
timeout-minutes: 30
name: Linux aarch64 binary (glibc)
runs-on: ubuntu-22.04
strategy:
fail-fast: false
steps:
- name: Prepare environment
run: |
sudo apt-get update
sudo apt-get install -y g++-aarch64-linux-gnu libc6-dev-arm64-cross
- name: Get source
uses: actions/checkout@v4
- name: Build binary
env:
CMAKE_GENERATOR: Ninja
CMAKE_PARAMS: |
-D CMAKE_TOOLCHAIN_FILE=../toolchains/aarch64-linux-gnu.cmake
-D CMAKE_EXE_LINKER_FLAGS_INIT=-static-libstdc++
run: ci/build-binary
- name: Upload binary
uses: actions/upload-artifact@v4
with:
name: linux-aarch64-glibc-binary
path: install/ccache
retention-days: 3
build_linux_x86_64_binary_glibc:
timeout-minutes: 30
name: Linux x86_64 binary (glibc)
runs-on: ubuntu-22.04
container:
image: almalinux:8
strategy:
fail-fast: false
steps:
- name: Prepare environment
run: |
dnf install -y dnf-plugins-core
dnf config-manager --set-enabled powertools
dnf install -y epel-release
dnf install -y \
--setopt=install_weak_deps=False \
--setopt=tsflags=nodocs \
cmake \
gcc \
gcc-c++ \
gcc-toolset-11 \
git \
ninja-build
- name: Get source
uses: actions/checkout@v4
- name: Build binary
env:
CMAKE_GENERATOR: Ninja
CMAKE_PARAMS: -D CMAKE_EXE_LINKER_FLAGS_INIT=-static-libstdc++
run: |
scl enable gcc-toolset-11 ci/build-binary
- name: Upload binary
uses: actions/upload-artifact@v4
with:
name: linux-x86_64-glibc-binary
path: install/ccache
retention-days: 3
build_linux_musl_static_binary:
timeout-minutes: 30
name: Linux ${{ matrix.arch }} binary (musl static)
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- arch: aarch64
runner: ubuntu-22.04-arm
- arch: x86_64
runner: ubuntu-22.04
steps:
- name: Get source
uses: actions/checkout@v4
- name: Build in Alpine container
run: |
docker run --rm -v "$PWD:/work" -w /work \
-e GITHUB_REF \
-e GITHUB_REF_NAME \
-e GITHUB_SHA \
alpine:3.23 sh -c '
apk add --no-cache bash cmake g++ gcc git hiredis-dev make ninja xxhash-dev zstd-dev
CMAKE_GENERATOR=Ninja CMAKE_PARAMS="-D CMAKE_EXE_LINKER_FLAGS_INIT=-static" ci/build-binary
'
- name: Upload binary
uses: actions/upload-artifact@v4
with:
name: linux-${{ matrix.arch }}-musl-static-binary
path: install/ccache
retention-days: 3
build_darwin_binary:
timeout-minutes: 30
name: Build Darwin (macOS) binary
runs-on: macos-15
env:
CMAKE_GENERATOR: Ninja
steps:
- name: Get source
uses: actions/checkout@v4
- name: Build Darwin binary
run: ci/build-darwin-binary
- name: Upload binary
uses: actions/upload-artifact@v4
with:
name: darwin-binary
path: install/ccache
retention-days: 3
build_windows_binary:
timeout-minutes: 30
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
include:
# - arch: i686
# toolchain: i686-w64-mingw32-posix
# apt_get: g++-mingw-w64-i686-posix
- arch: x86_64
toolchain: x86_64-w64-mingw32-posix
apt_get: g++-mingw-w64-x86-64-posix
- arch: aarch64
toolchain: aarch64-w64-mingw32
llvm_mingw: true
name: Windows ${{ matrix.arch }} binary
steps:
- name: Run apt-get
if: matrix.apt_get != ''
run: sudo apt-get update && sudo apt-get install ${{ matrix.apt_get }}
- name: Install llvm-mingw
if: matrix.llvm_mingw != ''
env:
TOOLCHAIN_URL_PREFIX: "https://github.com/mstorsjo/llvm-mingw/releases/download/20250709/"
TOOLCHAIN_FILENAME: "llvm-mingw-20250709-ucrt-ubuntu-22.04-x86_64.tar.xz"
TOOLCHAIN_SHA256: "60cafae6474c7411174cff1d4ba21a8e46cadbaeb05a1bace306add301628337"
run: |
curl -LO ${TOOLCHAIN_URL_PREFIX}${TOOLCHAIN_FILENAME}
echo ${TOOLCHAIN_SHA256} ${TOOLCHAIN_FILENAME} | sha256sum -c
tar -xf ${TOOLCHAIN_FILENAME}
rm ${TOOLCHAIN_FILENAME}
sudo mkdir -p /opt
sudo mv $(basename ${TOOLCHAIN_FILENAME} .tar.xz) /opt/llvm-mingw
echo /opt/llvm-mingw/bin >>${GITHUB_PATH}
- name: Get source
uses: actions/checkout@v4
- name: Build binary
env:
CMAKE_PARAMS: -D CMAKE_TOOLCHAIN_FILE=../toolchains/${{ matrix.toolchain }}.cmake
run: ci/build-binary
- name: Upload binary
uses: actions/upload-artifact@v4
with:
name: windows-${{ matrix.arch }}-binary
path: install/ccache.exe
retention-days: 3
windows_tests:
timeout-minutes: 30
name: Windows integration tests
runs-on: windows-2022
steps:
- name: Get source
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install pytest
run: pip install pytest
- name: Build ccache
shell: cmd
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
cmake -S . -B build-win64 -G Ninja -DCMAKE_BUILD_TYPE=Release
ninja -C build-win64 ccache
- name: Run MSVC integration tests
shell: cmd
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
pytest test/msvc/ --ccache "%GITHUB_WORKSPACE%/build-win64/ccache.exe" -v
specific_tests:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: Linux GCC debug + in source
os: ubuntu-22.04
CC: gcc
CXX: g++
BUILDDIR: .
CCACHE_LOC: .
CMAKE_PARAMS: -DCMAKE_BUILD_TYPE=Debug
apt_get: elfutils libhiredis-dev libzstd-dev
- name: Linux GCC 32-bit
os: ubuntu-22.04
CC: gcc
CXX: g++
CFLAGS: -m32 -g -O2
CXXFLAGS: -m32 -g -O2
LDFLAGS: -m32
CMAKE_PARAMS: -DCMAKE_BUILD_TYPE=CI -D DEPS=AUTO
apt_get: elfutils gcc-multilib g++-multilib lib32stdc++-10-dev
- name: Linux GCC CUDA
os: ubuntu-22.04
CC: gcc
CXX: g++
CMAKE_PARAMS: -DCMAKE_BUILD_TYPE=CI
CUDA: 11.7.0-1
apt_get: elfutils libhiredis-dev libzstd-dev
- name: Linux MinGW 32-bit
os: ubuntu-22.04
CMAKE_PARAMS: -DCMAKE_BUILD_TYPE=CI -D CMAKE_TOOLCHAIN_FILE=../toolchains/i686-w64-mingw32-posix.cmake
RUN_TESTS: none
apt_get: elfutils mingw-w64
- name: Linux MinGW 64-bit
os: ubuntu-22.04
CMAKE_PARAMS: -DCMAKE_BUILD_TYPE=CI -D CMAKE_TOOLCHAIN_FILE=../toolchains/x86_64-w64-mingw32-posix.cmake
RUN_TESTS: unittest-in-wine
apt_get: elfutils mingw-w64 wine
- name: Windows VS2022 32-bit
os: windows-2022
msvc_arch: x64_x86
allow_test_failures: true # For now, don't fail the build on failure
CC: cl
CXX: cl
CMAKE_GENERATOR: Visual Studio 17 2022
CMAKE_PARAMS: -DCMAKE_BUILD_TYPE=CI -A Win32
TEST_CC: clang -target i686-pc-windows-msvc
- name: Windows VS2022 64-bit
os: windows-2022
msvc_arch: x64
allow_test_failures: true # For now, don't fail the build on failure
CC: cl
CXX: cl
CMAKE_GENERATOR: Visual Studio 17 2022
CMAKE_PARAMS: -DCMAKE_BUILD_TYPE=CI -A x64
TEST_CC: clang -target x86_64-pc-windows-msvc
- name: Windows VS2022 ARM64
os: windows-11-arm
msvc_arch: ARM64
allow_test_failures: true # For now, don't fail the build on failure
CC: cl
CXX: cl
CMAKE_GENERATOR: Visual Studio 17 2022
CMAKE_PARAMS: -DCMAKE_BUILD_TYPE=CI -DZSTD_FROM_INTERNET=ON -DHIREDIS_FROM_INTERNET=ON -A ARM64
TEST_CC: clang -target aarch64-pc-windows-msvc
- name: Clang address & UB sanitizer
os: ubuntu-22.04
CC: clang
CXX: clang++
CMAKE_PARAMS: -DCMAKE_BUILD_TYPE=CI -DENABLE_SANITIZER_ADDRESS=ON -DENABLE_SANITIZER_UNDEFINED_BEHAVIOR=ON
ASAN_OPTIONS: detect_leaks=0
apt_get: elfutils libzstd-dev libhiredis-dev
- name: Clang static analyzer
os: ubuntu-22.04
CC: clang
CXX: clang++
CMAKE_PREFIX: scan-build
RUN_TESTS: none
apt_get: libzstd-dev libhiredis-dev
- name: Linux binary
os: ubuntu-22.04
CC: gcc
CXX: g++
SPECIAL: build-and-verify-package
CMAKE_PARAMS: -DCMAKE_BUILD_TYPE=Release
apt_get: elfutils libzstd-dev libhiredis-dev
- name: Source package
os: ubuntu-22.04
CC: gcc
CXX: g++
SPECIAL: build-and-verify-source-package
apt_get: elfutils libzstd-dev libhiredis-dev asciidoctor
- name: Clang-Tidy
os: ubuntu-22.04
CC: clang-13
CXX: clang++-13
RUN_TESTS: none
CMAKE_PARAMS: -DENABLE_CLANG_TIDY=ON -DCLANGTIDY=/usr/bin/clang-tidy-13
apt_get: libzstd-dev libhiredis-dev clang-13 clang-tidy-13
steps:
- name: Get source
uses: actions/checkout@v4
- name: Install CUDA
if: matrix.CUDA != ''
run: sudo --preserve-env=CUDA,GITHUB_PATH ci/install-cuda
env:
CUDA: ${{ matrix.CUDA }}
- name: Run apt-get
if: matrix.apt_get != ''
run: sudo apt-get update && sudo apt-get install ${{ matrix.apt_get }}
- name: Prepare Windows environment (Visual Studio)
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1.12.0
with:
arch: ${{ matrix.msvc_arch }}
- name: Prepare Windows environment (Clang)
if: runner.os == 'Windows'
shell: powershell
run: |
$ErrorActionPreference = 'Stop'
# The test suite currently requires that the compiler specified by the
# "CC" environment variable is on a path without spaces. Provide that
# by creating a junction from ~/opt/llvm to the Visual Studio path.
$null = New-Item `
-Path "${HOME}\opt\llvm" `
-ItemType Junction `
-Target "${env:VCINSTALLDIR}\Tools\Llvm\x64" `
-Force
"Path=${HOME}\opt\llvm\bin;${env:Path}" | `
Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Build and test
id: build-and-test
env:
ASAN_OPTIONS: ${{ matrix.ASAN_OPTIONS }}
BUILDDIR: ${{ matrix.BUILDDIR }}
CC: ${{ matrix.CC }}
CCACHE_LOC: ${{ matrix.CCACHE_LOC }}
CFLAGS: ${{ matrix.CFLAGS }}
CMAKE_GENERATOR: ${{ matrix.CMAKE_GENERATOR }}
CMAKE_PARAMS: ${{ matrix.CMAKE_PARAMS }}
CXX: ${{ matrix.CXX }}
CXXFLAGS: ${{ matrix.CXXFLAGS }}
EXTRA_CMAKE_BUILD_FLAGS: ${{ matrix.EXTRA_CMAKE_BUILD_FLAGS }}
LDFLAGS: ${{ matrix.LDFLAGS }}
RUN_TESTS: ${{ matrix.RUN_TESTS }}
SPECIAL: ${{ matrix.SPECIAL }}
TEST_CC: ${{ matrix.TEST_CC }}
run: |
rc=0
ci/build || rc=$?
echo "exit_status=$rc" >> $GITHUB_OUTPUT
exit $rc
# CTest exits with return code 8 on test failure.
continue-on-error: ${{ matrix.allow_test_failures == true &&
steps.build-and-test.outputs.exit_status == 8 }}
- name: Collect testdir from failed tests
if: failure() || steps.build-and-test.outcome == 'failure'
run: ci/collect-testdir
# TODO: in case of build-and-verify-*package the BUILDDIR is set within those scripts.
- name: Upload testdir from failed tests
if: failure() || steps.build-and-test.outcome == 'failure'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }} - testdir.tar.xz
path: testdir.tar.xz
build_release:
name: Build release
needs:
- build_darwin_binary
- build_documentation
- build_linux_aarch64_binary_glibc
- build_linux_musl_static_binary
- build_linux_x86_64_binary_glibc
- build_windows_binary
runs-on: ubuntu-24.04
steps:
- name: Prepare environment
run: |
sudo apt-get update
sudo apt-get install -y minisign
- name: Get source
uses: actions/checkout@v4
- name: Download binaries
uses: actions/download-artifact@v5
with:
pattern: "*-binary"
- name: Download docs
uses: actions/download-artifact@v5
with:
pattern: docs
path: docs
- name: Build release
run: ci/prepare-release
- name: Sign release archives
if: env.MINISIGN_KEY != ''
env:
MINISIGN_KEY: ${{ secrets.MINISIGN_KEY }}
run: |
mkdir -p ~/.minisign
echo "${MINISIGN_KEY}" | base64 -d > ~/.minisign/minisign.key
minisign -Sm release/*
- name: Upload release
uses: actions/upload-artifact@v4
if: ${{ github.ref_type == 'tag' || github.event.inputs.test_tag != '' }}
with:
name: release
path: release
retention-days: 3
create_release:
name: Create release
needs:
- build_release
permissions:
contents: write
if: ${{ github.ref_type == 'tag' || github.event.inputs.test_tag != '' }}
runs-on: ubuntu-24.04
steps:
- name: Get source
uses: actions/checkout@v4
- name: Download release
uses: actions/download-artifact@v5
with:
name: release
path: release
- name: Create release notes
run: |
TAG_NAME="${{ github.event.inputs.test_tag || github.ref_name }}"
ci/generate-release-notes "${TAG_NAME}" >release-notes.md
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG_NAME="${{ github.event.inputs.test_tag || github.ref_name }}"
gh release create "${TAG_NAME}" \
--draft \
--notes-file release-notes.md \
--title "${TAG_NAME#v*}" \
release/*
check_format:
timeout-minutes: 30
name: Code formatting
runs-on: ubuntu-22.04
strategy:
fail-fast: false
steps:
- name: Get source
uses: actions/checkout@v4
- name: Run Clang-Format in check mode
run: misc/format-files --all --check
spelling:
timeout-minutes: 30
name: Spelling
runs-on: ubuntu-22.04
strategy:
fail-fast: false
steps:
- name: Get source
uses: actions/checkout@v4
- name: Install spell checkers
run: |
sudo apt-get update
sudo apt-get install python3-pip
pip3 install codespell==2.4.1 typos==1.35.6
- name: Run codespell
run: codespell -q 7 -S ".git,build*,./misc/typos.toml,./src/third_party/*" -I misc/codespell-allowlist.txt
- name: Run typos
run: typos -c misc/typos.toml