mirror of
https://codeberg.org/DawnMagnet/reflect-cpp
synced 2026-11-28 22:06:19 +08:00
78 lines
3.7 KiB
YAML
78 lines
3.7 KiB
YAML
name: macos
|
|
|
|
on: [ push, pull_request ]
|
|
|
|
env:
|
|
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
|
|
|
|
jobs:
|
|
macos-clang:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: ["macos-latest", "macos-13"]
|
|
format: ["tests", "benchmarks"]
|
|
name: "${{ matrix.os }} (${{ matrix.format }})"
|
|
concurrency:
|
|
group: "macos-${{ github.ref }}-${{ github.job }}-${{ matrix.os }}-${{ matrix.format }}"
|
|
cancel-in-progress: true
|
|
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: Run vcpkg
|
|
uses: lukka/run-vcpkg@v11
|
|
- name: Install bison
|
|
run: brew install bison openssl@3
|
|
- name: Install ninja
|
|
run: brew install ninja
|
|
if: matrix.os == 'macos-latest'
|
|
- 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
|
|
if [[ "${{ matrix.format }}" == "benchmarks" ]]; then
|
|
cmake -S . -B build -G Ninja -DCMAKE_CXX_STANDARD=${{ matrix.cxx }} -DCMAKE_CXX_STANDARD=20 -DREFLECTCPP_BUILD_BENCHMARKS=ON -DREFLECTCPP_ALL_FORMATS=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
|
|
else
|
|
cmake -S . -B build -DCMAKE_CXX_STANDARD=20 -DREFLECTCPP_BUILD_TESTS=ON -DREFLECTCPP_ALL_FORMATS=ON -DREFLECTCPP_CHECK_HEADERS=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
|
|
fi
|
|
cmake --build build -j 4
|
|
- name: Run tests
|
|
if: matrix.format != 'benchmarks'
|
|
run: |
|
|
ctest --test-dir build --output-on-failure
|
|
- name: Run benchmarks
|
|
if: matrix.format == '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
|