Skip to content

Commit 47babcb

Browse files
committed
action: Add setup-rust composite action
This creates a reusable composite action for setting up Rust in CI workflows. It installs the Rust toolchain, nextest, and configures caching with Swatinem/rust-cache. This is moved out of the bootc-ubuntu-setup action because we shouldn't hardcode one thing specific to Rust there. Assisted-by: Claude Code (Sonnet 4.5) Signed-off-by: Colin Walters <[email protected]>
1 parent 98cba2c commit 47babcb

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

common/.github/actions/bootc-ubuntu-setup/action.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,6 @@ runs:
6161
id: set_arch
6262
shell: bash
6363
run: echo "ARCH=$(arch)" >> $GITHUB_ENV
64-
# We often use Rust, so set up opinionated default caching
65-
- name: Setup Rust cache
66-
uses: Swatinem/rust-cache@v2
67-
with:
68-
cache-all-crates: true
69-
# Only generate caches on push to git main
70-
save-if: ${{ github.ref == 'refs/heads/main' }}
71-
# Suppress actually using the cache for builds running from
72-
# git main so that we avoid incremental compilation bugs
73-
lookup-only: ${{ github.ref == 'refs/heads/main' }}
7464
# Install libvirt stack if requested
7565
- name: Install libvirt and virtualization stack
7666
if: ${{ inputs.libvirt == 'true' }}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: 'Setup Rust'
2+
description: 'Install Rust toolchain with caching and nextest'
3+
runs:
4+
using: 'composite'
5+
steps:
6+
- name: Install Rust toolchain
7+
uses: dtolnay/rust-toolchain@stable
8+
- name: Install nextest
9+
uses: taiki-e/install-action@v2
10+
with:
11+
tool: nextest
12+
- name: Setup Rust cache
13+
uses: Swatinem/rust-cache@v2
14+
with:
15+
cache-all-crates: true
16+
# Only generate caches on push to git main
17+
save-if: ${{ github.ref == 'refs/heads/main' }}
18+
# Suppress actually using the cache for builds running from
19+
# git main so that we avoid incremental compilation bugs
20+
lookup-only: ${{ github.ref == 'refs/heads/main' }}

0 commit comments

Comments
 (0)