1
0
Fork 0
mirror of https://code.forgejo.org/actions/cache.git synced 2024-11-24 04:29:16 +01:00

[examples] add c++ conan example

This commit is contained in:
Andrew Marshall 2021-11-14 08:56:11 +00:00
parent 67b6d52d50
commit a339655823
2 changed files with 43 additions and 0 deletions

View file

@ -86,6 +86,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++ - Conan](./examples.md#c---conan)
- [C# - Nuget](./examples.md#c---nuget)
- [D - DUB](./examples.md#d---dub)
- [Elixir - Mix](./examples.md#elixir---mix)

View file

@ -1,5 +1,6 @@
# Examples
- [C++ - Conan](#c---conan)
- [C# - NuGet](#c---nuget)
- [D - DUB](#d---dub)
- [POSIX](#posix)
@ -37,6 +38,47 @@
- [Swift, Objective-C - CocoaPods](#swift-objective-c---cocoapods)
- [Swift - Swift Package Manager](#swift---swift-package-manager)
## C++ - Conan
Using [Conan Lockfiles](https://docs.conan.io/en/latest/versioning/lockfiles.html):
```.yaml
- name: create conan cache keys
run: |
conan lock create conanfile.py --build missing
- name: get conan cache
uses: actions/cache@v2
with:
path: |
~/.conan/data
!~/.conan/data/**/conan_sources.tgz
key: conan-${{ hashFiles('conan.lock') }}
- name: install conan dependencies
run: |
conan install . --lockfile conan.lock --build missing
```
Using a custom cache location, and a profile as a partial cache key:
```.yaml
env:
CONAN_USER_HOME: /tmp/
PROFILE: my_profile
- name: create lockfile
run: |
conan lock create conanfile.py -pr $PROFILE --build missing
- name: get conan cache
uses: actions/cache@v2
with:
path: |
${{ env.CONAN_USER_HOME }}/.conan/data
!${{ env.CONAN_USER_HOME }}/.conan/data/**/conan_sources.tgz
key: conan-${{ env.PROFILE }}-${{ hashFiles('conan.lock') }}
- name: install conan dependencies
run: |
conan install . --lockfile conan.lock --build missing
```
## C# - NuGet
Using [NuGet lock files](https://docs.microsoft.com/nuget/consume-packages/package-references-in-project-files#locking-dependencies):