summaryrefslogtreecommitdiff
path: root/.github
diff options
context:
space:
mode:
authorGereon Kremer <gereon.kremer@cs.rwth-aachen.de>2021-04-02 23:11:52 +0200
committerGitHub <noreply@github.com>2021-04-02 21:11:52 +0000
commitfba1437c772b6733ce678b93b5ef7d95e366c82d (patch)
tree9fac63d21f81c98e2eb6ed44e0975d6324536238 /.github
parent385ecf64fd4437ca15156a44b97f2001428dc1f5 (diff)
Add cache for new dependencies folder. (#6265)
This PR adds caching of the new dependencies folder build/deps/ for the CI jobs and renames the old deps folder to "auxiliary told". Note that we need to cache the entirety of build/deps/ (instead of just the install folder for the old one), otherwise cmake will try to rebuild them. Some of the external projects remove unnecessary files in their build to reduce their footprint in the cache.
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/ci.yml60
1 files changed, 43 insertions, 17 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 5e682993c..8d8104385 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -108,32 +108,50 @@ jobs:
Cython==0.29.* --install-option="--no-cython-compile"
echo "$(python3 -m site --user-base)/bin" >> $GITHUB_PATH
- - name: Restore Dependencies
- id: restore-deps
- uses: actions/cache@v1
+ # The GitHub action for caching currently does not support modifying an
+ # already existing cache. We thus have a few different possibilities:
+ # - If having (partially) outdated data in the cached directory is fine, we
+ # may want to restore any old cache via `restore-keys`. We should try hard
+ # to detect that we have (partially) outdated data and make sure that the
+ # updated data is stored to a new cache key.
+ # - If a cache is updated frequently (i.e. almost with every commit), we
+ # should use the current commit hash as suffix and use `restore-keys` to
+ # restore the cache from the previous commit.
+ #
+ # We define three caches: aux-tools, ccache, deps.
+ # - aux-tools (deps/) does not handle outdated contents gracefully. As it is
+ # not updated frequently, we completely rebuild it whenever it might
+ # change, which is when the contrib scripts or the CI config changes.
+ # - ccache changes with (almost) every commit and handles outdated contents
+ # properly. We thus use `restore-keys` and store a new cache for every
+ # commit.
+ # - deps (build/deps/) does handle outdated contents gracefully, but does
+ # not change frequently. We thus use `restore-keys` to restore any recent
+ # cache, but only store a new cache if the cmake or CI config changes.
+ #
+ # All caches are separated by operating system. Both ccache and deps are
+ # additionally separated by `cache-key`, i.e. the CI job type, because they
+ # depend on the configured compiler.
+
+ - name: Restore Auxiliary Tools
+ id: restore-aux-tools
+ uses: actions/cache@v2
with:
path: deps/install
- key: ${{ runner.os }}-deps-${{ hashFiles('contrib/get-**') }}-${{ hashFiles('.github/workflows/ci.yml') }}
+ key: aux-tools-${{ runner.os }}-${{ hashFiles('contrib/get-**') }}-${{ hashFiles('.github/workflows/ci.yml') }}
- - name: Setup Dependencies
- if: steps.restore-deps.outputs.cache-hit != 'true'
+ - name: Setup Auxiliary Tools
+ if: steps.restore-aux-tools.outputs.cache-hit != 'true'
run: |
./contrib/get-lfsc-checker
- # GitHub actions currently does not support modifying an already existing
- # cache. Hence, we create a new cache for each commit with key
- # cache-${{ runner.os }}-${{ matrix.cache-key }}-${{ github.sha }}. This
- # will result in an initial cache miss. However, restore-keys will search
- # for the most recent cache with prefix
- # cache-${{ runner.os }}-${{ matrix.cache-key }}-, and if found uses it as
- # a base for the new cache.
- name: Restore ccache
- id: cache
- uses: actions/cache@v1
+ id: ccache
+ uses: actions/cache@v2
with:
path: ccache-dir
- key: cache-${{ runner.os }}-${{ matrix.cache-key }}-${{ github.sha }}
- restore-keys: cache-${{ runner.os }}-${{ matrix.cache-key }}-
+ key: ccache-${{ runner.os }}-${{ matrix.cache-key }}-${{ github.sha }}
+ restore-keys: ccache-${{ runner.os }}-${{ matrix.cache-key }}-
- name: Configure ccache
run: |
@@ -143,6 +161,14 @@ jobs:
ccache -M 500M
ccache -z
+ - name: Restore Dependencies
+ id: restore-deps
+ uses: actions/cache@v2
+ with:
+ path: build/deps
+ key: deps-${{ runner.os }}-${{ matrix.cache-key }}-${{ hashFiles('cmake/Find**', 'cmake/deps-helper.cmake') }}-${{ hashFiles('.github/workflows/ci.yml') }}
+ restore-keys: deps-${{ runner.os }}-${{ matrix.cache-key }}-
+
- name: Configure
run: |
${{ matrix.env }} ./configure.sh ${{ matrix.config }} \
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback