Add github action for cpp build and test #78
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: libintx CI | |
on: | |
pull_request: | |
push: | |
branches: [main] | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
configure-build: | |
strategy: | |
fail-fast: false | |
matrix: | |
os : | |
- ubuntu-latest | |
- ubuntu-24.04-arm | |
compiler : | |
- clang | |
- 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: | |
- name: Run sccache-cache | |
uses: mozilla-actions/[email protected] | |
- uses: actions/checkout@v4 | |
- name: Set compiler and sccache environment | |
run: | | |
echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV | |
if [[ "${{ matrix.compiler }}" == "gcc" ]]; then | |
echo "CC=gcc" >> $GITHUB_ENV | |
echo "CXX=g++" >> $GITHUB_ENV | |
elif [[ "${{ matrix.compiler }}" == "clang" ]]; then | |
echo "CC=clang" >> $GITHUB_ENV | |
echo "CXX=clang++" >> $GITHUB_ENV | |
else | |
echo "Unsupported compiler: ${{ matrix.compiler }}" | |
exit 1 | |
fi | |
- name: Verify compiler | |
run: | | |
set -x; | |
$CC --version | |
$CXX --version | |
- name: Install Build Dependencies | |
run: | | |
set -x; | |
sudo apt-get update && sudo apt-get install -y \ | |
libopenblas-dev \ | |
liblapacke-dev | |
- 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=sccache \ | |
-DCMAKE_C_COMPILER_LAUNCHER=sccache \ | |
-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}} |