Version 3.1 Refactor #18
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: CI | |
| on: | |
| push: | |
| branches: | |
| - master | |
| - experimental | |
| - '*-maintenance' | |
| pull_request: | |
| branches: | |
| - master | |
| - '*-maintenance' | |
| workflow_dispatch: | |
| env: | |
| BUILD_DIR: _build | |
| PIP_PACKAGES: >- | |
| meson!=1.8.0 | |
| cmake | |
| ninja | |
| PIP_EXTRAS: >- | |
| pkgconfig | |
| numpy | |
| ase | |
| matplotlib | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # ---- Linux GCC 14 + OpenBLAS — CMake debugoptimized -------------- | |
| - { os: ubuntu-latest, build-type: debugoptimized, | |
| toolchain: { compiler: gcc, version: '14', build: cmake } } | |
| # ---- Linux Intel (ifx/icx) + MKL — Meson debugoptimized --------- | |
| - { os: ubuntu-latest, build-type: debugoptimized, | |
| toolchain: { compiler: intel, version: '2025.1', mkl_version: '2025.1', build: meson } } | |
| # ---- macOS GCC 14 + OpenBLAS — CMake debugoptimized -------------- | |
| - { os: macos-latest, build-type: debugoptimized, | |
| toolchain: { compiler: gcc, version: '14', build: cmake } } | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| # ---------------------------------------------------------------------- | |
| # Setup | |
| # ---------------------------------------------------------------------- | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| # ---------------------------------------------------------------------- | |
| # Compiler setup | |
| # ---------------------------------------------------------------------- | |
| - name: Install GCC using setup-fortran | |
| if: ${{ contains(matrix.toolchain.compiler, 'gcc') }} | |
| uses: fortran-lang/setup-fortran@v1 | |
| with: | |
| compiler: ${{ matrix.toolchain.compiler }} | |
| version: ${{ matrix.toolchain.version }} | |
| - name: Install libopenblas (Linux GCC builds) | |
| if: ${{ contains(matrix.os, 'ubuntu') && contains(matrix.toolchain.compiler, 'gcc') }} | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libopenblas-dev | |
| - name: Install OpenBLAS (macOS) | |
| if: ${{ contains(matrix.os, 'macos') }} | |
| run: | | |
| brew update | |
| brew install openblas | |
| echo "PKG_CONFIG_PATH=/usr/local/opt/openblas/lib/pkgconfig:/opt/homebrew/opt/openblas/lib/pkgconfig" >> $GITHUB_ENV | |
| echo "LDFLAGS=-L/usr/local/opt/openblas/lib -L/opt/homebrew/opt/openblas/lib" >> $GITHUB_ENV | |
| echo "CPPFLAGS=-I/usr/local/opt/openblas/include -I/opt/homebrew/opt/openblas/include" >> $GITHUB_ENV | |
| - name: Prepare for Intel cache restore | |
| if: ${{ contains(matrix.toolchain.compiler, 'intel') }} | |
| run: | | |
| sudo mkdir -p /opt/intel | |
| sudo chown $USER /opt/intel | |
| - name: Cache Intel installation | |
| if: ${{ contains(matrix.toolchain.compiler, 'intel') }} | |
| id: cache-install | |
| uses: actions/cache@v4 | |
| with: | |
| path: /opt/intel/oneapi | |
| key: install-${{ matrix.toolchain.compiler }}-${{ matrix.toolchain.version }}-${{ matrix.toolchain.mkl_version }}-${{ matrix.os }} | |
| - name: Install Intel Compiler | |
| if: ${{ contains(matrix.toolchain.compiler, 'intel') && steps.cache-install.outputs.cache-hit != 'true' }} | |
| uses: fortran-lang/setup-fortran@v1 | |
| with: | |
| compiler: ${{ matrix.toolchain.compiler }} | |
| version: ${{ matrix.toolchain.version }} | |
| - name: Install Intel MKL | |
| if: ${{ contains(matrix.toolchain.compiler, 'intel') && steps.cache-install.outputs.cache-hit != 'true' }} | |
| run: | | |
| sudo apt-get install -y \ | |
| intel-oneapi-mkl-${{ matrix.toolchain.mkl_version }} \ | |
| intel-oneapi-mkl-devel-${{ matrix.toolchain.mkl_version }} | |
| - name: Setup Intel oneAPI environment | |
| if: ${{ contains(matrix.toolchain.compiler, 'intel') }} | |
| run: | | |
| source /opt/intel/oneapi/setvars.sh --force | |
| printenv >> $GITHUB_ENV | |
| - name: Set compiler environment variables | |
| run: | | |
| if [ ! -n "$FC" ]; then | |
| if [ "${{ matrix.toolchain.compiler }}" = "gcc" ]; then | |
| echo "FC=gfortran" >> $GITHUB_ENV | |
| echo "CC=gcc" >> $GITHUB_ENV | |
| elif [ "${{ matrix.toolchain.compiler }}" = "intel" ]; then | |
| echo "FC=ifx" >> $GITHUB_ENV | |
| echo "CC=icx" >> $GITHUB_ENV | |
| fi | |
| fi | |
| echo "COMPILER_VERSION=${{ matrix.toolchain.version }}" >> $GITHUB_ENV | |
| # ---------------------------------------------------------------------- | |
| # Dependencies & submodules | |
| # ---------------------------------------------------------------------- | |
| - name: Git submodules checkout | |
| run: git submodule update --init | |
| - name: Install build and test dependencies | |
| run: | | |
| pip3 install ${{ env.PIP_PACKAGES }} ${{ env.PIP_EXTRAS }} | |
| # ---------------------------------------------------------------------- | |
| # Configure | |
| # ---------------------------------------------------------------------- | |
| - name: Configure build (CMake, debug) | |
| if: ${{ matrix.toolchain.build == 'cmake' && matrix.build-type == 'debug' }} | |
| run: > | |
| cmake -B${{ env.BUILD_DIR }} | |
| -GNinja | |
| -DCMAKE_BUILD_TYPE=Debug | |
| -DCMAKE_INSTALL_PREFIX=$PWD/_dist | |
| -DCMAKE_INSTALL_LIBDIR=lib | |
| - name: Configure build (CMake, debugoptimized) | |
| if: ${{ matrix.toolchain.build == 'cmake' && matrix.build-type == 'debugoptimized' }} | |
| run: > | |
| cmake -B${{ env.BUILD_DIR }} | |
| -GNinja | |
| -DCMAKE_BUILD_TYPE=RelWithDebInfo | |
| -DCMAKE_INSTALL_PREFIX=$PWD/_dist | |
| -DCMAKE_INSTALL_LIBDIR=lib | |
| - name: Configure build (Meson, GNU) | |
| if: ${{ matrix.toolchain.build == 'meson' && matrix.toolchain.compiler == 'gcc' }} | |
| run: > | |
| meson setup ${{ env.BUILD_DIR }} | |
| --buildtype=${{ matrix.build-type }} | |
| --prefix=$PWD/_dist | |
| --libdir=lib | |
| --warnlevel=0 | |
| -Dlapack=openblas | |
| - name: Configure build (Meson, Intel) | |
| if: ${{ matrix.toolchain.build == 'meson' && contains(matrix.toolchain.compiler, 'intel') }} | |
| run: > | |
| meson setup ${{ env.BUILD_DIR }} | |
| --buildtype=${{ matrix.build-type }} | |
| --prefix=$PWD/_dist | |
| --libdir=lib | |
| --warnlevel=0 | |
| --native-file=config/intel-llvm.ini | |
| -Dlapack=mkl | |
| # ---------------------------------------------------------------------- | |
| # Build / test / install | |
| # ---------------------------------------------------------------------- | |
| - name: Build project | |
| run: ninja -C ${{ env.BUILD_DIR }} | |
| - name: Run unit tests (ctest) | |
| if: ${{ matrix.toolchain.build == 'cmake' }} | |
| run: | | |
| ctest --output-on-failure --parallel 2 -R '^crest/' | |
| working-directory: ${{ env.BUILD_DIR }} | |
| env: | |
| OMP_NUM_THREADS: 1,2,1 | |
| - name: Install project | |
| run: | | |
| ninja -C ${{ env.BUILD_DIR }} install | |
| echo "CREST_PREFIX=$PWD/_dist" >> $GITHUB_ENV |