-
Notifications
You must be signed in to change notification settings - Fork 103
80 lines (77 loc) · 3.72 KB
/
macos-clang.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
name: macos-clang
on: [ pull_request, workflow_dispatch ]
env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
jobs:
macos-clang:
strategy:
fail-fast: false
matrix:
os: ["macos-latest", "macos-13"]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Export GitHub Actions cache environment variables
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: "${{ github.job }}-${{ matrix.os }}"
max-size: "2G"
create-symlink: true
- name: Run vcpkg
uses: lukka/run-vcpkg@v11
- name: Install Conan
run: |
brew install pipx
pipx install conan
conan profile detect
- name: Install ninja
run: brew install ninja
if: matrix.os == 'macos-latest'
- name: Make sure the library compiles with Conan
env:
CC: clang
CXX: clang++
run: conan build . --build=missing -s compiler.cppstd=gnu20 -o *:with_cbor=True -o *:with_flatbuffers=True -o *:with_msgpack=True -o *:with_toml=True -o *:with_ubjson=True -o *:with_xml=True -o *:with_yaml=True
- name: Compile
env:
CC: clang
CXX: clang++
run: |
if [[ "${{ matrix.os == 'macos-latest' }}" == "true" ]]; then
export VCPKG_FORCE_SYSTEM_BINARIES=arm
export CMAKE_GENERATOR=Ninja
fi
$CXX --version
cmake -S . -B build -DREFLECTCPP_BUILD_TESTS=ON -DREFLECTCPP_BUILD_BENCHMARKS=ON -DREFLECTCPP_BSON=ON -DREFLECTCPP_CBOR=ON -DREFLECTCPP_FLEXBUFFERS=ON -DREFLECTCPP_MSGPACK=ON -DREFLECTCPP_TOML=ON -DREFLECTCPP_XML=ON -DREFLECTCPP_YAML=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
cmake --build build -j 4
- name: Run tests
run: |
ctest --test-dir build --output-on-failure
- name: Run benchmarks
run: |
echo '# Benchmarks' >> $GITHUB_STEP_SUMMARY
echo '## Benchmarks across different formats' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
./build/benchmarks/all/reflect-cpp-all-format-benchmarks --benchmark_filter=canada_read >> $GITHUB_STEP_SUMMARY
./build/benchmarks/all/reflect-cpp-all-format-benchmarks --benchmark_filter=canada_write >> $GITHUB_STEP_SUMMARY
./build/benchmarks/all/reflect-cpp-all-format-benchmarks --benchmark_filter=licenses_read >> $GITHUB_STEP_SUMMARY
./build/benchmarks/all/reflect-cpp-all-format-benchmarks --benchmark_filter=licenses_write >> $GITHUB_STEP_SUMMARY
./build/benchmarks/all/reflect-cpp-all-format-benchmarks --benchmark_filter=person_read >> $GITHUB_STEP_SUMMARY
./build/benchmarks/all/reflect-cpp-all-format-benchmarks --benchmark_filter=person_write >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo '## Benchmarks for JSON' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
./build/benchmarks/json/reflect-cpp-json-benchmarks --benchmark_filter=person_read >> $GITHUB_STEP_SUMMARY
./build/benchmarks/json/reflect-cpp-json-benchmarks --benchmark_filter=canada >> $GITHUB_STEP_SUMMARY
./build/benchmarks/json/reflect-cpp-json-benchmarks --benchmark_filter=licenses >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY