Skip to content

Commit

Permalink
ci: caching logic changed
Browse files Browse the repository at this point in the history
We are currently saving a lot of caches using this pattern:
`{OS}-ccache-{toolchain}-{timestamp}`
After this change there will be only one cache entry for each OS/toolchain.
Also cache entry will be saved only for the master branch.
So PR's can use this cache, but won’t change it.
  • Loading branch information
ice0 committed Jan 29, 2024
1 parent c651b43 commit be9e677
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 16 deletions.
21 changes: 13 additions & 8 deletions .github/workflows/synfig-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,14 @@ jobs:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4

- name: Prepare ccache timestamp
id: ccache_timestamp
run: echo "::set-output name=timestamp::`date "+%Y%m%d-%H%M%S"`"

- name: Download ccache archive
id: ccache-archive
uses: actions/cache@v4
id: ccache-archive-restore
uses: actions/cache/restore@v4
with:
path: .ccache
key: ${{ matrix.os }}-ccache-${{ matrix.toolchain }}-${{ steps.ccache_timestamp.outputs.timestamp }}
key: synfig-ccache-${{ matrix.os }}-${{ matrix.toolchain }}
restore-keys:
${{ matrix.os }}-ccache-${{ matrix.toolchain }}-
synfig-ccache-${{ matrix.os }}-${{ matrix.toolchain }}

- name: Install dependencies (Brew)
if: runner.os == 'macOS'
Expand Down Expand Up @@ -105,3 +101,12 @@ jobs:

- name: ccache statistics
run: ccache --show-stats

- name: Save cache (only for master branch)
id: ccache-archive-save
if: github.ref_name == 'master'
uses: actions/cache/save@v4
with:
path: .ccache
key: synfig-ccache-${{ matrix.os }}-${{ matrix.toolchain }}

21 changes: 13 additions & 8 deletions .github/workflows/synfig-stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,14 @@ jobs:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4

- name: Prepare ccache timestamp
id: ccache_timestamp
run: echo "::set-output name=timestamp::`date "+%Y%m%d-%H%M%S"`"

- name: Download ccache archive
id: ccache-archive
uses: actions/cache@v4
id: ccache-archive-restore
uses: actions/cache/restore@v4
with:
path: .ccache
key: ${{ matrix.os }}-ccache-${{ matrix.toolchain }}-${{ steps.ccache_timestamp.outputs.timestamp }}
key: synfig-ccache-${{ matrix.os }}-${{ matrix.toolchain }}
restore-keys:
${{ matrix.os }}-ccache-${{ matrix.toolchain }}-
synfig-ccache-${{ matrix.os }}-${{ matrix.toolchain }}

- name: Install dependencies (Brew)
if: runner.os == 'macOS'
Expand Down Expand Up @@ -78,3 +74,12 @@ jobs:
- name: ccache statistics
run: ccache --show-stats

- name: Save cache (only for master branch)
id: ccache-archive-save
if: github.ref_name == 'master'
uses: actions/cache/save@v4
with:
path: .ccache
key: synfig-ccache-${{ matrix.os }}-${{ matrix.toolchain }}

0 comments on commit be9e677

Please sign in to comment.