clap

CLAP Audio Plugin API
Log | Files | Refs | README | LICENSE

commit 9c3eef24ceee1552e7bca6484eee1e4f808b44a0
parent 49697a6a6577912003babf7fb27d2b599be46226
Author: Alexandre BIQUE <bique.alexandre@gmail.com>
Date:   Fri,  3 Dec 2021 17:46:56 +0100

Rework github workflow

Diffstat:
M.github/workflows/cmake.yml | 87+++++++++++++++++++++++++++++++++++--------------------------------------------
A.github/workflows/properties/build.properties.json | 7+++++++
ACMakePresets.json | 40++++++++++++++++++++++++++++++++++++++++
3 files changed, 86 insertions(+), 48 deletions(-)

diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml @@ -1,54 +1,45 @@ -name: CMake - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -env: - # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) - BUILD_TYPE: Release +# Copyright (c) 2021 Luca Cappa +# Released under the term specified in file LICENSE.txt +# SPDX short identifier: MIT +# +# The peculiarity of this workflow is that assumes vcpkg stored as a submodule of this repository. +# This workflow does the following: +# - Restores vcpkg artifacts from cache. +# - Sets up vcpkg if needed, then run CMake with CMakePreset.json using a configuration +# that leverages the vcpkg's toolchain file. This will automatically run vcpkg to install dependencies +# described by the vcpkg.json manifest file. It will be a no-op if those are restored from cache. +# - Finally builds the sources with Ninja. +name: build +on: [push, workflow_dispatch] jobs: - build: - # The CMake configure and build commands are platform agnostic and should work equally - # well on Windows or Mac. You can convert this to a matrix build if you need - # cross-platform coverage. - # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix - name: ${{ matrix.config.name }} - runs-on: ${{ matrix.config.os }} + VCPKG: + name: ${{ matrix.os }}-${{ github.workflow }} + runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: - config: - - { - name: "linux", - os: ubuntu-latest - } - - { - name: "windows", - os: windows-latest - } - - { - name: "linux", - os: macos-latest - } + os: [ubuntu-latest, macos-latest, windows-latest] steps: - - uses: actions/checkout@v2 - - - 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}} - - - 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}} - + - uses: actions/checkout@v2 + with: + submodules: true + + - uses: lukka/get-cmake@latest + + - name: Setup MacOS + if: startsWith(matrix.os, 'macOS') + run: brew install automake autoconf ninja cmake + + - name: Setup Ubuntu + if: startsWith(matrix.os, 'ubuntu') + run: sudo apt install ninja-build cmake + + - name: Run CMake+Ninja+CTest to generate/build/test. + uses: lukka/run-cmake@v10 + id: runcmake + with: + configurePreset: 'ninja' + buildPreset: 'ninja-release' + testPreset: 'ninja-release' diff --git a/.github/workflows/properties/build.properties.json b/.github/workflows/properties/build.properties.json @@ -0,0 +1,6 @@ +{ + "name": "clap", + "description": "Build C/C++ code with CMake and Ninja.", + "iconName": "cmake", + "categories": ["CMake", "cpp", "cplusplus", "Ninja"] +} +\ No newline at end of file diff --git a/CMakePresets.json b/CMakePresets.json @@ -0,0 +1,39 @@ +{ + "version": 3, + "cmakeMinimumRequired": { + "major": 3, + "minor": 17, + "patch": 0 + }, + "configurePresets": [ + { + "name": "ninja", + "displayName": "Ninja", + "description": "Configure and generate Ninja project files for all configurations", + "binaryDir": "${sourceDir}/builds/${presetName}", + "generator": "Ninja Multi-Config", + "cacheVariables": { + "CMAKE_EXPORT_COMPILE_COMMANDS": { + "type": "boolean", + "value": true + } + } + } + ], + "buildPresets": [ + { + "name": "ninja-release", + "configurePreset": "ninja", + "displayName": "Build ninja-release", + "description": "Build ninja Release configuration", + "configuration": "RelWithDebInfo" + } + ], + "testPresets": [ + { + "name": "ninja-release", + "configurePreset": "ninja", + "configuration": "RelWithDebInfo" + } + ] +} +\ No newline at end of file