You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
psblas3/.github/workflows/cmake-build.yml

85 lines
2.5 KiB
YAML

name: CMake Build
on:
workflow_dispatch:
inputs:
install_prefix:
description: 'CMake install prefix (relative to workspace)'
default: 'install'
required: true
build_type:
description: 'CMake build type'
default: 'Release'
required: true
run_install_only:
description: 'Run only install step'
default: 'false'
required: true
push:
branches:
- cmake
- test_dev
pull_request:
branches:
- cmake
- test_dev
jobs:
build:
runs-on: ubuntu-latest
steps:
# Step 1: Checkout repository with full history for git describe
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
# Step 2: Install dependencies (CMake, compiler, MPI, BLAS/LAPACK)
- name: Setup dependencies
run: |
sudo apt update
sudo apt install -y cmake build-essential mpich libmpich-dev libopenblas-dev liblapack-dev
mpifort --version
# Step 3: Set build variables
- name: Set build variables
run: |
echo "BUILD_TYPE=${{ github.event.inputs.build_type || 'Release' }}" >> $GITHUB_ENV
echo "INSTALL_PREFIX=${{ github.workspace }}/${{ github.event.inputs.install_prefix || 'install' }}" >> $GITHUB_ENV
echo "RUN_INSTALL_ONLY=${{ github.event.inputs.run_install_only }}" >> $GITHUB_ENV
- name: Set MPI environment
run: |
export PATH="/usr/lib/mpich/bin:$PATH"
export MPI_HOME="/usr/lib/mpich"
mpifort --version
# Step 4: Cache CMake build directory
- name: Cache CMake build
uses: actions/cache@v3
with:
path: build
key: build-${{ runner.os }}-${{ hashFiles('**/CMakeLists.txt') }}
restore-keys: |
build-${{ runner.os }}-
# Step 5: Configure and build (skipped if run_install_only=true)
- name: Configure and Build
if: ${{ env.RUN_INSTALL_ONLY != 'true' }}
run: |
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
-DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX \
-DCMAKE_Fortran_COMPILER=mpifort \
-DCMAKE_C_COMPILER=mpicc \
-DMPI_C_COMPILER=mpicc \
-DMPI_Fortran_COMPILER=mpifort
cmake --build build -- -j$(nproc)
# Step 6: Install
- name: Install
run: cmake --install build --prefix $INSTALL_PREFIX