Skip to content

Commit 4fdea52

Browse files
authored
Merge pull request #96 from eseiler/infra/caching
[INFRA] Add caching
2 parents a160430 + 6302449 commit 4fdea52

File tree

4 files changed

+51
-6
lines changed

4 files changed

+51
-6
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin
2+
# SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik
3+
# SPDX-License-Identifier: CC0-1.0
4+
5+
name: 'Setup Cache'
6+
description: 'Sets up caches'
7+
inputs:
8+
ccache_size:
9+
description: "The ccache maximum size."
10+
required: false
11+
runs:
12+
using: 'composite'
13+
steps:
14+
- name: Get Directories
15+
id: directories
16+
shell: bash
17+
run: |
18+
echo "ccache=${CCACHE_DIR}" >> $GITHUB_OUTPUT
19+
echo "cpm=${CPM_SOURCE_CACHE}" >> $GITHUB_OUTPUT
20+
if [[ -n "${{ inputs.ccache_size }}" ]]; then
21+
echo "CCACHE_MAXSIZE=${{ inputs.ccache_size }}" >> "$GITHUB_ENV"
22+
fi
23+
24+
- name: Load ccache
25+
if: runner.os != 'macOS'
26+
uses: actions/cache@v4
27+
with:
28+
path: ${{ steps.directories.outputs.ccache }}
29+
key: ccache-${{ runner.os }}-${{ github.workflow }}-${{ matrix.compiler }}-${{ github.ref }}-${{ github.run_id }}
30+
restore-keys: |
31+
ccache-${{ runner.os }}-${{ github.workflow }}-${{ matrix.compiler }}-${{ github.ref }}
32+
ccache-${{ runner.os }}-${{ github.workflow }}-${{ matrix.compiler }}
33+
34+
- name: Load dependency cache
35+
uses: actions/cache@v4
36+
with:
37+
path: ${{ steps.directories.outputs.cpm }}
38+
key: cpm-${{ hashfiles('cmake/package-lock.cmake') }}

.github/workflows/ci_coverage.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,15 @@ jobs:
3030
compiler: ["gcc-latest"]
3131
container:
3232
image: ghcr.io/seqan/${{ matrix.compiler }}
33-
volumes:
34-
- /home/runner:/home/runner
3533
steps:
3634
- name: Checkout
3735
uses: actions/checkout@v4
3836

37+
- name: Setup cache
38+
uses: ./.github/actions/setup_cache
39+
with:
40+
ccache_size: 150M
41+
3942
- name: Configure tests
4043
run: |
4144
mkdir build && cd build

.github/workflows/ci_linux.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,13 @@ jobs:
3333
cxx_flags: "-fp-model=strict -Wno-overriding-option"
3434
container:
3535
image: ghcr.io/seqan/${{ matrix.compiler }}
36-
volumes:
37-
- /home/runner:/home/runner
3836
steps:
3937
- name: Checkout
4038
uses: actions/checkout@v4
4139

40+
- name: Setup cache
41+
uses: ./.github/actions/setup_cache
42+
4243
- name: Configure tests
4344
run: |
4445
mkdir build && cd build

.github/workflows/ci_macos.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,14 @@ jobs:
3232
- name: Checkout
3333
uses: actions/checkout@v4
3434

35-
- name: Setup compiler
36-
uses: seqan/actions/setup-compiler@main
35+
- name: Setup toolchain
36+
uses: seqan/actions/setup-toolchain@main
3737
with:
3838
compiler: ${{ matrix.compiler }}
3939

40+
- name: Setup cache
41+
uses: ./.github/actions/setup_cache
42+
4043
- name: Configure tests
4144
run: |
4245
mkdir build && cd build

0 commit comments

Comments
 (0)