Merge pull request #32 from gruebel/add-workspaces

This commit is contained in:
Rob Ede 2024-01-13 17:40:39 +00:00 committed by GitHub
commit 84e65ce315
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 59 additions and 8 deletions

View File

@ -87,3 +87,20 @@ jobs:
- run: cargo add serde_as - run: cargo add serde_as
- run: cargo clippy - 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

View File

@ -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. 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. Afterward, the `components` and `target` specified via inputs are installed in addition to the items from the toolchain file.
| Name | Description | Default | | Name | Description | Default |
| ------------ | -------------------------------------------------------------------------------------- | ------------- | |--------------------|----------------------------------------------------------------------------------------|---------------|
| `toolchain` | Rustup toolchain specifier e.g. `stable`, `nightly`, `1.42.0`. | stable | | `toolchain` | Rustup toolchain specifier e.g. `stable`, `nightly`, `1.42.0`. | stable |
| `target` | Additional target support to install e.g. `wasm32-unknown-unknown` | | | `target` | Additional target support to install e.g. `wasm32-unknown-unknown` | |
| `components` | Comma-separated string of additional components to install e.g. `clippy, rustfmt` | | | `components` | Comma-separated string of additional components to install e.g. `clippy, rustfmt` | |
| `cache` | Automatically configure Rust cache (using `Swatinem/rust-cache`) | true | | `cache` | Automatically configure Rust cache (using `Swatinem/rust-cache`) | true |
| `matcher` | Enable problem matcher to surface build messages and formatting issues | true | | `cache-workspaces` | Propagates the value to `Swatinem/rust-cache` | |
| `rustflags` | Set the value of `RUSTFLAGS` (set to empty string to avoid overwriting existing flags) | "-D warnings" | | `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 ### RUSTFLAGS

View File

@ -25,6 +25,9 @@ inputs:
description: "Automatically configure Rust cache" description: "Automatically configure Rust cache"
required: false required: false
default: "true" default: "true"
cache-workspaces:
description: "Paths to multiple Cargo workspaces and their target directories, separated by newlines."
required: false
matcher: matcher:
description: "Enable the Rust problem matcher" description: "Enable the Rust problem matcher"
required: false required: false
@ -171,3 +174,5 @@ runs:
- name: Setup Rust Caching - name: Setup Rust Caching
if: inputs.cache == 'true' if: inputs.cache == 'true'
uses: Swatinem/rust-cache@v2 uses: Swatinem/rust-cache@v2
with:
workspaces: ${{inputs.cache-workspaces}}

16
test-workspace/Cargo.lock generated Normal file
View File

@ -0,0 +1,16 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "ci"
version = "0.1.0"
dependencies = [
"serde_as",
]
[[package]]
name = "serde_as"
version = "0.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ee4afe4c5c3b69699c4267ae42b838e911466d7ca0005046adc93ac95bb16dd"

View File

@ -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"

View File

@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}