Files
shorebird-updater/.github/actions/rust_crate/action.yaml
T
Eric Seidel 0af491b628 ci: speed up Rust CI builds with prebuilt tools (#325)
* ci: speed up Rust CI builds with caching and prebuilt tools

The Windows builder takes ~6min vs ~3min on Ubuntu, largely because
cargo-llvm-cov is compiled from source on every run. This adds
Swatinem/rust-cache for build artifact caching and switches to
taiki-e/install-action for prebuilt cargo-llvm-cov binaries.

Also fixes the undefined `inputs.shell` references by hardcoding `bash`.

* fix: add Swatinem and taiki to cspell dictionary

* ci: remove rust-cache, no measurable benefit for this project

Investigated cache hit/miss across 3 CI runs. Even with warm cache
hits (macOS/Windows), build times were unchanged or slightly slower
due to cache download/extract overhead (~39MB) outweighing the small
dependency compile time savings.
2026-04-02 03:14:24 +00:00

57 lines
1.8 KiB
YAML

name: Rust Crate Workflow
description: Build and test your Rust crate
inputs:
codecov_token:
required: true
description: The codecov token used to upload coverage reports.
working_directory:
required: false
default: "."
description: The working directory for this workflow.
runs:
using: "composite"
steps:
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Check Formatting
working-directory: ${{ inputs.working_directory }}
shell: bash
run: cargo fmt --check
- name: Clippy
working-directory: ${{ inputs.working_directory }}
shell: bash
run: cargo clippy --all-targets -- -D warnings
- name: Build
working-directory: ${{ inputs.working_directory }}
shell: bash
run: cargo build --verbose
- name: Test
working-directory: ${{ inputs.working_directory }}
shell: bash
run: cargo llvm-cov --lcov --output-path lcov.info
# Per https://stackoverflow.com/questions/73402042/github-action-expressions-split-string
- name: Split package name
env:
PACKAGE_PATH: ${{ inputs.working_directory}}
id: split
shell: bash
run: echo "package_name=${PACKAGE_PATH##*/}" >> $GITHUB_OUTPUT
- name: Upload Coverage
uses: codecov/codecov-action@v3
with:
# We use Codecov's carryforward flags to allow our PR testing to only
# run affected packages, but also allow our coverage information from
# past runs to "carry forward" on a "per flag" basis. We tag coverage
# information with "flags" explaining what directory the coverage is from.
# https://docs.codecov.com/docs/carryforward-flags
flags: ${{ steps.split.outputs.package_name }}
token: ${{ inputs.codecov_token }}