Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
radistmorse authored Dec 4, 2024
2 parents db8d71f + f457fd3 commit 4fd653a
Show file tree
Hide file tree
Showing 159 changed files with 11,828 additions and 1,893 deletions.
4 changes: 4 additions & 0 deletions .clang-format-ignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@
subprojects/**
src/common/eventmeth.cc
include/pistache/eventmeth.h
include/pistache/emosandlibevdefs.h
src/common/pist_timelog.cc
include/pistache/pist_timelog.h
src/common/pist_check.cc
include/pistache/pist_check.h
src/common/pist_syslog.cc
include/pistache/pist_syslog.h
src/common/ps_strl.cc
include/pistache/ps_strl.h
include/pistache/winornix.h
23 changes: 20 additions & 3 deletions .github/workflows/linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,29 @@ jobs:
run: |
if [ ${{ matrix.compiler }} = gcc ]; then compiler=g++; else compiler="clang lld ?exact-name(libclang-rt-dev)"; fi
apt -y update
apt -y install $compiler meson pkg-config cmake rapidjson-dev libssl-dev netbase '?exact-name(libhowardhinnant-date-dev)' '?exact-name(libgmock-dev) (?version([1-9]\.[1-9][1-9]) | ?version([1-9]\.[2-9][0-9]))' '?exact-name(libcpp-httplib-dev)' libcurl4-openssl-dev git ca-certificates curl gpg gpgv gpg-agent lcov llvm-dev --no-install-recommends
apt -y install $compiler meson pkg-config cmake brotli libbrotli-dev zstd libzstd-dev rapidjson-dev libssl-dev netbase '?exact-name(libhowardhinnant-date-dev)' '?exact-name(libgmock-dev) (?version([1-9]\.[1-9][1-9]) | ?version([1-9]\.[2-9][0-9]))' '?exact-name(libcpp-httplib-dev)' libcurl4-openssl-dev git ca-certificates curl gpg gpgv gpg-agent lcov llvm-dev --no-install-recommends
# Periodically, debian:testing fails with clang, saying that
# libstdc++ cannot be found. In debian:testing/clang, normally
# libstdc++-dev is installed as a dependency of meson. In the
# situation where the build breaks, the meson dependency is
# different to the latest available libstdc++; for instance,
# installing meson dependencies might install
# libstdc++-13-dev, whereas apt has access to
# libstdc++-14-dev. In other situations, the meson dependency
# libstdc++-..-dev may be the same as the latest
# libstdc++-..-dev to which apt has access.
#
# To prevent the build breaking, we need to install the latest
# libstdc++-..-dev to which apt has access - not the N-1
# version which may be installed as a meson dependency.
if [ ${{ matrix.compiler }} = clang ] && [ ${{ matrix.os == 'debian:testing' }} ]; then libstdcpp_latest=$(apt-cache search "libstdc++" | grep "libstdc++-..-dev " | sort -r | head -c 16); libstdcpp_latest_fst9=$(echo "${libstdcpp_latest}" | head -c 9); libstdcpp_latest_lst3=$(echo "${libstdcpp_latest}" | tail -c 4 | head -c 3); if [ ${libstdcpp_latest_fst9} = "libstdc++" ] && [ ${libstdcpp_latest_lst3} = "dev" ]; then apt -y install ${libstdcpp_latest} --no-install-recommends; fi; fi
- name: Install dependencies (Red Hat)
if: contains(matrix.os, 'redhat')
run: |
if [ ${{ matrix.compiler }} = gcc ]; then compiler=gcc-c++; else compiler=llvm-toolset; fi
microdnf -y install $compiler pkgconf cmake openssl-devel zlib-devel libcurl-devel git python3-pip unzip
microdnf -y install $compiler lld pkgconf cmake brotli brotli-devel openssl-devel zlib-devel libcurl-devel git python3-pip unzip
curl -LO https://github.com/ninja-build/ninja/releases/latest/download/ninja-linux.zip
unzip ninja-linux.zip
mv ninja /usr/local/bin
Expand All @@ -78,8 +94,9 @@ jobs:
run: |
if [ ${{ matrix.compiler }} = gcc ]; then CXX=g++; else CXX=clang++ CXX_LD=lld; fi
export CXX CXX_LD
if [[ ${{ matrix.os }} == *redhat* ]]; then PST_USE_ZSTD=false; else PST_USE_ZSTD=true; fi
meson setup build \
-DPISTACHE_BUILD_TESTS=true -DPISTACHE_USE_SSL=${{ matrix.tls }} -DPISTACHE_USE_CONTENT_ENCODING_DEFLATE=true \
-DPISTACHE_BUILD_TESTS=true -DPISTACHE_USE_SSL=${{ matrix.tls }} -DPISTACHE_USE_CONTENT_ENCODING_DEFLATE=true -DPISTACHE_USE_CONTENT_ENCODING_BROTLI=true -DPISTACHE_USE_CONTENT_ENCODING_ZSTD=$PST_USE_ZSTD \
--buildtype=debug -Db_coverage=true -Db_sanitize=${{ matrix.sanitizer }} -Db_lundef=false \
|| (cat build/meson-logs/meson-log.txt ; false)
env:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/linuxflibev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ jobs:
run: |
if [ ${{ matrix.compiler }} = gcc ]; then compiler=g++; else compiler="clang lld ?exact-name(libclang-rt-dev)"; fi
apt -y update
apt -y install $compiler meson pkg-config cmake rapidjson-dev libssl-dev libevent-dev netbase '?exact-name(libhowardhinnant-date-dev)' '?exact-name(libgmock-dev) (?version([1-9]\.[1-9][1-9]) | ?version([1-9]\.[2-9][0-9]))' '?exact-name(libcpp-httplib-dev)' libcurl4-openssl-dev git ca-certificates curl gpg gpgv gpg-agent lcov llvm-dev --no-install-recommends
apt -y install $compiler meson pkg-config cmake brotli libbrotli-dev zstd libzstd-dev rapidjson-dev libssl-dev libevent-dev netbase '?exact-name(libhowardhinnant-date-dev)' '?exact-name(libgmock-dev) (?version([1-9]\.[1-9][1-9]) | ?version([1-9]\.[2-9][0-9]))' '?exact-name(libcpp-httplib-dev)' libcurl4-openssl-dev git ca-certificates curl gpg gpgv gpg-agent lcov llvm-dev --no-install-recommends
- name: Install dependencies (Red Hat)
if: contains(matrix.os, 'redhat')
run: |
if [ ${{ matrix.compiler }} = gcc ]; then compiler=gcc-c++; else compiler=llvm-toolset; fi
microdnf -y install $compiler pkgconf cmake openssl-devel zlib-devel libcurl-devel git python3-pip unzip
microdnf -y install $compiler pkgconf cmake brotli libbrotli zstd libzstd openssl-devel zlib-devel libcurl-devel git python3-pip unzip
curl -LO https://github.com/ninja-build/ninja/releases/latest/download/ninja-linux.zip
unzip ninja-linux.zip
mv ninja /usr/local/bin
Expand All @@ -68,7 +68,7 @@ jobs:
if [ ${{ matrix.compiler }} = gcc ]; then CXX=g++; else CXX=clang++ CXX_LD=lld; fi
export CXX CXX_LD
meson setup build \
-DPISTACHE_BUILD_TESTS=true -DPISTACHE_DEBUG=${{ matrix.def_debug }} -DPISTACHE_USE_SSL=${{ matrix.tls }} -DPISTACHE_FORCE_LIBEVENT=${{ matrix.flibev }} -DPISTACHE_USE_CONTENT_ENCODING_DEFLATE=true \
-DPISTACHE_BUILD_TESTS=true -DPISTACHE_DEBUG=${{ matrix.def_debug }} -DPISTACHE_USE_SSL=${{ matrix.tls }} -DPISTACHE_FORCE_LIBEVENT=${{ matrix.flibev }} -DPISTACHE_USE_CONTENT_ENCODING_DEFLATE=true -DPISTACHE_USE_CONTENT_ENCODING_BROTLI=true -DPISTACHE_USE_CONTENT_ENCODING_ZSTD=true \
--buildtype=debug -Db_coverage=true -Db_sanitize=${{ matrix.sanitizer }} -Db_lundef=false \
|| (cat build/meson-logs/meson-log.txt ; false)
env:
Expand Down
132 changes: 132 additions & 0 deletions .github/workflows/macos.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# SPDX-FileCopyrightText: 2022 Andrea Pappacoda
#
# SPDX-License-Identifier: Apache-2.0

# See:
# https://docs.github.com/en/actions/writing-workflows/choosing-where-your-workflow-runs/choosing-the-runner-for-a-job
# https://github.com/actions/runner-images/blob/main/images/macos/macos-14-Readme.md

name: macOS libevent

on:
push:
branches:
- master
pull_request:
branches:
- master

defaults:
run:
shell: sh

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
macos:
name: macOS with Libevent

strategy:
fail-fast: false
matrix:
os: [ 'macos-12', 'macos-13', 'macos-14', 'macos-15' ]
compiler: [ 'gcc', 'clang' ]
sanitizer: [ 'address', 'undefined', 'none' ]
tls: [ 'true', 'false' ]
def_debug: [ 'true', 'false' ]
exclude:
# GCC on macOS doesn't seem to have library asan or ubsan
- compiler: gcc
sanitizer: address
- compiler: gcc
sanitizer: undefined

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

steps:
- name: Install dependencies (macOS)
if: contains(matrix.os, 'macos')
run: |
# Avoid doing "brew update" - the brew formulas that are
# preinstalled on the github runner image are likely
# consistent with the pre-installed software on the image. If
# we do "brew update", and then install something new with
# brew, and the "something new" depends on pre-installed
# software on the image, and there are new versions of the
# pre-installed software revealed by doing "brew update", then
# when we install the "something new" brew may try and also
# install a new version of the pre-installed software on which
# the "something new" depends, but that attempt to install a
# new version of the pre-installed software can fail as a
# result of being blocked by the software that is already
# installed.
if ! type "meson" > /dev/null; then brew install meson --overwrite; fi
brew install lcov
brew install --quiet --cask doxygen
if [ ${{ matrix.compiler }} != gcc ]; then
brew install googletest
fi
# brew install openssl # Already installed in base image
brew install rapidjson
# brew install libevent # Already installed in base image
brew install howard-hinnant-date
if ! brew list brotli &>/dev/null; then brew install brotli; fi
if ! brew list zstd &>/dev/null; then brew install zstd; fi
- uses: actions/checkout@v4
with:
submodules: true

- name: Configure Meson
run: |
if [ ${{ matrix.compiler }} = gcc ]; then
source bldscripts/gccmacsetup.sh -y
else
export CXX=clang++
export CC=CXX
fi
echo "Using CXX $CXX, and CC $CC"
meson setup build \
-DPISTACHE_BUILD_TESTS=true -DPISTACHE_DEBUG=${{ matrix.def_debug }} -DPISTACHE_USE_SSL=${{ matrix.tls }} -DPISTACHE_BUILD_EXAMPLES=true -DPISTACHE_BUILD_DOCS=false -DPISTACHE_USE_CONTENT_ENCODING_DEFLATE=true -DPISTACHE_USE_CONTENT_ENCODING_BROTLI=true -DPISTACHE_USE_CONTENT_ENCODING_ZSTD=true \
--buildtype=debug -Db_coverage=true -Db_sanitize=${{ matrix.sanitizer }} -Db_lundef=false \
|| (cat build/meson-logs/meson-log.txt ; false)
env:
CC: ${{ matrix.compiler }}

- name: Build
run: ninja -C build

- name: Test
run: meson test -C build --verbose
# Use the following to run just a single test (e.g. http_server_test)
# run: build/tests/run_http_server_test

- name: Coverage
if: ${{ !contains(matrix.os, 'macos') }} # Remove this if to do coverage test
run: |
xcspath=$(xcode-select -p)
llvmcovpath=$(find $xcspath -name llvm-cov)
llvmcovpathparent=$( dirname "$llvmcovpath" )
echo "For llvm-cov, using path $llvmcovpathparent"
export PATH=$PATH:$llvmcovpathparent
llvm-cov --version
mkdir -p $HOME/.local/bin
if [ "${{ matrix.compiler }}" = 'clang' ]; then printf 'llvm-cov gcov "$@"' > $HOME/.local/bin/cov.sh; else printf 'gcov "$@"' > $HOME/.local/bin/cov.sh; fi && chmod +x $HOME/.local/bin/cov.sh
lcov --capture --ignore-errors unused --ignore-errors inconsistent --ignore-errors unused,unused --ignore-errors inconsistent,inconsistent --ignore-errors usage,usage --ignore-errors gcov,gcov --output-file coverage.info --directory . --gcov-tool $HOME/.local/bin/cov.sh --exclude '/usr/*' --exclude "${HOME}"'/.cache/*' --exclude '*/tests/*' --exclude '*/subprojects/*'
# Possible add: --exclude "$xcspath/*" --exclude "$HOMEBREW_PREFIX/*"
lcov --list coverage.info
brew install gnupg # for gpgv
curl https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --no-default-keyring --keyring trustedkeys.gpg --import
curl --silent --remote-name https://uploader.codecov.io/latest/macos/codecov
curl --silent --remote-name https://uploader.codecov.io/latest/macos/codecov.SHA256SUM
curl --silent --remote-name https://uploader.codecov.io/latest/macos/codecov.SHA256SUM.sig
gpgv codecov.SHA256SUM.sig codecov.SHA256SUM
sha256sum --check codecov.SHA256SUM
chmod +x codecov
./codecov
Loading

0 comments on commit 4fd653a

Please sign in to comment.