From 9e675a748a9f30e48f063bd36e45f0fea11a7792 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Sat, 30 Oct 2021 05:22:48 -0500 Subject: [PATCH] Add example for C++ conan --- README.md | 1 + examples.md | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/README.md b/README.md index db21699..90ad6a6 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,7 @@ Every programming language and framework has its own way of caching. See [Examples](examples.md) for a list of `actions/cache` implementations for use with: - [C++ - vcpkg](./examples.md#c++---vcpkg) +- [C++ - Conan](./examples.md#c++---conan) - [C# - Nuget](./examples.md#c---nuget) - [D - DUB](./examples.md#d---dub) - [Elixir - Mix](./examples.md#elixir---mix) diff --git a/examples.md b/examples.md index 7b31e9f..54b3de2 100644 --- a/examples.md +++ b/examples.md @@ -1,6 +1,7 @@ # Examples - [C++ - vcpkg](#c++---vcpkg) +- [C++ - Conan](#c++---conan) - [C# - NuGet](#c---nuget) - [D - DUB](#d---dub) - [POSIX](#posix) @@ -65,6 +66,32 @@ env: restore-keys: | ${{ runner.os }}-${{ env.BUILD_TYPE }} ``` + +## C++ - Conan + +Using [Conan](https://docs.conan.io/en/latest/) + +```yaml +# Set the environment variables +env: + BUILD_TYPE: Debug + CONAN_SYSREQUIRES_MODE: enabled + CONAN_USER_HOME: "./conan-cache" + CONAN_USER_HOME_SHORT: "./conan-cache/short" +``` + +```yaml + - name: Cache + uses: actions/cache@v2 + with: + path: | + ${{ env.CONAN_USER_HOME }} + ~/.cache/pip + key: ${{ runner.os }}-${{ env.BUILD_TYPE }}-${{ hashFiles('**/CMakeLists.txt') }}-${{ hashFiles('./conanfile.txt')}}-${{ hashFiles('./conanfile.py')}} + restore-keys: | + ${{ runner.os }}-${{ env.BUILD_TYPE }} +``` + ## C# - NuGet Using [NuGet lock files](https://docs.microsoft.com/nuget/consume-packages/package-references-in-project-files#locking-dependencies):