Skip to content

Update continuous.yml #744

Update continuous.yml

Update continuous.yml #744

Workflow file for this run

name: Build
on:
push:
branches: [main]
pull_request:
paths:
- '.github/workflows/continuous.yml'
- 'cmake/**'
- 'src/**'
- 'tests/**'
- 'CMakeLists.txt'
env:
CTEST_OUTPUT_ON_FAILURE: ON
CTEST_PARALLEL_LEVEL: 2
jobs:
Build:
name: ${{ matrix.name }} (${{ matrix.config }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
config: [Debug, Release]
include:
- os: macos-latest
name: macOS
- os: ubuntu-latest
name: Linux
- os: windows-latest
name: Windows
steps:
- name: Checkout repository
uses: actions/checkout@v4.0.0
with:
fetch-depth: 10
- name: Dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get install ccache
echo 'CACHE_PATH=~/.cache/ccache' >> "$GITHUB_ENV"
- name: Dependencies (macOS)
if: runner.os == 'macOS'
run: |
brew install ccache
echo 'CACHE_PATH=~/Library/Caches/ccache' >> "$GITHUB_ENV"
- name: Dependencies (Windows)
if: runner.os == 'Windows'
run: |
choco install ccache
"CACHE_PATH=${env:LOCALAPPDATA}\ccache" | Out-File -FilePath $env:GITHUB_ENV -Append
# Install Ninja (only needed on Windows)
- name: Install Ninja
if: runner.os == 'Windows'
uses: seanmiddleditch/gha-setup-ninja@master
- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v1
id: cpu-cores
- name: Cache Build
id: cache-build
uses: actions/cache@v3.0.11
with:
path: ${{ env.CACHE_PATH }}
key: ${{ runner.os }}-${{ matrix.config }}-cache
- name: Prepare ccache
run: |
ccache --max-size=1.0G
ccache -V && ccache --show-config
ccache --show-stats && ccache --zero-stats
- name: Configure (Linux/macOS)
if: runner.os != 'Windows'
run: |
mkdir -p build
cd build
cmake .. \
-DIPC_TOOLKIT_BUILD_TESTS=ON \
-DCMAKE_BUILD_TYPE=${{ matrix.config }}
- name: Configure (Windows)
if: runner.os == 'Windows'
shell: cmd
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat" -arch=x64
cmake -G Ninja ^
-DIPC_TOOLKIT_BUILD_TESTS=ON ^
-DCMAKE_BUILD_TYPE=${{ matrix.config }} ^
-B build ^
-S .
- name: Build (Linux/macOS)
if: runner.os != 'Windows'
run: |
cmake --build build -j ${{ steps.cpu-cores.outputs.count }}
ccache --show-stats
- name: Build (Windows)
if: runner.os == 'Windows'
shell: cmd
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat" -arch=x64
cmake --build build -j ${{ steps.cpu-cores.outputs.count }} && ccache --show-stats
- name: Tests
run: cd build; ctest --verbose -j ${{ steps.cpu-cores.outputs.count }}