Skip to content

Prepare v4.0.0

Prepare v4.0.0 #613

Workflow file for this run

name: macOS
on:
push:
branches:
- master
- v*/dev
- ci/*
paths:
- '.github/workflows/macos.yml'
- 'benchmark/**'
- 'cmake/**'
- 'examples/**'
- 'include/**'
- 'src/**'
- 'tests/**'
- '**/CMakeLists.txt'
pull_request:
branches:
- master
- v*/dev
- ci/*
paths:
- '.github/workflows/macos.yml'
- 'benchmark/**'
- 'cmake/**'
- 'examples/**'
- 'include/**'
- 'src/**'
- 'tests/**'
- '**/CMakeLists.txt'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }}-${{ github.ref_type == 'branch' && github.sha }}-${{ github.event_name == 'workflow_dispatch' }}-${{ github.event_name == 'schedule' }}-${{ github.event.schedule }}
cancel-in-progress: true
env:
CCACHE_ABSSTDERR: true
CCACHE_COMPRESS: true
CCACHE_COMPRESSLEVEL: 6
CCACHE_DIR: "/tmp/ccache"
CCACHE_MAXSIZE: 50M
CCACHE_NOHASHDIR: true
CCACHE_SLOPPINESS: "pch_defines,time_macros"
CCACHE_UNIFY: true
jobs:
build:
runs-on: macos-${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ 14 ]
cxx: [ brew-clang++, clang++, g++-14, g++-13, g++-12 ]
std: [ 17 ]
include:
# brew-clang++ with later standards on macos 14
- os: 14
cxx: brew-clang++
std: 20
- os: 14
cxx: brew-clang++
std: 23
# macos 15 with built-in clang++ and brew-clang++
- os: 15
cxx: clang++
std: 17
- os: 15
cxx: brew-clang++
std: 17
env:
CXX: ${{ matrix.cxx }}
OS: ${{ matrix.os }}
CMAKE_C_COMPILER_LAUNCHER: ccache
CMAKE_CXX_COMPILER_LAUNCHER: ccache
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create Build Environment
run: |
mkdir ${{ runner.workspace }}/build
brew install --overwrite ccache
- name: Setup Homebrew clang
if: ${{ matrix.cxx == 'brew-clang++' }}
run: |
llvm_root="$(brew --prefix llvm)"
echo "${llvm_root}/bin" >> $GITHUB_PATH
echo "CXX=clang++" >> $GITHUB_ENV
echo "LDFLAGS=-Wl,-rpath,${llvm_root}" >> $GITHUB_ENV
echo "CPPFLAGS=-isystem ${llvm_root}/include" >> $GITHUB_ENV
echo "CXXFLAGS=-isystem ${llvm_root}/include/c++/v1" >> $GITHUB_ENV
- name: Load ccache
uses: actions/cache@v4
with:
path: ${{ env.CCACHE_DIR }}
key: ccache-${{ github.workflow }}-macos${{ matrix.os }}-${{ matrix.cxx }}-std${{ matrix.std }}-${{ github.sha }}
restore-keys: |
ccache-${{ github.workflow }}-macos${{ matrix.os }}-${{ matrix.cxx }}-std${{ matrix.std }}-${{ github.ref }}
ccache-${{ github.workflow }}-macos${{ matrix.os }}-${{ matrix.cxx }}-std${{ matrix.std }}-${{ github.base_ref }}
ccache-${{ github.workflow }}-macos${{ matrix.os }}-${{ matrix.cxx }}-std${{ matrix.std }}
- name: Setup ccache
run: |
ccache --version
ccache --zero-stats
ccache --show-stats
ccache --show-config
- name: Run CMake
working-directory: ${{ runner.workspace }}/build
run: |
cmake -DSCN_CI=ON -DCMAKE_CXX_STANDARD=${{ matrix.std }} $GITHUB_WORKSPACE
- name: Build
working-directory: ${{ runner.workspace }}/build
run: cmake --build . --parallel -- -k
- name: Show ccache stats
run: |
ccache --show-stats
- name: Test
working-directory: ${{ runner.workspace }}/build
run: ctest --output-on-failure