Install Packages
This action installs dependencies from multiple package managers for a workflow. This is usually the next step in your workflow after setting up a C++ compiler with Setup C++.
The action currently supports installing packages with apt-get and vcpkg.
A number of auxiliary options are available to customize the behavior of both apt-get and vcpkg.
If vcpkg dependencies are required, vcpkg will be installed and related paths are returned from the action. Both vcpkg and its compiled dependencies are cached.
|
When your library depends on vcpkg for dependencies, it’s important to run the Setup C++ action before this step because vcpkg packages are built from source and this allows us to use the compiler set up in the previous step. |
Next steps
After setting up the dependencies for your C++ project, the next step in your workflow should usually be CMake Workflow.
Alternatively, if your libraries depends on Boost, the next step in your workflow should usually be Boost Clone, which allows the workflow to only download the required subset of Boost libraries required by the project.
Example
steps:
- name: Install packages
uses: alandefreitas/cpp-actions/package-install@v1
id: package-install
with:
vcpkg: ${{ matrix.vcpkg-packages }}
vcpkg-triplet: ${{ matrix.triplet }}
packages: ${{ matrix.install }}
apt-get-ignore-missing: ${{ matrix.is-container }}
cc: ${{ steps.setup-cpp.outputs.cc }}
ccflags: ${{ matrix.ccflags }}
cxx: ${{ steps.setup-cpp.outputs.cxx }}
cxxflags: ${{ matrix.cxxflags }}
Input Parameters
Parameter |
Description |
Default |
|
Trace commands executed by the workflow. |
|
|
List of packages we should install with vcpkg. If any package is included in this list, vcpkg will be installed and the vcpkg toolchain file will be returned. Individual packages can define a custom triplet by appending |
|
|
List of packages we should install with apt-get. Additional options are provided to customize the behavior of apt-get. |
|
|
List of Homebrew formula packages to install. Accepts formula names (e.g., Packages are installed on macOS and Linux (via Linuxbrew). On Windows, this input is silently ignored. |
|
|
List of Homebrew cask packages to install. Casks are macOS GUI applications (e.g., On Linux, cask installs are silently skipped since casks are macOS-only (.app bundles). On Windows, this input is silently ignored. |
|
|
List of Chocolatey packages to install on Windows. Accepts package names (e.g., Packages are installed on Windows only. On macOS and Linux, this input is silently ignored. |
|
|
List of packages to install using the OS-native package manager. Packages are automatically routed to the appropriate package manager based on the runner platform:
Supports the Packages without |
|
|
C++ compiler to be used by vcpkg. If the compiler is not specified, the value will be retrieved from
the environment variable Setting the compiler is particularly important when the compiler being tested is different from the default compiler used by vcpkg. |
|
|
C++ flags used by vcpkg. If the flags are not specified, the value will be retrieved from the environment
variable |
|
|
C compiler used by vcpkg. If the compiler is not specified, the value will be retrieved from the environment
variable |
|
|
C flags used by vcpkg. If the flags are not specified, the value will be retrieved from the environment
variable |
|
|
The triplet used by vcpkg to install packages. If no triplet is specified, a default triplet will be inferred from the platform. Individual packages can override this value by specifying a triplet in the package name. |
|
|
The directory where vcpkg should be cloned and installed. If the directory is unspecified, the runner tool cache is used. |
|
|
vcpkg branch we should use. This is usually the master branch. |
|
|
Whether we should cache vcpkg and its built dependencies. This is useful when you want to speed up your workflow by caching vcpkg and its built dependencies for next workflows. You can disable this option when you want to always build vcpkg and its dependencies from scratch or want to save cache storage. |
|
|
Whether we should force install vcpkg and even when no vcpkg packages are listed. This is useful when you want to use vcpkg in manifest mode. |
|
|
Default number of attempts for all package manager operations. This shared retry count applies to apt-get, brew, and choco installs unless overridden
by a PM-specific retry input (e.g., Each retry uses exponential backoff to handle transient network failures. |
|
|
Number of attempts for Homebrew install operations. Overrides the shared When not provided, brew installs fall back to the shared Each retry uses exponential backoff to handle transient network failures. |
|
|
Number of attempts for Chocolatey install operations. Overrides the shared When not provided, choco installs fall back to the shared The Chocolatey community repository enforces rate limits (~20 downloads/min per IP), and GitHub-hosted runner IPs are shared across many users. This input allows you to configure more retries for choco specifically to handle rate-limit-induced failures. Each retry uses exponential backoff to handle transient network and rate-limit failures. |
|
|
Number of attempts when apt-get fails. Overrides the shared This option is useful when apt-get fails due to a temporary network issue. When calling apt-get to install packages, this passes the For other commands, the command will be called multiple times until it succeeds or the number of retries is exhausted. Each retry will be separated by a delay with an exponential backoff. |
|
|
List of APT repository sources, one per line. Each line can be a PPA (e.g., When paired positionally with |
|
|
List of GPG key URLs for APT sources, one per line. Each key URL is downloaded, dearmored with |
|
|
Whether apt-get should ignore missing packages. This attempts to install packages one by one and passes the |
|
|
Argument to pass to This is useful when installing packages that require a different architecture than the default one. If this string is not empty, it will be passed to Common values for this parameter are: This parameter can also be a list of architectures. |
|
|
This option determines if we should call apt-get once for each package (false) or if we should call apt-get once for all packages (true). This option is useful when installing a large number of packages, since it can speed up the installation process. However, installing libraries individually provides more better information in the logs, which can be useful for debugging. |
|