Skip to content

Commit

Permalink
Merge pull request #32 from gruebel/add-workspaces
Browse files Browse the repository at this point in the history
  • Loading branch information
robjtede authored Jan 13, 2024
2 parents bcda41b + 6f719a2 commit 84e65ce
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 8 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,20 @@ jobs:
- run: cargo add serde_as

- run: cargo clippy

cache:
name: Cache
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- id: toolchain
name: Install Rust
uses: ./
with:
components: clippy
cache: true
cache-workspaces: |-
./test-workspace
- run: cargo clippy --manifest-path=./test-workspace/Cargo.toml
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,15 @@ If no `toolchain` value or toolchain file is present, it will default to `stable
First, all items specified in the toolchain file are installed.
Afterward, the `components` and `target` specified via inputs are installed in addition to the items from the toolchain file.

| Name | Description | Default |
| ------------ | -------------------------------------------------------------------------------------- | ------------- |
| `toolchain` | Rustup toolchain specifier e.g. `stable`, `nightly`, `1.42.0`. | stable |
| `target` | Additional target support to install e.g. `wasm32-unknown-unknown` | |
| `components` | Comma-separated string of additional components to install e.g. `clippy, rustfmt` | |
| `cache` | Automatically configure Rust cache (using `Swatinem/rust-cache`) | true |
| `matcher` | Enable problem matcher to surface build messages and formatting issues | true |
| `rustflags` | Set the value of `RUSTFLAGS` (set to empty string to avoid overwriting existing flags) | "-D warnings" |
| Name | Description | Default |
|--------------------|----------------------------------------------------------------------------------------|---------------|
| `toolchain` | Rustup toolchain specifier e.g. `stable`, `nightly`, `1.42.0`. | stable |
| `target` | Additional target support to install e.g. `wasm32-unknown-unknown` | |
| `components` | Comma-separated string of additional components to install e.g. `clippy, rustfmt` | |
| `cache` | Automatically configure Rust cache (using `Swatinem/rust-cache`) | true |
| `cache-workspaces` | Propagates the value to `Swatinem/rust-cache` | |
| `matcher` | Enable problem matcher to surface build messages and formatting issues | true |
| `rustflags` | Set the value of `RUSTFLAGS` (set to empty string to avoid overwriting existing flags) | "-D warnings" |

### RUSTFLAGS

Expand Down
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ inputs:
description: "Automatically configure Rust cache"
required: false
default: "true"
cache-workspaces:
description: "Paths to multiple Cargo workspaces and their target directories, separated by newlines."
required: false
matcher:
description: "Enable the Rust problem matcher"
required: false
Expand Down Expand Up @@ -171,3 +174,5 @@ runs:
- name: Setup Rust Caching
if: inputs.cache == 'true'
uses: Swatinem/rust-cache@v2
with:
workspaces: ${{inputs.cache-workspaces}}
16 changes: 16 additions & 0 deletions test-workspace/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions test-workspace/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[package]
name = "ci"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
serde_as = "0.0.1"
3 changes: 3 additions & 0 deletions test-workspace/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}

0 comments on commit 84e65ce

Please sign in to comment.