CI: Cache dependencies

This will speed up our builds a bit and prevent unnecessary network traffic.

Setup according to the documentation for the `actions/cache@v2` action:
https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows

Currently caching the `${{github.workspace}}/_deps` directory, as used by CMake.

Cache keys look like this: `ubuntu-20.04-clang11` (`${{matrix.os}-${{matrix.compiler}}${matrix.compiler-version}}`)

PiperOrigin-RevId: 431895214
Change-Id: I4ecac7c00eec8516f85f45aa2220303b811b2389
This commit is contained in:
Christian Blichmann 2022-03-02 03:06:40 -08:00 committed by Copybara-Service
parent 2d324bd50d
commit 6de30ea27f
2 changed files with 16 additions and 1 deletions

View File

@ -12,7 +12,8 @@ jobs:
matrix: matrix:
include: include:
- container: fedora:35 - container: fedora:35
compiler: gcc # GCC 11 compiler: gcc
compiler-version: 11 # Only used in cache action so far
ignore-errors: true # Stack trace test fails on Fedora (issue #118) ignore-errors: true # Stack trace test fails on Fedora (issue #118)
runs-on: ubuntu-latest runs-on: ubuntu-latest
continue-on-error: ${{ matrix.ignore-errors }} continue-on-error: ${{ matrix.ignore-errors }}
@ -23,6 +24,13 @@ jobs:
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Cache dependencies
uses: actions/cache@v2
with:
key: ${{matrix.container}}-${{matrix.compiler}}${{matrix.compiler-version}}
path: |
${{github.workspace}}/_deps
- name: Prepare container - name: Prepare container
# Note: For the sandbox tests to work, we need a privileged, unconfined # Note: For the sandbox tests to work, we need a privileged, unconfined
# container that retains its capabilities. # container that retains its capabilities.

View File

@ -42,6 +42,13 @@ jobs:
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Cache dependencies
uses: actions/cache@v2
with:
key: ${{matrix.os}}-${{matrix.compiler}}${{matrix.compiler-version}}
path: |
${{github.workspace}}/_deps
- name: Install ninja-build tool - name: Install ninja-build tool
uses: seanmiddleditch/gha-setup-ninja@v3 uses: seanmiddleditch/gha-setup-ninja@v3