Skip to content

Trying to fix github workflows 2 #29

Trying to fix github workflows 2

Trying to fix github workflows 2 #29

Workflow file for this run

name: CMake
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
jobs:
build:
name: OS ${{ matrix.os }} | Compiler ${{ matrix.compiler-name }} | Version ${{ matrix.compiler-version }}
strategy:
fail-fast: false
matrix:
os: [ macos-latest, ubuntu-latest ]
compiler-version: [ '' ]
compiler-name: [ '' ]
cc: [ '' ]
cxx: [ '' ]
include:
# MacOS CLANG
- os: macos-latest
compiler-name: llvm
compiler-version: 14
cc: /usr/local/opt/llvm@14/bin/clang-14
cxx: /usr/local/opt/llvm@14/bin/clang++
- os: macos-latest
compiler-name: llvm
compiler-version: 15
cc: /usr/local/opt/llvm@15/bin/clang-15
cxx: /usr/local/opt/llvm@15/bin/clang++
- os: macos-latest
compiler-name: llvm
compiler-version: 16
cc: /usr/local/opt/llvm@16/bin/clang-16
cxx: /usr/local/opt/llvm@16/bin/clang++
- os: macos-latest
compiler-name: llvm
compiler-version: 17
cc: /usr/local/opt/llvm@17/bin/clang-17
cxx: /usr/local/opt/llvm@17/bin/clang++
# MacOS GCC
- os: macos-latest
compiler-name: gcc
compiler-version: 10
cc: gcc-10
cxx: g++-10
- os: macos-latest
compiler-name: gcc
compiler-version: 11
cc: gcc-11
cxx: g++-11
- os: macos-latest
compiler-name: gcc
compiler-version: 12
cc: gcc-12
cxx: g++-12
- os: macos-latest
compiler-name: gcc
compiler-version: 13
cc: gcc-13
cxx: g++-13
# Ubuntu CLANG
- os: ubuntu-latest
compiler-name: llvm
compiler-version: 14
cc: clang-14
cxx: clang++-14
- os: ubuntu-latest
compiler-name: llvm
compiler-version: 15
cc: clang-15
cxx: clang++-15
# - os: ubuntu-latest
# compiler-name: llvm
# compiler-version: 16
# cc: clang-16
# cxx: clang++-16
# - os: ubuntu-latest
# compiler-name: llvm
# compiler-version: 17
# cc: clang-17
# cxx: clang++-17
# Ubuntu GCC
- os: ubuntu-latest
compiler-name: gcc
compiler-version: 10
cc: gcc-10
cxx: g++-10
- os: ubuntu-latest
compiler-name: gcc
compiler-version: 11
cc: gcc-11
cxx: g++-11
- os: ubuntu-latest
compiler-name: gcc
compiler-version: 12
cc: gcc-12
cxx: g++-12
- os: ubuntu-latest
compiler-name: gcc
compiler-version: 13
cc: gcc-13
cxx: g++-13
# Exclude the "base cases"
exclude:
- os: macos-latest
compiler-version: ''
compiler-name: ''
cc: ''
cxx: ''
- os: ubuntu-latest
compiler-version: ''
compiler-name: ''
cc: ''
cxx: ''
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install LLVM on MacOS
if: ${{ matrix.os == 'macos-latest' && matrix.compiler-name == 'llvm' }}
run: brew update && brew install llvm@${{ matrix.compiler-version }}
- name: Install GCC on MacOS
if: ${{ matrix.os == 'macos-latest' && matrix.compiler-name == 'gcc' }}
run: brew update && brew install gcc@${{ matrix.compiler-version }}
- name: Install LLVM on Ubuntu
if: ${{ matrix.os == 'ubuntu-latest' && matrix.compiler-name == 'llvm' }}
run: sudo apt-get install -y clang-${{ matrix.compiler-version }} libomp-${{ matrix.compiler-version }}-dev
- name: Install GCC on Ubuntu
if: ${{ matrix.os == 'ubuntu-latest' && matrix.compiler-name == 'gcc' }}
run: sudo apt-get install -y g++-${{ matrix.compiler-version }}
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} ${{ matrix.extra-cmake-arguments }}
- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Test
working-directory: ${{github.workspace}}/build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{env.BUILD_TYPE}} -V
sonar:
name: SonarCloud
runs-on: ubuntu-latest
env:
SONAR_SCANNER_VERSION: 5.0.1.3006 # Find the latest version in the "Linux" link on this page:
# https://sonarcloud.io/documentation/analysis/scan/sonarscanner/
SONAR_SERVER_URL: "https://sonarcloud.io"
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 11
- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Download and set up sonar-scanner
env:
SONAR_SCANNER_DOWNLOAD_URL: https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${{ env.SONAR_SCANNER_VERSION }}-linux.zip
run: |
mkdir -p $HOME/.sonar
curl -sSLo $HOME/.sonar/sonar-scanner.zip ${{ env.SONAR_SCANNER_DOWNLOAD_URL }}
unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
echo "$HOME/.sonar/sonar-scanner-${{ env.SONAR_SCANNER_VERSION }}-linux/bin" >> $GITHUB_PATH
- name: Download and set up build-wrapper
env:
BUILD_WRAPPER_DOWNLOAD_URL: ${{ env.SONAR_SERVER_URL }}/static/cpp/build-wrapper-linux-x86.zip
run: |
curl -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip ${{ env.BUILD_WRAPPER_DOWNLOAD_URL }}
unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/
echo "$HOME/.sonar/build-wrapper-linux-x86" >> $GITHUB_PATH
- name: Run build-wrapper
run: |
mkdir build
cmake -S . -B build
build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build build/ --config Release
- name: Run sonar-scanner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
sonar-scanner --define sonar.host.url="${{ env.SONAR_SERVER_URL }}" --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}"