Skip to content

Commit

Permalink
Merge pull request #259 from openziti/more-robust-ci-caching
Browse files Browse the repository at this point in the history
use vpckg binary caching
  • Loading branch information
ekoby authored Jan 11, 2025
2 parents 54db28d + 252be14 commit 71ece2b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 11 deletions.
33 changes: 22 additions & 11 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ jobs:
build:
name: ${{ matrix.target }}-${{ matrix.tls }}
runs-on: ${{ matrix.image }}-latest
env:
CI_CACHE: '${{ github.workspace }}/.ci.cache'
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
VCPKG_BINARY_SOURCES: 'clear;files,${{ github.workspace }}/.ci.cache,readwrite'
VCPKG_DEFAULT_TRIPLET: ${{ matrix.target }}

strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -40,9 +46,9 @@ jobs:
steps:
- name: Install tools
if: matrix.image == 'ubuntu'
run: |
sudo apt update
sudo apt install -y valgrind softhsm2
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: valgrind softhsm2

- name: Install tools
if: matrix.image == 'macOS'
Expand All @@ -59,21 +65,26 @@ jobs:

- uses: lukka/get-cmake@latest

- name: create cache dir
shell: bash
run: |
mkdir -p ${CI_CACHE}
- name: Cache ${{ matrix.target }} deps
id: cache
uses: actions/cache@v4
with:
save-always: 'true'
path: vcpkg/packages
key: dependencies-${{ matrix.target }}-${{ hashFiles('./vcpkg.json') }}
save-always: true
path: ${{ env.CI_CACHE }}
key: dep-${{ matrix.target }}-${{ matrix.tls }}-${{ hashFiles('./vcpkg.json') }}
restore-keys: |
dep-${{ matrix.target }}-${{ matrix.tls }}-
dep-${{ matrix.target }}-
- uses: lukka/run-vcpkg@v11
env:
VCPKG_DEFAULT_TRIPLET: ${{ matrix.target }}
with:
doNotCache: true
runVcpkgInstall: true
runVcpkgFormatString: '[`install`, `--x-install-root`, `$[env.VCPKG_INSTALLED_DIR]`, `--x-feature=all-deps`]'
doNotCache: false
runVcpkgInstall: false

- uses: lukka/run-cmake@v10
name: Configure build
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ compile_commands.json
CTestTestfile.cmake
build

## CI cache
.ci.cache/

### JetBrains
.idea/
cmake-build-*/
Expand Down

0 comments on commit 71ece2b

Please sign in to comment.