Add example for C++ conan

This commit is contained in:
Amin Yahyaabadi 2021-10-30 05:22:48 -05:00
parent 5460e17bf7
commit 9e675a748a
2 changed files with 28 additions and 0 deletions

View file

@ -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: See [Examples](examples.md) for a list of `actions/cache` implementations for use with:
- [C++ - vcpkg](./examples.md#c++---vcpkg) - [C++ - vcpkg](./examples.md#c++---vcpkg)
- [C++ - Conan](./examples.md#c++---conan)
- [C# - Nuget](./examples.md#c---nuget) - [C# - Nuget](./examples.md#c---nuget)
- [D - DUB](./examples.md#d---dub) - [D - DUB](./examples.md#d---dub)
- [Elixir - Mix](./examples.md#elixir---mix) - [Elixir - Mix](./examples.md#elixir---mix)

View file

@ -1,6 +1,7 @@
# Examples # Examples
- [C++ - vcpkg](#c++---vcpkg) - [C++ - vcpkg](#c++---vcpkg)
- [C++ - Conan](#c++---conan)
- [C# - NuGet](#c---nuget) - [C# - NuGet](#c---nuget)
- [D - DUB](#d---dub) - [D - DUB](#d---dub)
- [POSIX](#posix) - [POSIX](#posix)
@ -65,6 +66,32 @@ env:
restore-keys: | restore-keys: |
${{ runner.os }}-${{ env.BUILD_TYPE }} ${{ 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 ## C# - NuGet
Using [NuGet lock files](https://docs.microsoft.com/nuget/consume-packages/package-references-in-project-files#locking-dependencies): Using [NuGet lock files](https://docs.microsoft.com/nuget/consume-packages/package-references-in-project-files#locking-dependencies):