From ec24b7d4eb1ac259c4add2502aa836061368a062 Mon Sep 17 00:00:00 2001 From: DMG Date: Wed, 21 Aug 2024 18:21:04 -0700 Subject: [PATCH 1/6] feat: macOS Workflow Skipping coverage. Some progress made on it, but still fails. TLS 'true' disabled since it fails when compiling test programs, though the library compiles. Workflow is deliberately limited to a single build for now. --- .github/workflows/macos.yaml | 114 +++++++++++++++++++++++++++++++++++ version.txt | 2 +- 2 files changed, 115 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/macos.yaml diff --git a/.github/workflows/macos.yaml b/.github/workflows/macos.yaml new file mode 100644 index 000000000..8a3f15801 --- /dev/null +++ b/.github/workflows/macos.yaml @@ -0,0 +1,114 @@ +# SPDX-FileCopyrightText: 2022 Andrea Pappacoda +# +# SPDX-License-Identifier: Apache-2.0 + +# 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 + +# From jobs: macos: strategy: matrix: + # os: [ 'macos-12', 'macos-13', 'macos-latest' ] + # compiler: [ 'gcc', 'clang' ] + # tls: [ 'false', 'true' ] + +name: macOS libevent + +on: + push: + branches: + - master + - macOSRunner + pull_request: + branches: + - master + - macOSRunner + +defaults: + run: + shell: sh + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + macos: + name: test macos with libevent + runs-on: macos-latest + + strategy: + fail-fast: false + matrix: + os: [ 'macos-latest' ] + compiler: [ 'clang' ] + sanitizer: [ 'none' ] + tls: [ 'false' ] + def_debug: [ 'true' ] + +# sanitizer: [ 'address', 'undefined', 'none' ] +# tls: [ 'true', 'false' ] +# def_debug: [ 'true', 'false' ] + + steps: + - name: Install dependencies (macOS) + if: contains(matrix.os, 'macos') + run: | + if [ ${{ matrix.compiler }} = gcc ]; then compiler=g++; else compiler="clang lld ?exact-name(libclang-rt-dev)"; fi + brew update + + brew install meson + brew install lcov + brew install doxygen + brew install googletest + brew install openssl + brew install rapidjson + brew install libevent + brew install howard-hinnant-date + + - uses: actions/checkout@v4 + with: + submodules: true + + - name: Configure Meson + run: | + if [ ${{ matrix.compiler }} = gcc ]; then CXX=g++; else CXX=clang++; fi + export CXX + 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 \ + --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 + diff --git a/version.txt b/version.txt index 8ef806eb2..da273f1bb 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.4.1.20240804 +0.4.1.20240821 From 6700ba18f6eab96d53b1816a039d89ba543e70ba Mon Sep 17 00:00:00 2001 From: DMG Date: Thu, 22 Aug 2024 08:37:54 -0700 Subject: [PATCH 2/6] Do TLS true then false in macos github workflow --- .github/workflows/macos.yaml | 2 +- version.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/macos.yaml b/.github/workflows/macos.yaml index 8a3f15801..7b3331c62 100644 --- a/.github/workflows/macos.yaml +++ b/.github/workflows/macos.yaml @@ -42,7 +42,7 @@ jobs: os: [ 'macos-latest' ] compiler: [ 'clang' ] sanitizer: [ 'none' ] - tls: [ 'false' ] + tls: [ 'true', 'false' ] def_debug: [ 'true' ] # sanitizer: [ 'address', 'undefined', 'none' ] diff --git a/version.txt b/version.txt index da273f1bb..600bab75a 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.4.1.20240821 +0.4.1.20240822 From 52dc1c689a1e368cc8a4f021c082a050a9ca4b41 Mon Sep 17 00:00:00 2001 From: DMG Date: Thu, 22 Aug 2024 09:30:02 -0700 Subject: [PATCH 3/6] For OS, do 'macos-12', 'macos-13', as well as 'macos-latest' When installing dependencies: - Treat doxygen as a brew cask - Skip openssl (already installed) - Skip libevent (already installed) --- .github/workflows/macos.yaml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/macos.yaml b/.github/workflows/macos.yaml index 7b3331c62..50e6270e7 100644 --- a/.github/workflows/macos.yaml +++ b/.github/workflows/macos.yaml @@ -9,7 +9,6 @@ # From jobs: macos: strategy: matrix: # os: [ 'macos-12', 'macos-13', 'macos-latest' ] # compiler: [ 'gcc', 'clang' ] - # tls: [ 'false', 'true' ] name: macOS libevent @@ -39,7 +38,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ 'macos-latest' ] + os: [ 'macos-12', 'macos-13', 'macos-latest' ] compiler: [ 'clang' ] sanitizer: [ 'none' ] tls: [ 'true', 'false' ] @@ -58,11 +57,11 @@ jobs: brew install meson brew install lcov - brew install doxygen + brew install --cask doxygen brew install googletest - brew install openssl + # brew install openssl # Already installed in base image brew install rapidjson - brew install libevent + # brew install libevent # Already installed in base image brew install howard-hinnant-date - uses: actions/checkout@v4 From ebb8f583bb466ed2fa36fef955df99cf879fe312 Mon Sep 17 00:00:00 2001 From: DMG Date: Thu, 22 Aug 2024 09:44:45 -0700 Subject: [PATCH 4/6] Use gcc, not clang --- .github/workflows/macos.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/macos.yaml b/.github/workflows/macos.yaml index 50e6270e7..ae1f2f45a 100644 --- a/.github/workflows/macos.yaml +++ b/.github/workflows/macos.yaml @@ -39,7 +39,7 @@ jobs: fail-fast: false matrix: os: [ 'macos-12', 'macos-13', 'macos-latest' ] - compiler: [ 'clang' ] + compiler: [ 'gcc' ] sanitizer: [ 'none' ] tls: [ 'true', 'false' ] def_debug: [ 'true' ] @@ -57,7 +57,7 @@ jobs: brew install meson brew install lcov - brew install --cask doxygen + brew install --quiet --cask doxygen brew install googletest # brew install openssl # Already installed in base image brew install rapidjson From 57d9b16554ec828d8d910888a2cc917ed995d1fb Mon Sep 17 00:00:00 2001 From: DMG Date: Thu, 22 Aug 2024 09:53:41 -0700 Subject: [PATCH 5/6] In macOS github workflow, do clang and gcc compiler For sanitizer, do 'address', 'undefined', and 'none' For def_debug, do 'true' and 'false' --- .github/workflows/macos.yaml | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/.github/workflows/macos.yaml b/.github/workflows/macos.yaml index ae1f2f45a..f2a7bf73d 100644 --- a/.github/workflows/macos.yaml +++ b/.github/workflows/macos.yaml @@ -2,13 +2,9 @@ # # SPDX-License-Identifier: Apache-2.0 -# 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 - -# From jobs: macos: strategy: matrix: - # os: [ 'macos-12', 'macos-13', 'macos-latest' ] - # compiler: [ 'gcc', 'clang' ] +# 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 @@ -39,14 +35,10 @@ jobs: fail-fast: false matrix: os: [ 'macos-12', 'macos-13', 'macos-latest' ] - compiler: [ 'gcc' ] - sanitizer: [ 'none' ] + compiler: [ 'gcc', 'clang' ] + sanitizer: [ 'address', 'undefined', 'none' ] tls: [ 'true', 'false' ] - def_debug: [ 'true' ] - -# sanitizer: [ 'address', 'undefined', 'none' ] -# tls: [ 'true', 'false' ] -# def_debug: [ 'true', 'false' ] + def_debug: [ 'true', 'false' ] steps: - name: Install dependencies (macOS) From 6723610470685c2ea9846764bd16d8d34c495df6 Mon Sep 17 00:00:00 2001 From: DMG Date: Thu, 22 Aug 2024 10:13:58 -0700 Subject: [PATCH 6/6] Use matrix.os for macos workflow "runs-on" Previously was using macos-latest regardless of the value of matrix.os. Should now use macOS 12, 13 and Latest. --- .github/workflows/macos.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/macos.yaml b/.github/workflows/macos.yaml index f2a7bf73d..4f3deb79f 100644 --- a/.github/workflows/macos.yaml +++ b/.github/workflows/macos.yaml @@ -28,9 +28,8 @@ concurrency: jobs: macos: - name: test macos with libevent - runs-on: macos-latest - + name: macOS with Libevent + strategy: fail-fast: false matrix: @@ -40,6 +39,8 @@ jobs: tls: [ 'true', 'false' ] def_debug: [ 'true', 'false' ] + runs-on: ${{ matrix.os }} + steps: - name: Install dependencies (macOS) if: contains(matrix.os, 'macos')