Add a basic version of cmake presets #1382
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: Build | |
| on: | |
| push: | |
| branches: [development, main] | |
| paths-ignore: | |
| - 'README.md' | |
| - 'INSTALL.md' | |
| - 'docs/**' | |
| pull_request: | |
| branches: [development, main] | |
| paths-ignore: | |
| - 'README.md' | |
| - 'INSTALL.md' | |
| - 'docs/**' | |
| workflow_dispatch: | |
| inputs: | |
| debug_enabled: | |
| type: boolean | |
| description: 'Run the build with tmate debugging enabled' | |
| required: false | |
| default: true | |
| jobs: | |
| run: | |
| strategy: | |
| matrix: | |
| include: | |
| - name: "[Ubuntu] gcc" | |
| os: ubuntu-latest | |
| CC: gcc | |
| CXX: g++ | |
| CXXFLAGS: -O3 -Wall -pedantic -Wshadow -Wsign-compare -Wuninitialized -Wtype-limits -Wignored-qualifiers -Wempty-body -Wextra -Wno-unused-parameter -Werror -Wno-strict-aliasing -Wno-maybe-uninitialized | |
| FC: gfortran | |
| GCOV: gcov | |
| OCCA_COVERAGE: 1 | |
| OCCA_FORTRAN_ENABLED: 1 | |
| - name: "[Ubuntu] CMake + gcc" | |
| os: ubuntu-latest | |
| cmakeWorkflowPreset: gnu-default | |
| - name: "[Ubuntu] CMake + clang" | |
| os: ubuntu-latest | |
| cmakeWorkflowPreset: clang-default | |
| - name: "[Ubuntu] CMake + Intel/LLVM" | |
| os: ubuntu-latest | |
| cmakeWorkflowPreset: oneapi-default | |
| runs-on: ${{ matrix.os }} | |
| name: ${{ matrix.name }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup tmate session | |
| uses: mxschmitt/[email protected] | |
| if: ${{ inputs.debug_enabled }} | |
| - name: Set OCCA install directory | |
| run: echo "OCCA_INSTALL_DIR=${PWD}/install" >> ${GITHUB_ENV} | |
| - name: add oneAPI to apt | |
| if: ${{ matrix.cmakeWorkflowPreset == 'oneapi-default' }} | |
| shell: bash | |
| run: | | |
| cd /tmp | |
| wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | |
| sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | |
| rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | |
| sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main" | |
| - name: install oneAPI dpcpp compiler | |
| if: ${{ matrix.cmakeWorkflowPreset == 'oneapi-default' }} | |
| shell: bash | |
| run: | | |
| sudo apt update | |
| sudo apt install intel-oneapi-compiler-dpcpp-cpp | |
| sudo apt install intel-oneapi-compiler-fortran | |
| - name: Compiler info | |
| if: ${{ !matrix.cmakeWorkflowPreset }} | |
| run: make PREFIX=${OCCA_INSTALL_DIR} -j 16 info | |
| - name: CMake configure, build and install | |
| if: ${{ matrix.cmakeWorkflowPreset }} | |
| run: | | |
| if [[ "${{ matrix.cmakeWorkflowPreset }}" == "oneapi-default" ]]; then | |
| source /opt/intel/oneapi/setvars.sh | |
| fi | |
| cmake --workflow --preset ${{ matrix.cmakeWorkflowPreset }} | |
| - name: CMake build examples as an independent project | |
| if: ${{ matrix.useCMake && !matrix.useoneAPI}} | |
| run: | | |
| export OCCA_DIR=${OCCA_INSTALL_DIR} | |
| cd examples | |
| cmake -S . -B build | |
| - name: CMake build tests as an independent project | |
| if: ${{ matrix.useCMake && !matrix.useoneAPI}} | |
| run: | | |
| export OCCA_DIR=${OCCA_INSTALL_DIR} | |
| cd tests | |
| cmake -S . -B build | |
| - name: Compile library and install | |
| if: ${{ !matrix.cmakeWorkflowPreset }} | |
| run: make -j 16 | |
| - name: Compile tests | |
| if: ${{ !matrix.cmakeWorkflowPreset }} | |
| run: make -j 16 tests | |
| - name: Run unit tests | |
| if: ${{ !matrix.cmakeWorkflowPreset }} | |
| run: ./tests/run_tests | |
| - name: Run examples | |
| if: ${{ !matrix.cmakeWorkflowPreset }} | |
| run: ./tests/run_examples | |
| - name: Upload code coverage | |
| if: ${{ matrix.OCCA_COVERAGE }} | |
| run: bash <(curl --no-buffer -s https://codecov.io/bash) -x "${GCOV}" | |
| - name: Block to allow inspecting failures | |
| run: sleep 1800 | |
| if: ${{ failure() && inputs.debug_enabled }} |