CI: Improve caching

GitHub Actions allow a total 5 GB of cache storage space per repository,
after which it will evict old caches. Tweaked cache sizes so master + a
few PRs can fit at the same time. Don't cache coverage builds as they
run weekly and with additional compiler options, so their caches would
likely be state anyway.
This commit is contained in:
Geza Lore 2021-06-12 23:35:18 +01:00
parent e6e7bd8d83
commit 02835f199b
2 changed files with 16 additions and 42 deletions

View File

@ -56,21 +56,22 @@ jobs:
CI_MAKE_SRC_TARGET: ${{ matrix.debug }}
CC: ${{ matrix.compiler.cc }}
CXX: ${{ matrix.compiler.cxx }}
CACHE_KEY: build-${{ matrix.os }}-${{ matrix.compiler.cc }}-${{ matrix.debug }}
CCACHE_MAXSIZE: 256Mi # Per build matrix entry
CACHE_BASE_KEY: build-${{ matrix.os }}-${{ matrix.compiler.cc }}-${{ matrix.debug }}
CCACHE_MAXSIZE: 128Mi # Per build matrix entry (1Gi in total)
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Cache
- name: Cache $CCACHE_DIR
uses: actions/cache@v2
env:
cache-name: ccache
CACHE_KEY: ${{ env.CACHE_BASE_KEY }}-ccache
with:
path: ${{ github.workspace }}/.ccache
key: ${{ env.CACHE_KEY }}-${{ env.cache-name }}-${{ github.sha }}
restore-keys: ${{ env.CACHE_KEY }}-${{ env.cache-name }}
path: ${{ env.CCACHE_DIR }}
key: ${{ env.CACHE_KEY }}-${{ github.sha }}
restore-keys: |
${{ env.CACHE_KEY }}-
- name: Install packages for build
run: ./ci/ci-install.bash
@ -109,21 +110,22 @@ jobs:
CI_RUNS_ON: ${{ matrix.os }}
CC: ${{ matrix.compiler.cc }}
CXX: ${{ matrix.compiler.cxx }}
CACHE_KEY: test-${{ matrix.os }}-${{ matrix.compiler.cc }}-${{ matrix.suite }}
CCACHE_MAXSIZE: 256Mi # Per build matrix entry
CACHE_BASE_KEY: test-${{ matrix.os }}-${{ matrix.compiler.cc }}-${{ matrix.suite }}
CCACHE_MAXSIZE: 32Mi # Per build matrix entry (960Mi in total)
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Cache
- name: Cache $CCACHE_DIR
uses: actions/cache@v2
env:
cache-name: ccache
CACHE_KEY: ${{ env.CACHE_BASE_KEY }}-ccache
with:
path: ${{ github.workspace }}/.ccache
key: ${{ env.CACHE_KEY }}-${{ env.cache-name }}-${{ github.sha }}
restore-keys: ${{ env.CACHE_KEY }}-${{ env.cache-name }}
path: ${{ env.CCACHE_DIR }}
key: ${{ env.CACHE_KEY }}-${{ github.sha }}
restore-keys: |
${{ env.CACHE_KEY }}-
- uses: actions/download-artifact@v2

View File

@ -11,8 +11,6 @@ on:
env:
CI_OS_NAME: linux
CI_COMMIT: ${{ github.sha }}
CCACHE_COMPRESS: 1
CCACHE_DIR: ${{ github.workspace }}/.ccache
COVERAGE: 1
jobs:
@ -23,22 +21,11 @@ jobs:
env:
CI_BUILD_STAGE_NAME: build
CI_RUNS_ON: ubuntu-20.04
CACHE_KEY: coverage-build
CCACHE_MAXSIZE: 512Mi
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Cache
uses: actions/cache@v2
env:
cache-name: ccache
with:
path: ${{ github.workspace }}/.ccache
key: ${{ env.CACHE_KEY }}-${{ env.cache-name }}-${{ github.sha }}
restore-keys: ${{ env.CACHE_KEY }}-${{ env.cache-name }}
- name: Install packages for build
env:
CI_BUILD_STAGE_NAME: build
@ -46,9 +33,7 @@ jobs:
- name: Build
run: |
ccache -z
./ci/ci-script.bash
ccache -s
tar cvzf verilator-${CI_COMMIT}-coverage.tgz bin src/obj*/*.o src/obj*/*.gcno
- uses: actions/upload-artifact@v2
@ -82,22 +67,11 @@ jobs:
env:
CI_BUILD_STAGE_NAME: test
CI_RUNS_ON: ubuntu-20.04
CACHE_KEY: coverage-test-${{ matrix.test }}${{ matrix.num }}
CCACHE_MAXSIZE: 512Mi # Per build matrix entry
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Cache
uses: actions/cache@v2
env:
cache-name: ccache
with:
path: ${{ github.workspace }}/.ccache
key: ${{ env.CACHE_KEY }}-${{ env.cache-name }}-${{ github.sha }}
restore-keys: ${{ env.CACHE_KEY }}-${{ env.cache-name }}
- uses: actions/download-artifact@v2
- name: Install Verilator and test dependencies
@ -110,6 +84,4 @@ jobs:
env:
TESTS: coverage-${{ matrix.test }}${{ matrix.num }}
run: |
ccache -z
./ci/ci-script.bash
ccache -s