Skip to content

Commit

Permalink
Add rust-ci local github-action
Browse files Browse the repository at this point in the history
  • Loading branch information
richardpringle committed Apr 29, 2024
1 parent 4cc9869 commit 34f57b1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
21 changes: 21 additions & 0 deletions .github/actions/install-rust/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: 'Install Rust toolchain and Cache'
description: 'Install a rust toolchain and cache'

inputs:
targets:
description: 'pass targets to the rust-toolchain installer'
required: false
cache:
description: "to cache or not to cache, that is the question"
required: false
default: "true"

runs:
using: composite
steps:
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ inputs.targets }}
- if: ${{ inputs.cache == 'true' }}
uses: Swatinem/rust-cache@v2
14 changes: 7 additions & 7 deletions .github/workflows/rust-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
uses: ./.github/actions/install-rust
with:
cache: false
- name: Checkout
uses: actions/checkout@v4
- name: Run static analysis tests
Expand All @@ -34,12 +36,12 @@ jobs:
check-latest: true
cache: true
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
uses: ./.github/actions/install-rust
with:
targets: wasm32-unknown-unknown
cache: false
- name: Checkout
uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- name: Run doc tests
run: RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-features --document-private-items --all

Expand All @@ -53,12 +55,11 @@ jobs:
check-latest: true
cache: true
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
uses: ./.github/actions/install-rust
with:
targets: wasm32-unknown-unknown
- name: Checkout
uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- name: Run static analysis tests
shell: bash
run: cargo clippy --all --all-features --tests --benches --examples -- -D warnings
Expand All @@ -73,11 +74,10 @@ jobs:
check-latest: true
cache: true
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
uses: ./.github/actions/install-rust
with:
targets: wasm32-unknown-unknown
- name: Checkout
uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- name: Run unit tests
run: cargo test --all-features --all

0 comments on commit 34f57b1

Please sign in to comment.