Skip to content

Add CI rules for GitHub hosted Ubuntu runners. #1

Add CI rules for GitHub hosted Ubuntu runners.

Add CI rules for GitHub hosted Ubuntu runners. #1

Workflow file for this run

name: build
on:
workflow_dispatch:
push:
pull_request:
concurrency: ci-${{ github.ref }}
jobs:
ubuntu:
# For available GitHub-hosted runners, see:
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
runs-on: ubuntu-latest
name: ubuntu (${{ matrix.compiler }})
strategy:
# Allow other runners in the matrix to continue if some fail
fail-fast: false
matrix:
compiler: [gcc, clang]
include:
- compiler: gcc
compiler-pkgs: "g++ gcc"
cc: "gcc"
cxx: "g++"
ccache-max: 600M
- compiler: clang
compiler-pkgs: "clang libomp-dev"
cc: "clang"
cxx: "clang++"
ccache-max: 500M
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
steps:
- name: get CPU information
run: lscpu
- name: checkout repository
uses: actions/checkout@v4
- name: install dependencies
env:
COMPILER_PKGS: ${{ matrix.compiler-pkgs }}
run: |
sudo apt -qq update
sudo apt install -y ${COMPILER_PKGS} cmake gfortran libopenblas-dev \
unzip libopenmpi-dev libmumps-dev libparmetis-dev
- name: prepare ccache
# create key with human readable timestamp
# used in action/cache/restore and action/cache/save steps
id: ccache-prepare
run: |
echo "key=ccache:ubuntu:${{ matrix.compiler }}:${{ github.ref }}:$(date +"%Y-%m-%d_%H-%M-%S"):${{ github.sha }}" >> $GITHUB_OUTPUT
- name: restore ccache
# setup the GitHub cache used to maintain the ccache from one job to the next
uses: actions/cache/restore@v4
with:
path: ~/.ccache
key: ${{ steps.ccache-prepare.outputs.key }}
# Prefer caches from the same branch. Fall back to caches from the dev branch.
restore-keys: |
ccache:ubuntu:${{ matrix.compiler }}:${{ github.ref }}
ccache:ubuntu:${{ matrix.compiler }}:
- name: configure ccache
env:
CCACHE_MAX: ${{ matrix.ccache-max }}
run: |
test -d ~/.ccache || mkdir ~/.ccache
echo "max_size = $CCACHE_MAX" >> ~/.ccache/ccache.conf
echo "compression = true" >> ~/.ccache/ccache.conf
ccache -s
echo "/usr/lib/ccache" >> $GITHUB_PATH
- name: configure
run: |
mkdir {GITHUB_WORKSPACE}/build
cd ${GITHUB_WORKSPACE}/build
cmake -DCMAKE_BUILD_TYPE="Release" \
-DCMAKE_INSTALL_PREFIX="${GITHUB_WORKSPACE}" \
-DCMAKE_C_COMPILER_LAUNCHER="ccache" \
-DCMAKE_CXX_COMPILER_LAUNCHER="ccache" \
-DCMAKE_Fortran_COMPILER_LAUNCHER="ccache" \
-DBLA_VENDOR="OpenBLAS" \
-DWITH_OpenMP=ON \
-DWITH_LUA=ON \
-DWITH_Zoltan=ON \
-DWITH_Mumps=ON \
-DCREATE_PKGCONFIG_FILE=ON \
-DWITH_MPI=ON \
-DMPI_TEST_MAXPROC=2 \
-DMPIEXEC_PREFLAGS="--allow-run-as-root" \
..
- name: build
run: |
cd ${GITHUB_WORKSPACE}/build
cmake --build .
- name: check
timeout-minutes: 20
run: |
cd ${GITHUB_WORKSPACE}/build
ctest .
- name: ccache status
continue-on-error: true
run: ccache -s
- name: save ccache
# Save the cache after we are done (successfully) building
# This helps to retain the ccache even if the subsequent steps are failing.
uses: actions/cache/save@v4
with:
path: ~/.ccache
key: ${{ steps.ccache-prepare.outputs.key }}
- name: install
run: |
cmake --install .