Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?

Action Status

Build C++ software with the multi-platform run-cmake action by running CMake on GitHub workflows. Samples provided use GitHub hosted runners and Caching.

Good companions are the run-vcpkg action and the get-cmake action.

User Manual

Developer Manual

It is highly recommended to use vcpkg as a submodule. Here below the sample where vcpkg is stored in a Git submodule:

  # Sample when vcpkg is a submodule of your repository (highly recommended!)

    # Cache/Restore the vcpkg's build artifacts.
    - name: Run vcpkg
      uses: lukka/run-vcpkg@v4
      with:
       # Response file stored in source control, it provides the list of ports and triplet(s).
        vcpkgArguments: '@${{ env.vcpkgResponseFile }}'
       # Location of the vcpkg as submodule of the repository.
        vcpkgDirectory: '${{ github.workspace }}/vcpkg'

    - name: 'Run CMake with Ninja'
      uses: lukka/run-cmake@v3
      with:
        cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
        cmakeListsTxtPath: '${{ github.workspace }}/cmakesettings.json/CMakeLists.txt'
        useVcpkgToolchainFile: true
        buildDirectory: '${{ runner.workspace }}/b//unixmakefiles'
        cmakeAppendedArgs: '-GNinja '
        # Or build multiple configurations out of a CMakeSettings.json file created with Visual Studio.
        # cmakeListsOrSettingsJson: CMakeSettingsJson
        # cmakeSettingsJsonPath: '${{ github.workspace }}/cmakesettings.json/CMakeSettings.json'
        # configurationRegexFilter: '${{ matrix.configuration }}'

run-cmake flowchart

This action behaves the same way as it does the run-cmake task for Azure DevOps.

The documentation of the 'run-cmake" action is identical to the 'run-cmake' task's one for Azure DevOps.

Features available only in the GitHub version of 'run-cmake':

  • Annotations for CMake errors/warnings and for build (gcc/msvc/clang) errors/warning are created inline in the changed source files the build run for, e.g.: Annotation

action.yml

View the workflows based on the run-cmake and run-vcpkg actions.

CMakeLists.txt samples
Linux/macOS/Windows, hosted runner, basic Actions Status
Linux/macOS/Windows, hosted runner, advanced Actions Status
Linux/macOS/Windows, hosted runner, with cache and vcpkg as submodule Actions Status
CMakeSettings.json samples
Linux/macOS/Windows, hosted runner, with cache and vcpkg as submodule Actions Status
Project Platform(s)
CppOpenGLWebAssemblyCMake WASM/Linux/macOS Actions Status
quiniouben/vban Windows/Linux CI
OPM/ResInsight Windows/Linux CI
iovw/Notepad-- Windows CI
Mudlet/Mudlet Linux/macOS Build Mudlet
otland/forgottenserver Linux/macOS/Windows Build with vcpkg
Element-0/ElementZero Windows CI
assimp/assimp Linux/macOS/Windows C/C++ CI
sony/nmos-cpp Linux/macOS/Windows build-test
RaftLib/RaftLib Linux/macOS/Windows CI
zealdocs/zeal Linux/Windows Build Check
marian-nmt/marian-dev Windows/Linux/macOS Windows Linux macOS
GrinPlusPlus Linux/Windows/macOS ci

Developers information

Prerequisites

gulp 4 globally installed.

Setup for GitHub Registry public packages

run-vcpkg depends on public NPM packages published by lukka/run-cmake-vcpkg-action-libs in the GitHub Packages registry. Unexpectedly, a public package still requires authentication when downloading it, hence if you want to npm install those packages correctly, you need to obtain a token with read:packages scope. Then create in the root of the repository a .npmrc file with the following content:

//npm.pkg.github.com/:_authToken=YOURTOKEN @lukka:registry=https://npm.pkg.github.com/

Note: Never commit this .npmrc file!

Build and lint

Build with tsc running:

npm run build

Launch lint by:

npm run lint

Packaging

To build, lint validate and package the extension for release purpose, run:

npm run pack

Testing

To build, pack and test:

npm run test

To run test directly:

jest

Validation tests on various scenarios are run using the workflows of the Samples.

The software is provided as is, there is no warranty of any kind. All users are encouraged to improve the source code with fixes and new features.

License

All the content in this repository is licensed under the MIT License.

Copyright (c) 2019-2020 Luca Cappa

Donating

Other than submitting a pull request, donating is another way to contribute to this project.