Skip to content

Fix Build

Fix Build #38

Workflow file for this run

name: Build
on:
push:
branches:
- main
pull_request:
branches:
- main
env:
CTEST_OUTPUT_ON_FAILURE: ON
CTEST_PARALLEL_LEVEL: 2
jobs:
####################
# Linux / macOS
####################
Unix:
name: ${{ matrix.name }} (${{ matrix.config }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
config: [Debug, Release]
include:
- os: macos-latest
name: macOS
- os: ubuntu-latest
name: Linux
steps:
- name: Checkout repository
uses: actions/checkout@v2.5.0
with:
fetch-depth: 10
- name: Dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install \
ccache \
xorg-dev \
libglu1-mesa-dev
- name: Dependencies (macOS)
if: runner.os == 'macOS'
run: brew install ccache
- name: Cache Build
id: cache-build
uses: actions/cache@v1
with:
path: ~/.ccache
key: ${{ runner.os }}-${{ matrix.config }}-cache
- name: Prepare ccache
run: |
ccache --max-size=1.0G
ccache -V && ccache --show-stats && ccache --zero-stats
- name: Configure
run: |
mkdir -p build
cd build
cmake .. \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DRIGID_IPC_WITH_UNIT_TESTS=ON \
-DCMAKE_BUILD_TYPE=${{ matrix.config }}
- name: Build
run: cd build; make -j2; ccache --show-stats
- name: Tests
run: cd build; ctest --verbose
####################
# Windows
####################
Windows:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
config: [Debug, Release]
steps:
- name: Checkout repository
uses: actions/checkout@v2.5.0
with:
fetch-depth: 10
- name: Install Ninja
uses: seanmiddleditch/gha-setup-ninja@master
- name: Set env variable for sccache
run: |
echo "appdata=$env:LOCALAPPDATA" >> ${env:GITHUB_ENV}
- name: Cache build
id: cache-build
uses: actions/cache@v3.0.11
with:
path: ${{ env.appdata }}\Mozilla\sccache
key: ${{ runner.os }}-${{ matrix.config }}-cache
- name: Prepare sccache
run: |
iwr -useb 'https://raw.githubusercontent.com/scoopinstaller/install/master/install.ps1' -outfile 'install.ps1'
.\install.ps1 -RunAsAdmin
scoop install sccache --global
# Scoop modifies the PATH so we make it available for the next steps of the job
echo "${env:PATH}" >> ${env:GITHUB_PATH}
- name: Configure and build
shell: cmd
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat" -arch=x64
cmake -G Ninja ^
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache ^
-DCMAKE_BUILD_TYPE=${{ matrix.config }} ^
-DRIGID_IPC_WITH_UNIT_TESTS=ON ^
-B build ^
-S .
cmake --build build -j1
- name: Tests
run: cd build; ctest --verbose -j2