The run-vcpkg action for using vcpkg on GitHub
Build C++ software with the multi-platform run-vcpkg action by running vcpkg on GitHub workflows. Samples provided use GitHub hosted runners and Caching.
A good companion is the run-cmake action.
User Manual
Developer Manual
Quickstart
It is highly recommended to use vcpkg as a submodule. Here below the sample where vcpkg is a Git submodule:
# Sample when vcpkg is a submodule of your repository (highly recommended!)
# Cache/Restore the vcpkg's build artifacts.
- name: Cache vcpkg's artifacts
uses: actions/cache@v1
with:
path: ${{ github.workspace }}/vcpkg/
# The key will be different each time a different version of vcpkg is used, or different ports are installed.
key: ${{ hashFiles( env.vcpkgResponseFile ) }}-${{ hashFiles('.git/modules/vcpkg/HEAD') }}-${{ runner.os }}
- name: Run vcpkg
uses: lukka/run-vcpkg@v0
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@v0
with:
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
cmakeListsTxtPath: '${{ github.workspace }}/cmakesettings.json/CMakeLists.txt'
useVcpkgToolchainFile: true
buildDirectory: '${{ runner.workspace }}/b//unixmakefiles'
cmakeAppendedArgs: '-G "Ninja" '
# 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 }}'
The run-vcpkg action
This action behaves the same way as it does the run-vcpkg task for Azure DevOps.
The documentation of the 'run-vcpkg" action is identical to the 'run-vcpkg' task's one for Azure DevOps.
Action reference: all input/output parameters
Samples
View the workflows based on the run-cmake and run-vcpkg actions.
CMakeLists.txt samples | |
---|---|
Linux/macOS/Windows, hosted runner, basic | |
Linux/macOS/Windows, hosted runner, advanced | |
Linux/macOS/Windows, hosted runner, with cache and vcpkg as submodule |
CMakeSettings.json samples | |
---|---|
Linux/macOS/Windows, hosted runner, with cache and vcpkg as submodule |
Real world project samples
project: CppOpenGLWebAssemblyCMake | |
---|---|
WASM, Linux, macOS |
Developers information
Prerequisites
gulp 4 globally installed.
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
Smoke tests are implemented in this repository, which run the action on all platforms.
Rigorous tests are executed in the builds of CppBuildTasks repository that shares the same engine in the run-cmake-vcpkg-action-libs submodule.
It would be desirable to have extensive tests implemented in this repository as well.
Validation tests on various scenarios are run using the workflows of the Samples.
Contributing
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