-
Notifications
You must be signed in to change notification settings - Fork 703
132 lines (114 loc) · 5.28 KB
/
macos.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
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-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