Skip to content

Merge pull request #7 from polyfem/mtao/cpp20 #44

Merge pull request #7 from polyfem/mtao/cpp20

Merge pull request #7 from polyfem/mtao/cpp20 #44

Workflow file for this run

name: Build
on:
push:
branches: [main]
pull_request:
env:
CTEST_OUTPUT_ON_FAILURE: ON
CTEST_PARALLEL_LEVEL: 1
jobs:
####################
# Linux
####################
Linux:
name: ${{ matrix.name }} (${{ matrix.config }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
config: [Debug, Release]
include:
- os: ubuntu-latest
name: Linux
steps:
- name: Checkout repository
uses: actions/checkout@v1
with:
fetch-depth: 10
- name: Dependencies
run: |
sudo apt-get update
sudo apt-get -o Acquire::Retries=3 install \
xorg-dev \
ccache
echo 'CACHE_PATH=~/.cache/ccache' >> "$GITHUB_ENV"
- name: Cache Build
id: cache-build
uses: actions/cache@v3
with:
path: ${{ env.CACHE_PATH }}
key: ${{ runner.os }}-${{ matrix.config }}-cache-${{ github.sha }}
restore-keys: ${{ runner.os }}-${{ matrix.config }}-cache
- name: Prepare ccache
run: |
ccache --max-size=1.0G
ccache -V && ccache --show-stats && ccache --zero-stats
ccache -sv
- name: Configure
run: |
mkdir -p build
cd build
cmake .. \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_BUILD_TYPE=${{ matrix.config }}
- name: Build
run: cd build; make -j2; ccache --show-stats
- name: Tests
run: cd build; ctest --verbose --output-on-failure
# - name: Setup tmate session
# if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v3
####################
# MacOS
####################
MacOS:
name: ${{ matrix.name }}-${{ matrix.arc }} (${{ matrix.config }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest]
arc: [x86]
config: [Debug, Release]
include:
- os: macos-latest
name: macOS
steps:
- name: Checkout repository
uses: actions/checkout@v1
with:
fetch-depth: 10
- name: Dependencies
run: |
brew install ccache
echo 'CACHE_PATH=~/Library/Caches/ccache' >> "$GITHUB_ENV"
- name: Cache Build
id: cache-build
uses: actions/cache@v3
with:
path: ${{ env.CACHE_PATH }}
key: ${{ runner.os }}-${{ matrix.config }}-${{ matrix.arc }}-cache-${{ github.sha }}
restore-keys: ${{ runner.os }}-${{ matrix.config }}-${{ matrix.arc }}-cache
- name: Prepare ccache
run: |
ccache --max-size=1.0G
ccache -V && ccache --show-stats && ccache --zero-stats
- name: Configure x86
if: matrix.arc == 'x86'
run: |
mkdir -p build
cd build
cmake .. \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_BUILD_TYPE=${{ matrix.config }}
- name: Configure arm64
if: matrix.arc == 'arm64'
run: |
mkdir -p build
cd build
cmake .. \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_BUILD_TYPE=${{ matrix.config }} \
-DCMAKE_OSX_ARCHITECTURES=arm64
- name: Build
run: cd build; make -j2; ccache --show-stats
- name: Tests
if: matrix.arc == 'x86' # no ARM vm on actions yet
run: cd build; ctest --verbose --output-on-failure
####################
# Windows
####################
Windows:
name: Windows (${{ matrix.config }})
runs-on: windows-2022
env:
SCCACHE_IDLE_TIMEOUT: "12000"
strategy:
fail-fast: false
matrix:
config: [Debug, Release]
steps:
- name: Checkout repository
uses: actions/checkout@v1
with:
fetch-depth: 10
- name: Install Ninja
uses: seanmiddleditch/gha-setup-ninja@master
- name: Set env
run: |
echo "appdata=$env:LOCALAPPDATA" >> ${env:GITHUB_ENV}
- name: Cache build
id: cache-build
uses: actions/cache@v3
with:
path: ${{ env.appdata }}\Mozilla\sccache
key: ${{ runner.os }}-${{ matrix.config }}-cache-${{ github.sha }}
restore-keys: ${{ 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_FLAGS="/Z7 /DEBUG:FASTLINK /DWIN32" ^
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache ^
-DCMAKE_BUILD_TYPE=${{ matrix.config }} ^
-B build ^
-S .
cmake --build build -j1
- name: Tests
run: |
cd build
ctest --verbose --output-on-failure