Skip to content

Commit 443ec2f

Browse files
Merge pull request #810 from henryborchers/improve-compile-times
ci: cache dependencies to speed up build time
2 parents 61d878d + a38f60a commit 443ec2f

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

.github/workflows/MediaConch_Build_Lib.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,40 @@ jobs:
1111
include:
1212
- os: ubuntu-latest
1313
cmake_preset_name: conan-release
14+
conan_home: "/home/runner/.conan2"
1415
- os: macos-latest
1516
cmake_preset_name: conan-release
17+
conan_home: "/Users/runner/.conan2"
1618
- os: windows-latest
1719
cmake_preset_name: conan-default
20+
conan_home: "C:/Users/runneradmin/.conan2"
1821
fail-fast: false
1922
runs-on: ${{ matrix.os }}
23+
env:
24+
CONAN_HOME: ${{ matrix.conan_home }}
2025
steps:
2126
- name: Checkout
2227
uses: actions/checkout@v4
2328
- uses: actions/setup-python@v4
2429
with:
2530
cache: 'pip' # caching pip dependencies
31+
- name: "Cache Conan dependencies"
32+
uses: actions/cache@v4
33+
with:
34+
path: "${{matrix.conan_home}}"
35+
key: ${{ runner.os }}-conan-${{ hashFiles('.github/workflows/conanfile.txt') }}
36+
restore-keys: |
37+
${{ runner.os }}-conan-
2638
- name: "install dependencies" # use conan package manager to install c and c++ dependencies
39+
# conanfile.txt is copied to the root because for some reason, conan doesn't seem to create the top
40+
# CMakeUserPresets.json if you have the conanfile.txt in another directory than the path you call conan from.
41+
#
42+
# "cmake -E copy" is used to copy the file is because it has the same interface across all operating systems.
2743
run: |
2844
pip install --disable-pip-version-check uv
29-
uvx conan profile detect
30-
uvx conan install -of build --requires="zlib/1.3.1" --requires="libxslt/1.1.43" --requires="libxml2/2.13.8" --requires="libzen/0.4.38" --requires="libmediainfo/22.03" --build=missing -g CMakeDeps -g CMakeToolchain
45+
uvx conan profile detect --exist-ok
46+
cmake -E copy .github/workflows/conanfile.txt conanfile.txt
47+
uvx conan install -of build --build=missing -g CMakeDeps -g CMakeToolchain conanfile.txt
3148
- name: Configure cmake
3249
run: |
3350
cmake --preset ${{ matrix.cmake_preset_name }} -D BUILD_SHARED_LIBS=${{ matrix.library_type == 'static' && 'NO' || 'YES'}}

.github/workflows/conanfile.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[requires]
2+
zlib/1.3.1
3+
libxslt/1.1.43
4+
libxml2/2.13.8
5+
libzen/0.4.38
6+
libmediainfo/22.03

0 commit comments

Comments
 (0)