Skip to content

Commit 24929df

Browse files
authored
feat(ci): add mozilla sccache action (#1580)
Signed-off-by: Tomasz Andrzejak <andreiltd@gmail.com>
1 parent 3b85a8a commit 24929df

10 files changed

Lines changed: 46 additions & 2 deletions

File tree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Set up sccache
2+
description: Install sccache and enable the GitHub Actions cache backend for Rust builds.
3+
4+
runs:
5+
using: composite
6+
steps:
7+
- name: sccache
8+
uses: mozilla-actions/sccache-action@9e7fa8a12102821edf02ca5dbea1acd0f89a2696 # v0.0.10
9+
10+
- name: Configure sccache for Rust
11+
shell: bash
12+
run: |
13+
echo "SCCACHE_GHA_ENABLED=true" >> "$GITHUB_ENV"
14+
echo "RUSTC_WRAPPER=sccache" >> "$GITHUB_ENV"

.github/workflows/Coverage.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ jobs:
5353
shared-key: "${{ runner.os }}-debug"
5454
cache-on-failure: "true"
5555

56+
- name: Set up sccache
57+
uses: ./.github/actions/setup-sccache
58+
5659
- name: Build guest binaries
5760
run: just guests
5861

.github/workflows/PrimeCaches.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,5 +114,8 @@ jobs:
114114
# https://docs.github.com/en/actions/reference/workflows-and-actions/dependency-caching#restrictions-for-accessing-a-cache
115115
save-if: ${{ github.ref == 'refs/heads/main' }}
116116

117+
- name: Set up sccache
118+
uses: ./.github/actions/setup-sccache
119+
117120
- name: Build host
118121
run: just build ${{ matrix.config }}

.github/workflows/RustNightly.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ jobs:
7373
. -> target
7474
src/tests/rust_guests -> target
7575
76+
- name: Set up sccache
77+
uses: ./.github/actions/setup-sccache
78+
7679
- name: Install cargo-hyperlight
7780
run: just ensure-cargo-hyperlight
7881

@@ -90,7 +93,7 @@ jobs:
9093
run: just build ${{ matrix.config }}
9194

9295
- name: Run Miri tests
93-
run: just miri-tests
96+
run: env -u RUSTC_WRAPPER just miri-tests
9497

9598
- name: Run Rust tests
9699
run: |

.github/workflows/dep_benchmarks.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ jobs:
105105
shared-key: "${{ inputs.arch }}-${{ runner.os }}-${{ inputs.hypervisor }}-release"
106106
save-if: "false"
107107

108+
- name: Set up sccache
109+
uses: ./.github/actions/setup-sccache
110+
108111
- name: Download Rust guests
109112
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
110113
with:

.github/workflows/dep_build_guests.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ jobs:
7676
. -> target
7777
src/tests/rust_guests -> target
7878
79+
- name: Set up sccache
80+
uses: ./.github/actions/setup-sccache
81+
7982
- name: Install cargo-hyperlight
8083
run: just ensure-cargo-hyperlight
8184

.github/workflows/dep_build_test.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ jobs:
7575
# https://docs.github.com/en/actions/reference/workflows-and-actions/dependency-caching#restrictions-for-accessing-a-cache
7676
save-if: ${{ github.ref == 'refs/heads/main' }}
7777

78+
- name: Set up sccache
79+
uses: ./.github/actions/setup-sccache
80+
7881
- name: Download Rust guests
7982
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
8083
with:
@@ -110,7 +113,7 @@ jobs:
110113

111114
- name: Run Miri tests
112115
if: runner.os == 'Linux'
113-
run: just miri-tests
116+
run: env -u RUSTC_WRAPPER just miri-tests
114117

115118
- name: Run Rust tests
116119
run: |

.github/workflows/dep_code_checks.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ jobs:
6262
. -> target
6363
src/tests/rust_guests -> target
6464
65+
- name: Set up sccache
66+
uses: ./.github/actions/setup-sccache
67+
6568
- name: Ensure up-to-date Cargo.lock
6669
run: |
6770
cargo fetch --locked
@@ -128,6 +131,9 @@ jobs:
128131
. -> target
129132
src/tests/rust_guests -> target
130133
134+
- name: Set up sccache
135+
uses: ./.github/actions/setup-sccache
136+
131137
- name: Ensure up-to-date Cargo.lock
132138
run: |
133139
cargo fetch --locked

.github/workflows/dep_fuzzing.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ jobs:
4444
env:
4545
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4646

47+
- name: Set up sccache
48+
uses: ./.github/actions/setup-sccache
49+
4750
- name: Download Rust guests
4851
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
4952
with:

.github/workflows/dep_run_examples.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ jobs:
7272
shared-key: "${{ inputs.arch }}-${{ runner.os }}-${{ inputs.hypervisor }}-${{ inputs.config }}"
7373
save-if: "false"
7474

75+
- name: Set up sccache
76+
uses: ./.github/actions/setup-sccache
77+
7578
- name: Download Rust guests
7679
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
7780
with:

0 commit comments

Comments
 (0)