### Setup vcpkg Action Source: https://github.com/lukka/run-vcpkg/blob/main/README.md This action ensures vcpkg is downloaded and built. It does not install packages by default; package installation is handled later by `run-cmake` using the vcpkg.cmake toolchain. Always specify a version tag (e.g., `v11`) for stability. ```yaml - name: Setup anew (or from cache) vcpkg (and does not build any package) uses: lukka/run-vcpkg@v11 ``` -------------------------------- ### Basic Setup with vcpkg Submodule Source: https://context7.com/lukka/run-vcpkg/llms.txt Sets up vcpkg from a Git submodule and configures CMake to use it for package installation. Requires `actions/checkout@v4` with `submodules: true` and `lukka/get-cmake@latest`. ```yaml name: Build C++ Project on: [push, pull_request] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: submodules: true - uses: lukka/get-cmake@latest - name: Setup vcpkg uses: lukka/run-vcpkg@v11 # vcpkg is automatically detected as submodule at ${{ github.workspace }}/vcpkg - name: Build with CMake uses: lukka/run-cmake@v10 with: configurePreset: 'ninja-multi-vcpkg' buildPreset: 'ninja-multi-vcpkg' ``` -------------------------------- ### Install Dependencies Source: https://github.com/lukka/run-vcpkg/blob/main/CONTRIBUTING.md Run this command to install project dependencies into the ./node_modules directory. ```bash > npm install ``` -------------------------------- ### Complete CMake Workflow with Presets Source: https://context7.com/lukka/run-vcpkg/llms.txt Full workflow using CMake presets for configure, build, and test phases. This example demonstrates a comprehensive CI pipeline integrating vcpkg and CMake. ```yaml name: Full Build Pipeline on: [push, pull_request] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: submodules: true - uses: lukka/get-cmake@latest - name: Setup vcpkg uses: lukka/run-vcpkg@v11 - name: Configure, Build, and Test uses: lukka/run-cmake@v10 with: configurePreset: 'ninja-multi-vcpkg' configurePresetAdditionalArgs: "['-DENABLE_TESTING=ON']" buildPreset: 'ninja-multi-vcpkg' buildPresetAdditionalArgs: "['--config Release']" testPreset: 'ninja-multi-vcpkg' testPresetAdditionalArgs: "['--config Release']" ``` -------------------------------- ### Run vcpkg Install Directly Source: https://context7.com/lukka/run-vcpkg/llms.txt Executes `vcpkg install` directly within the action step. Set `runVcpkgInstall: true` and specify `vcpkgJsonGlob` to locate the manifest file. Packages are then available for CMake. ```yaml jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: submodules: true - name: Setup and run vcpkg install uses: lukka/run-vcpkg@v11 with: runVcpkgInstall: true vcpkgJsonGlob: '**/vcpkg.json' # Packages are now installed, CMake can use them - name: Configure and build run: | cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake cmake --build build ``` -------------------------------- ### vcpkg Action Input Parameters Reference Source: https://context7.com/lukka/run-vcpkg/llms.txt Reference for all available input parameters for the lukka/run-vcpkg action. This includes options for managing vcpkg directory, versioning, installation, caching, and logging. ```yaml - uses: lukka/run-vcpkg@v11 with: # Path to vcpkg root directory (default: ${{ github.workspace }}/vcpkg) vcpkgDirectory: '${{ github.workspace }}/vcpkg' # Git commit SHA for vcpkg version (not needed if using submodule) vcpkgGitCommitId: '5b1214315250939257ef5d62ecdcbca18cf4fb1c' # Git URL for vcpkg repository vcpkgGitURL: 'https://github.com/microsoft/vcpkg.git' # Run vcpkg install command (default: false) runVcpkgInstall: true # Glob pattern to find vcpkg.json vcpkgJsonGlob: '**/vcpkg.json' # Patterns to ignore when searching for vcpkg.json vcpkgJsonIgnores: "['**/vcpkg/**']" # Glob pattern for vcpkg-configuration.json vcpkgConfigurationJsonGlob: '**/vcpkg-configuration.json' # Skip vcpkg Git update (default: false) doNotUpdateVcpkg: false # Disable vcpkg executable caching (default: true) doNotCache: true # Custom binary cache path binaryCachePath: '${{ runner.workspace }}/vcpkg_cache' # Custom vcpkg install command format runVcpkgFormatString: '[`install`, `--recurse`, `--clean-after-build`]' # Shell configuration (default: true) useShell: true # Regex patterns for log collection logCollectionRegExps: '...' ``` -------------------------------- ### Custom vcpkg Install Command Source: https://context7.com/lukka/run-vcpkg/llms.txt Customizes the `vcpkg install` command format string with specific arguments. Use `runVcpkgInstall: true` and `runVcpkgFormatString` to define the command. ```yaml jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: submodules: true - name: Setup vcpkg with custom install uses: lukka/run-vcpkg@v11 with: runVcpkgInstall: true runVcpkgFormatString: '[`install`, `--recurse`, `--clean-after-build`, `--x-install-root`, `$[env.VCPKG_INSTALLED_DIR]`, `--triplet`, `$[env.VCPKG_DEFAULT_TRIPLET]`]' ``` -------------------------------- ### Install Latest CMake and Ninja Source: https://github.com/lukka/run-vcpkg/blob/main/README.md Use this action to install the latest stable versions of CMake and Ninja. You can also pin to a specific CMake version by using a version tag like `@v3.27`. ```yaml steps: - uses: lukka/get-cmake@latest ``` -------------------------------- ### Run CMake with vcpkg Integration Source: https://github.com/lukka/run-vcpkg/blob/main/README.md This action configures, builds, and tests your project using CMake presets. It integrates with vcpkg to install dependencies specified in `vcpkg.json` via the vcpkg.cmake toolchain. You can specify presets for configuration, building, and testing, with options to pass additional arguments. ```yaml - name: Run CMake consuming CMakePreset.json and run vcpkg to build packages uses: lukka/run-cmake@v10 with: configurePreset: 'ninja-multi-vcpkg' configurePresetAdditionalArgs: "['-DENABLE_YOUR_FEATURE=1']" buildPreset: 'ninja-multi-vcpkg' buildPresetAdditionalArgs: "['--config Release']" testPreset: 'ninja-multi-vcpkg' testPresetAdditionalArgs: "['--config Release']" ``` -------------------------------- ### Setup vcpkg with Specific Git Commit ID Source: https://context7.com/lukka/run-vcpkg/llms.txt Configures vcpkg from a specific Git commit ID when not using submodules. Specify the `vcpkgGitCommitId` and `vcpkgDirectory`. ```yaml jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: lukka/get-cmake@latest - name: Setup vcpkg with specific version uses: lukka/run-vcpkg@v11 with: vcpkgGitCommitId: '5b1214315250939257ef5d62ecdcbca18cf4fb1c' vcpkgDirectory: '${{ github.workspace }}/vcpkg' ``` -------------------------------- ### Configure vcpkg Environment Variables in GitHub Actions Source: https://context7.com/lukka/run-vcpkg/llms.txt Set environment variables to customize vcpkg behavior within a GitHub Actions job. These variables control triplets, telemetry, binary sources, and installation directories. ```yaml jobs: build: runs-on: ubuntu-latest env: # Specify default triplet VCPKG_DEFAULT_TRIPLET: x64-linux # Specify host triplet (for cross-compilation) VCPKG_DEFAULT_HOST_TRIPLET: x64-linux # Enable vcpkg telemetry (disabled by default) VCPKG_ENABLE_METRICS: 1 # Custom binary sources configuration VCPKG_BINARY_SOURCES: 'clear;files,${{ github.workspace }}/vcpkg_cache,readwrite' # Custom installed directory VCPKG_INSTALLED_DIR: '${{ github.workspace }}/vcpkg_installed' steps: - uses: actions/checkout@v4 with: submodules: true - uses: lukka/run-vcpkg@v11 ``` -------------------------------- ### Specify Dependencies with vcpkg.json Source: https://github.com/lukka/run-vcpkg/blob/main/README.md Use a vcpkg.json manifest file to declaratively specify project dependencies. This file is automatically used by CMake when the vcpkg.cmake toolchain is active and a vcpkg.json file exists in the root source directory. It is also used when invoking 'vcpkg install' in a directory containing vcpkg.json. Storing this file under source control is recommended for consistent builds. ```json { "name": "my-project", "version-string": "1.0.0", "dependencies": [ "zlib", "fmt" ] } ``` -------------------------------- ### Build and Package Project Source: https://github.com/lukka/run-vcpkg/blob/main/CONTRIBUTING.md Run this command to execute the linter, build the project, and package it for release. ```bash > npm run repack ``` -------------------------------- ### Package Extension for Release Source: https://github.com/lukka/run-vcpkg/blob/main/CONTRIBUTING.md Run this command to package the extension for release purposes. ```bash > npm run pack ``` -------------------------------- ### Run Test Suite Source: https://github.com/lukka/run-vcpkg/blob/main/CONTRIBUTING.md Execute this command to run all tests in the test suite. ```bash > npm run test ``` -------------------------------- ### Build Project with TypeScript Source: https://github.com/lukka/run-vcpkg/blob/main/CONTRIBUTING.md Execute this command to compile TypeScript code into JavaScript. ```bash > npm run build ``` -------------------------------- ### Configure NPM for GitHub Packages Source: https://github.com/lukka/run-vcpkg/blob/main/CONTRIBUTING.md Create a .npmrc file in the root of the repository to authenticate with the GitHub Packages registry. Replace YOURTOKEN with your actual token. Do not commit this file. ```ini //npm.pkg.github.com/:_authToken=YOURTOKEN @lukka:registry=https://npm.pkg.github.com/ ``` -------------------------------- ### Run Linter Source: https://github.com/lukka/run-vcpkg/blob/main/CONTRIBUTING.md Execute this command to run the project's linter and check for code style issues. ```bash > npm run lint ``` -------------------------------- ### Configure Custom Log Collection Patterns for vcpkg Source: https://context7.com/lukka/run-vcpkg/llms.txt Configure custom regex patterns for collecting log files from build output. This allows for targeted extraction of specific log information during the build process. ```yaml jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: submodules: true - name: Setup vcpkg with custom log collection uses: lukka/run-vcpkg@v11 with: logCollectionRegExps: '\s*"(.+CMakeOutput\.log)"\.\s*;\s*"(.+CMakeError\.log)"\.\s*;(.+\.log)\s*' runVcpkgInstall: true ``` -------------------------------- ### Enable vcpkg Executable Caching Source: https://context7.com/lukka/run-vcpkg/llms.txt Enables caching of the vcpkg executable itself, which is particularly useful for ARM platforms. Set `doNotCache: false` to enable this feature. ```yaml jobs: build: runs-on: self-hosted # ARM runner steps: - uses: actions/checkout@v4 with: submodules: true - name: Setup vcpkg with executable caching uses: lukka/run-vcpkg@v11 with: doNotCache: false # Enable vcpkg executable caching ``` -------------------------------- ### Multi-Platform Workflow with Explicit Triplet Source: https://context7.com/lukka/run-vcpkg/llms.txt Builds across multiple platforms by defining a matrix strategy with explicit triplets for each OS. Sets environment variables `VCPKG_DEFAULT_TRIPLET` and `VCPKG_DEFAULT_HOST_TRIPLET`. ```yaml jobs: build: strategy: matrix: include: - os: ubuntu-latest triplet: x64-linux - os: windows-latest triplet: x64-windows - os: macos-latest triplet: x64-osx runs-on: ${{ matrix.os }} env: VCPKG_DEFAULT_TRIPLET: ${{ matrix.triplet }} VCPKG_DEFAULT_HOST_TRIPLET: ${{ matrix.triplet }} steps: - uses: actions/checkout@v4 with: submodules: true - uses: lukka/get-cmake@latest - name: Setup vcpkg uses: lukka/run-vcpkg@v11 - name: Build uses: lukka/run-cmake@v10 with: configurePreset: 'ninja-multi-vcpkg' buildPreset: 'ninja-multi-vcpkg' buildPresetAdditionalArgs: "['--config Release']" ``` -------------------------------- ### Configure Custom Binary Cache Path for vcpkg Source: https://context7.com/lukka/run-vcpkg/llms.txt Specify a custom path for vcpkg's binary cache artifacts. This is useful for managing build artifacts across different CI runs or environments. ```yaml jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: submodules: true - name: Setup vcpkg with custom cache path uses: lukka/run-vcpkg@v11 with: binaryCachePath: '${{ runner.workspace }}/vcpkg_cache' runVcpkgInstall: true ``` -------------------------------- ### Run Specific Test by Name Source: https://github.com/lukka/run-vcpkg/blob/main/CONTRIBUTING.md Use this command to run a specific test by providing a regular expression that matches its name. Replace `` with the actual pattern. ```bash > npx jest -t `` ``` -------------------------------- ### Handle Windows Paths in GitHub Actions Source: https://github.com/lukka/run-vcpkg/blob/main/README.md When using `github.workspace` in GitHub Actions on Windows, backslashes can be misinterpreted as escape sequences. Use the `String.raw` function to prevent this processing when constructing paths for arguments, ensuring correct path interpretation. ```yaml with: configurePresetAdditionalArgs: "[ String.raw`-DD3D9_INCLUDE_DIR=${{ github.workspace }}/cache/Include` ]" ``` -------------------------------- ### Custom vcpkg Repository URL Source: https://context7.com/lukka/run-vcpkg/llms.txt Uses a custom Git repository URL for vcpkg, such as a fork or mirror. Specify `vcpkgGitURL` and optionally `vcpkgGitCommitId`. ```yaml jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Setup vcpkg from custom repository uses: lukka/run-vcpkg@v11 with: vcpkgGitURL: 'https://github.com/my-org/vcpkg-fork.git' vcpkgGitCommitId: 'abc123def456' ``` -------------------------------- ### Skip vcpkg Update When Managed Externally Source: https://context7.com/lukka/run-vcpkg/llms.txt Prevent vcpkg from updating when it's managed externally. This ensures that a specific version of vcpkg is used, especially when checked out separately. ```yaml jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 # vcpkg checked out separately - uses: actions/checkout@v4 with: repository: microsoft/vcpkg path: vcpkg ref: '2024.01.12' - name: Bootstrap vcpkg run: ./vcpkg/bootstrap-vcpkg.sh - name: Setup vcpkg without update uses: lukka/run-vcpkg@v11 with: vcpkgDirectory: '${{ github.workspace }}/vcpkg' doNotUpdateVcpkg: true ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.