Skip to content

Commit 0310550

Browse files
authored
build: improve caching. (#231)
Signed-off-by: Piotr Sikora <[email protected]>
1 parent 9fa182a commit 0310550

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

.github/workflows/cpp.yml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,42 +68,60 @@ jobs:
6868
include:
6969
- name: 'V8 on Linux/x86_64'
7070
runtime: 'v8'
71+
repo: 'v8'
7172
os: ubuntu-20.04
73+
arch: x86_64
7274
action: test
7375
flags: '--define crypto=system'
7476
- name: 'V8 on macOS/x86_64'
7577
runtime: 'v8'
78+
repo: 'v8'
7679
os: macos-11
80+
arch: x86_64
7781
action: test
7882
- name: 'WAMR on Linux/x86_64'
7983
runtime: 'wamr'
84+
repo: 'com_github_bytecodealliance_wasm_micro_runtime'
8085
os: ubuntu-20.04
86+
arch: x86_64
8187
action: test
8288
- name: 'WAMR on macOS/x86_64'
8389
runtime: 'wamr'
90+
repo: 'com_github_bytecodealliance_wasm_micro_runtime'
8491
os: macos-11
92+
arch: x86_64
8593
action: test
8694
- name: 'Wasmtime on Linux/x86_64'
8795
runtime: 'wasmtime'
96+
repo: 'com_github_bytecodealliance_wasmtime'
8897
os: ubuntu-20.04
98+
arch: x86_64
8999
action: test
90100
- name: 'Wasmtime on Linux/aarch64'
91101
runtime: 'wasmtime'
102+
repo: 'com_github_bytecodealliance_wasmtime'
92103
os: ubuntu-20.04
104+
arch: aarch64
93105
action: build
94106
run_under: docker run --rm --env HOME=$HOME --env USER=$(id -un) --volume "$HOME:$HOME" --workdir $(pwd) --user $(id -u):$(id -g) --platform linux/arm64 piotrsikora/build-tools:bazel-4.2.2-clang-13-gcc-11
95107
- name: 'Wasmtime on Linux/s390x'
96108
runtime: 'wasmtime'
109+
repo: 'com_github_bytecodealliance_wasmtime'
97110
os: ubuntu-20.04
111+
arch: s390x
98112
action: build
99113
run_under: docker run --rm --env HOME=$HOME --env USER=$(id -un) --volume "$HOME:$HOME" --workdir $(pwd) --user $(id -u):$(id -g) --platform linux/s390x piotrsikora/build-tools:bazel-4.2.2-clang-13-gcc-11
100114
- name: 'Wasmtime on macOS/x86_64'
101115
runtime: 'wasmtime'
116+
repo: 'com_github_bytecodealliance_wasmtime'
102117
os: macos-11
118+
arch: x86_64
103119
action: test
104120
- name: 'WAVM on Linux/x86_64'
105121
runtime: 'wavm'
122+
repo: 'com_github_wavm_wavm'
106123
os: ubuntu-20.04
124+
arch: x86_64
107125
action: test
108126

109127
steps:
@@ -121,14 +139,21 @@ jobs:
121139
if: startsWith(matrix.run_under, 'docker')
122140
run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
123141

142+
- name: Set cache key
143+
id: cache-key
144+
run: echo "::set-output name=uniq::$(bazel query --output build //external:${{ matrix.repo }} | grep -E 'sha256|commit' | cut -d\" -f2)"
145+
124146
- name: Bazel cache
125147
if: ${{ matrix.runtime != 'wasmtime' || startsWith(matrix.run_under, 'docker') }}
126148
uses: actions/cache@v2
127149
with:
128150
path: |
129151
~/.cache/bazel
130152
/private/var/tmp/_bazel_runner/
131-
key: bazel-${{ matrix.os }}-${{ matrix.runtime }}-${{ hashFiles('WORKSPACE', '.bazelrc', '.bazelversion', 'bazel/cargo/Cargo.raze.lock', 'bazel/dependencies.bzl', 'bazel/repositories.bzl') }}
153+
key: ${{ matrix.arch }}-${{ matrix.os }}-${{ matrix.runtime }}-${{ steps.cache-key.outputs.uniq }}-${{ hashFiles('WORKSPACE', '.bazelrc', '.bazelversion', 'bazel/cargo/Cargo.raze.lock', 'bazel/dependencies.bzl', 'bazel/repositories.bzl') }}
154+
restore-keys: |
155+
${{ matrix.arch }}-${{ matrix.os }}-${{ matrix.runtime }}-${{ steps.cache-key.outputs.uniq }}-
156+
${{ matrix.arch }}-${{ matrix.os }}-${{ matrix.runtime }}
132157
133158
- name: Bazel build/test
134159
run: >

0 commit comments

Comments
 (0)