Skip to content

Commit

Permalink
Merge branch 'tls' into feature/listen-to-both-ipv4-and-ipv6
Browse files Browse the repository at this point in the history
  • Loading branch information
badaix authored Dec 21, 2024
2 parents 3ab0051 + be77ddb commit dde2d25
Show file tree
Hide file tree
Showing 83 changed files with 6,429 additions and 19,144 deletions.
26 changes: 4 additions & 22 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,30 +1,11 @@
---
# Checks: '*,clang-diagnostic-*,clang-analyzer-*'
Checks: '*,-llvmlibc-*,-readability-braces-around-statements,-hicpp-braces-around-statements,-google-readability-braces-around-statements,-hicpp-no-array-decay,-fuchsia-default-arguments-calls,-modernize-use-trailing-return-type,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-avoid-magic-numbers,-readability-magic-numbers,-bugprone-lambda-function-name,-hicpp-signed-bitwise,-cert-err60-cpp,-cppcoreguidelines-pro-type-reinterpret-cast,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-init-variables,-cppcoreguidelines-no-malloc,-hicpp-no-malloc,-google-readability-todo,-modernize-pass-by-value,-cppcoreguidelines-pro-type-member-init,-hicpp-member-init,-hicpp-avoid-c-arrays,-cppcoreguidelines-avoid-c-arrays,-modernize-avoid-c-arrays,-abseil-string-find-startswith,-google-build-using-namespace,-cppcoreguidelines-owning-memory,-readability-else-after-return,-cppcoreguidelines-pro-type-vararg,-hicpp-vararg,-readability-isolate-declaration,-cert-env33-c,-abseil-*'
# Checks: '*,clang-diagnostic-*,clang-analyzer-*'
# Checks: '*,-llvmlibc-restrict-system-libc-headers,-readability-braces-around-statements,-hicpp-braces-around-statements,-google-readability-braces-around-statements,-hicpp-no-array-decay,-fuchsia-default-arguments-calls,-modernize-use-trailing-return-type,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-avoid-magic-numbers,-readability-magic-numbers,-bugprone-lambda-function-name,-hicpp-signed-bitwise,-cert-err60-cpp,-cppcoreguidelines-pro-type-reinterpret-cast,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-init-variables,-cppcoreguidelines-no-malloc,-hicpp-no-malloc,-google-readability-todo,-modernize-pass-by-value,-cppcoreguidelines-pro-type-member-init,-hicpp-member-init,-hicpp-avoid-c-arrays,-cppcoreguidelines-avoid-c-arrays,-modernize-avoid-c-arrays,-abseil-string-find-startswith,-google-build-using-namespace,-cppcoreguidelines-owning-memory,-readability-else-after-return,-cppcoreguidelines-pro-type-vararg,-hicpp-vararg,-readability-isolate-declaration'
Checks: 'clang-diagnostic-*,clang-analyzer-*,modernize*,performance*,readability-*size*,readability*redundant*,-readability-redundant-member-init,-readability-redundant-access-specifiers,misc*,boost-use-to-string,cert*,google-runtime-member-string-references,google-explicit-constructor,-cert-err58-cpp,-modernize-concat-nested-namespaces,-modernize-use-nodiscard,-misc-non-private-member-variables-in-classes,-modernize-use-trailing-return-type,-misc-no-recursion,-misc-const-correctness,-misc-use-anonymous-namespace'
WarningsAsErrors: ''
HeaderFilterRegex: ''
AnalyzeTemporaryDtors: false
FormatStyle: none
FormatStyle: file
User: johannes
CheckOptions:
- key: cert-dcl16-c.NewSuffixes
value: 'L;LL;LU;LLU'
- key: cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField
value: '0'
- key: cppcoreguidelines-explicit-virtual-functions.IgnoreDestructors
value: '1'
- key: cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
value: '1'
- key: google-readability-braces-around-statements.ShortStatementLines
value: '1'
- key: google-readability-function-size.StatementThreshold
value: '800'
- key: google-readability-namespace-comments.ShortNamespaceLines
value: '10'
- key: google-readability-namespace-comments.SpacesBeforeComments
value: '2'
- key: modernize-loop-convert.MaxCopySize
value: '16'
- key: modernize-loop-convert.MinConfidence
Expand All @@ -37,5 +18,6 @@ CheckOptions:
value: llvm
- key: modernize-use-nullptr.NullMacros
value: 'NULL'
- key: hicpp-signed-bitwise.IgnorePositiveIntegerLiterals
value: '1'
...

7 changes: 7 additions & 0 deletions .clangd
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
InlayHints:
Enabled: Yes
ParameterNames: No
DeducedTypes: No
Diagnostics:
UnusedIncludes: Strict
MissingIncludes: None
138 changes: 116 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
pull_request:

env:
BOOST_VERSION: 1_85_0
BOOST_VERSION: 1_87_0

jobs:
static-analysis:
Expand All @@ -16,14 +16,18 @@ jobs:
tool:
- cppcheck

runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v4
- name: print environment
run: env
- name: dependencies
run: sudo apt-get update && sudo apt-get install -yq libasound2-dev libsoxr-dev libvorbisidec-dev libvorbis-dev libflac-dev libopus-dev alsa-utils libpulse-dev libavahi-client-dev avahi-daemon debhelper ccache expat cppcheck
run: |
sudo apt-get update && \
sudo apt-get install -yq libasound2-dev libsoxr-dev libvorbisidec-dev libvorbis-dev libflac-dev \
libopus-dev alsa-utils libpulse-dev libavahi-client-dev libssl-dev \
avahi-daemon debhelper ccache expat cppcheck
- name: cache boost
id: cache-boost
uses: actions/cache@v4
Expand All @@ -39,7 +43,7 @@ jobs:
- name: configure
run: |
cmake -S . -B build \
-DWERROR=ON -DBUILD_TESTS=ON \
-DWERROR=ON -DBUILD_TESTS=OFF \
-DBOOST_ROOT=boost_${BOOST_VERSION} \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_EXPORT_COMPILE_COMMANDS=TRUE \
Expand All @@ -48,6 +52,100 @@ jobs:
run: cmake --build build --target ${{ matrix.tool }}


documentation:

# TODO: Fail in case of (too many) warnings, upload artifacts
strategy:
fail-fast: false

runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v4
- name: print environment
run: env
- name: dependencies
run: |
sudo apt-get update && \
sudo apt-get install -yq libasound2-dev libsoxr-dev libvorbisidec-dev libvorbis-dev libflac-dev \
libopus-dev alsa-utils libpulse-dev libavahi-client-dev libssl-dev \
avahi-daemon debhelper ccache expat cppcheck doxygen graphviz
- name: doxygen
run: |
mkdir -p build/doxygen
doxygen 2>&1 | tee build/doxygen.log
WARNINGS=$(cat build/doxygen.log | sort | uniq | grep -e ": warning: " | wc -l)
MAX_ALLOWED=775
echo "Doxygen finished with $WARNINGS warnings, max allowed: $MAX_ALLOWED"
if [ "$WARNINGS" -gt "$MAX_ALLOWED" ]; then exit $WARNINGS; else exit 0; fi;
unit-test:

strategy:
fail-fast: false
matrix:
sanitizer:
- asan
- tsan
include:
- sanitizer: asan
param: "ASAN=ON"
- sanitizer: tsan
param: "TSAN=ON"

runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v4
- name: print environment
run: env
- name: dependencies
run: |
sudo apt-get update && \
sudo apt-get install -yq libasound2-dev libsoxr-dev libvorbisidec-dev libvorbis-dev libflac-dev \
libopus-dev alsa-utils libpulse-dev libavahi-client-dev libssl-dev \
avahi-daemon debhelper ccache expat
- name: cache boost
id: cache-boost
uses: actions/cache@v4
with:
path: boost_${{ env.BOOST_VERSION }}
key: boost-${{ env.BOOST_VERSION }}
enableCrossOsArchive: true
- name: get boost
if: steps.cache-boost.outputs.cache-hit != 'true'
run: |
wget https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION//_/.}/source/boost_${BOOST_VERSION}.tar.bz2
tar xjf boost_${BOOST_VERSION}.tar.bz2
- name: cache ccache
id: cache-ccache
uses: actions/cache@v4
with:
# TODO: use environment variable $HOME/.ccache
path: /home/runner/.ccache
key: ${{ matrix.sanitizer }}-ccache-${{ github.sha }}
restore-keys: ${{ matrix.sanitizer }}-ccache-
- name: configure
run: |
cmake -S . -B build \
-DWERROR=ON \
-DBUILD_TESTS=ON \
-D${{ matrix.param }} \
-DBOOST_ROOT=boost_${BOOST_VERSION} \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_EXPORT_COMPILE_COMMANDS=TRUE \
-DCMAKE_CXX_FLAGS="-DCMAKE_CXX_FLAGS=-DJSON_HAS_CPP_14"
- name: build
env:
# TODO: use environment variable $HOME/.ccache
CCACHE_DIR: /home/runner/.ccache
run: cmake --build build --parallel 4 --verbose
- name: unit-test
run: ./bin/snapcast_test


linux:

strategy:
Expand Down Expand Up @@ -186,11 +284,6 @@ jobs:
fail-fast: false
matrix:
xcode:
- "13.1"
- "13.2"
- "13.3"
- "13.4"
- "14.0"
- "14.1"
- "14.2"
- "14.3"
Expand All @@ -199,23 +292,16 @@ jobs:
- "15.2"
- "15.3"
- "15.4"
- "16.0"
- "16.1"
- "16.2"
include:
- xcode: "13.1"
os: macos-12
- xcode: "13.2"
os: macos-12
- xcode: "13.3"
os: macos-12
- xcode: "13.4"
os: macos-12
- xcode: "14.0"
os: macos-12
- xcode: "14.1"
os: macos-13
- xcode: "14.2"
os: macos-13
- xcode: "14.3"
os: macos-14
os: macos-13
- xcode: "15.0"
os: macos-14
- xcode: "15.1"
Expand All @@ -225,7 +311,13 @@ jobs:
- xcode: "15.3"
os: macos-14
- xcode: "15.4"
os: macos-14
os: macos-15
- xcode: "16.0"
os: macos-15
- xcode: "16.1"
os: macos-15
- xcode: "16.2"
os: macos-15

runs-on: ${{ matrix.os }}

Expand All @@ -234,7 +326,9 @@ jobs:
- name: print environment
run: env
- name: dependencies
run: brew install pkgconfig libsoxr flac libvorbis opus ccache expat
run: |
brew update
brew install pkgconfig libsoxr flac libvorbis opus ccache expat
- name: cache boost
id: cache-boost
uses: actions/cache@v4
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ permissions:
contents: write

env:
BOOST_VERSION: 1_85_0
BOOST_VERSION: 1_87_0
SNAPWEB_VERSION: v0.8.0

jobs:
Expand Down Expand Up @@ -72,7 +72,12 @@ jobs:
image: ${{matrix.image_prefix}}${{matrix.debian}}
steps:
- name: Get dependencies
run: apt-get update && apt-get install -yq wget debhelper build-essential cmake git rename libatomic1 libasound2-dev libsoxr-dev libvorbisidec-dev libvorbis-dev libflac-dev libopus-dev alsa-utils libpulse-dev libavahi-client-dev avahi-daemon libexpat1-dev python3 ccache unzip
run: |
apt-get update && \
apt-get install -yq wget debhelper build-essential cmake git rename \
libatomic1 libasound2-dev libsoxr-dev libvorbisidec-dev libvorbis-dev libflac-dev \
libopus-dev alsa-utils libpulse-dev libavahi-client-dev avahi-daemon libexpat1-dev \
libssl-dev python3 ccache unzip
env:
DEBIAN_FRONTEND: noninteractive
- name: Get GitHub cli
Expand Down Expand Up @@ -239,7 +244,6 @@ jobs:
# - name: build
# run: cmake --build build --parallel 3


# rpm:
# if: ${{ false }} # disable for now
# strategy:
Expand Down
15 changes: 11 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.14)

# find_package() uses uppercase <PackageName>_ROOT variables.
if(POLICY CMP0144)
cmake_policy(SET CMP0144 NEW)
endif()

project(
snapcast
Expand Down Expand Up @@ -64,12 +69,12 @@ else()
endif()

if(ASAN)
add_compile_options(-fsanitize=address)
add_compile_options(-fsanitize=address -Wno-error=maybe-uninitialized)
add_link_options(-fsanitize=address)
endif()

if(TSAN)
add_compile_options(-fsanitize=thread)
add_compile_options(-fsanitize=thread -Wno-error=tsan)
add_link_options(-fsanitize=thread)
endif()

Expand Down Expand Up @@ -172,6 +177,8 @@ endif()

find_package(Threads REQUIRED)

find_package(OpenSSL REQUIRED)

include(CMakePushCheckState)
include(CheckIncludeFileCXX)
include_directories(${INCLUDE_DIRS})
Expand Down Expand Up @@ -363,7 +370,7 @@ if(WIN32)
WINDOWS
WIN32_LEAN_AND_MEAN
UNICODE
_UNICODE
# _UNICODE
_CRT_SECURE_NO_WARNINGS)
add_compile_definitions(
HAS_OGG
Expand Down
Loading

0 comments on commit dde2d25

Please sign in to comment.