Skip to content

conan-io/setup-conan

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Setup Conan Action Github Action

Validate Conan Action GitHub Marketplace

A GitHub Action to install and configure the Conan package manager in your workflow. This action provides a simple and flexible way to set up Conan with custom configurations and audit settings.

Features

  • 🚀 Install any version of Conan 2.x
  • ⚙️ Apply custom Conan configurations
  • 🔐 Configure audit tokens for dependencies vulnerabilities scanning
  • 🗂️ Cache Conan packages using GitHub cache
  • 🔍 Support for custom Conan home
  • 💪 Cross-platform support

Usage

Basic Usage

Install Conan, authenticate to Audit server, install custom configurations:

steps:
  - name: Checkout code
    uses: actions/checkout@v4

  - name: Install Conan
    uses: conan-io/setup-conan@v1
    with:
      audit_token: ${{ secrets.CONAN_AUDIT_TOKEN }}
      config_urls: |
        https://github.com/<org>/conan-config.git
        https://myrepo.com/conan-config.git

  - name: Install Conan dependencies
    run: conan install . --build=missing

Using Lockfiles

In order to ensure repeatability, the use of lockfiles on the consumer side is greatly encouraged:

  - name: Install Conan dependencies with lockfile
    run: conan install . --lockfile=conan.lock --lockfile-partial --lockfile-out=conan.lock --build=missing

Lockfiles ensure that Conan will resolve the same graph in a repeatable and consistent manner - thus making sure the same versions are used across multiple systems (CI, developers, etc).

Lockfiles are strict by default, that means that if there is some requires and it cannot find a matching locked reference in the lockfile, it will error and stop. For cases where it is expected that the lockfile will not be complete, as there might be new dependencies, the --lockfile-partial argument can be used.

By default, conan install will not generate an output lockfile, but if the --lockfile-out argument is provided, pointing to a filename, then a lockfile will be generated from the current dependency graph. The same lockfile can be cached or stored in the repository, so that it can be used in the future.

Options

This Github Action offers options inputs to execute extra steps just after installing Conan. This is useful for installing custom configurations or applying any other setup you need. It's possible to customize the action using the following options:

Option Type Description
version string Conan client version 2.x to be installed. By default, it's the latest version available.
home string A custom path to be used as Conan cache directory.
audit_token string The Conan audit token to authenticate to the Audit server with Conan.
config_urls list URLs of the Git repositories containing the custom Conan configurations to be installed.
cache_packages boolean Cache all stored Conan packages, under Conan cache, using Github cache support. false by default
python_version string DEPRECATED Use the Python version set in the GitHub runner instead or a GitHub Action to set up Python.

Using setup-python Action alongside setup-conan

If you are using the setup-python action in your workflow, you can use it alongside the setup-conan action. However, keep in mind PKG_CONFIG_PATH is configured by the setup-python action, so it may break the Conan build in case needing to consume .pc files generated by Conan. As workaround, you can clear the PKG_CONFIG_PATH environment variable before running the Conan install command:

  - name: Install Python
    uses: actions/setup-python@v4
    with:
      python-version: '3.x'

  - name: Clear PKG_CONFIG_PATH
    shell: bash
    run: echo "PKG_CONFIG_PATH=" >> $GITHUB_ENV

  - name: Install Conan dependencies
    run: conan install . --build=missing

For further details on how to manage enviroment variables of setup-python action, please refer to the setup-python documentation.

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

A GitHub Action to install and configure the Conan package manager in your workflow

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •