Skip to content

Add github action for cpp build and test #72

Add github action for cpp build and test

Add github action for cpp build and test #72

Workflow file for this run

name: libintx CI
on:
pull_request:
push:
branches: [main]
defaults:
run:
shell: bash
jobs:
configure-build:
strategy:
fail-fast: false
matrix:
os :
- ubuntu-latest
compiler :
- llvm
- gcc
build_type :
- Debug
- Release
simd:
- ON
- OFF
name: "${{ matrix.os }}: ${{ matrix.compiler }} ${{ matrix.build_type }} ${{matrix.simd == 'ON' && '(simd)' || ''}}"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Setup Cache
uses: actions/cache@v4
with:
path: |
~/.ccache
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.build_type }}-${{ matrix.simd }}-${{ hashFiles('**/CMakeLists.txt') }}
restore-keys: |
${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.build_type }}-${{ matrix.simd }}
- name: Setup Cpp Build Tools
uses: aminya/setup-cpp@v1
with:
compiler: ${{ matrix.compiler }}
cmake: true
ninja: true
ccache: true
- name: Install Build Dependencies
run: |
set -x;
sudo apt-get update && sudo apt-get install -y \
libopenblas-dev \
liblapacke-dev
- name: Set up ccache environment
run: |
echo "CCACHE_DIR=$HOME/.ccache" >> $GITHUB_ENV
echo "CCACHE_MAXSIZE=1G" >> $GITHUB_ENV
- name: ccache stats
run: |
ccache --zero-stats && ccache --show-stats
- name: Configure
run: |
set -x;
cmake -S . -B ./build -G "Ninja Multi-Config" \
-DLIBINTX_MAX_L=2 \
-DLIBINTX_SIMD=${{matrix.simd}} \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}}
- name: Build
working-directory: ${{github.workspace}}/build
run: |
cmake --build . --target all all.tests --config ${{matrix.build_type}}
- name: Show ccache stats (after build)
run: ccache -s
- name: Test
working-directory: ${{github.workspace}}/build
run: |
ctest --output-on-failure -C ${{matrix.build_type}}