From ffb9cfa48bc257c8660adc06999d0d5ff163a784 Mon Sep 17 00:00:00 2001 From: Ossi Salmi Date: Wed, 12 Mar 2025 15:09:15 +0200 Subject: [PATCH 1/2] Add workspaces option --- action.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/action.yml b/action.yml index c97f1ba..4355482 100644 --- a/action.yml +++ b/action.yml @@ -20,6 +20,9 @@ inputs: cache-key: description: Additional cache key for rust-cache. required: false + workspaces: + description: Cargo workspaces for rust-cache. + required: false runs: using: composite @@ -42,4 +45,5 @@ runs: - uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2.7.7 with: key: ${{ inputs.cache-key }} + workspaces: ${{ inputs.workspaces }} if: inputs.use-cache == 'true' From 2fabf02b7d1630e31eafb443751f37de985e2f52 Mon Sep 17 00:00:00 2001 From: Ossi Salmi Date: Wed, 12 Mar 2025 15:11:44 +0200 Subject: [PATCH 2/2] Add tests --- .github/workflows/tests.yml | 41 +++++++++++++++++++++++++++++++++++++ tests/.gitignore | 1 + tests/Cargo.lock | 7 +++++++ tests/Cargo.toml | 7 +++++++ tests/src/main.rs | 3 +++ 5 files changed, 59 insertions(+) create mode 100644 .github/workflows/tests.yml create mode 100644 tests/.gitignore create mode 100644 tests/Cargo.lock create mode 100644 tests/Cargo.toml create mode 100644 tests/src/main.rs diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..cebe31f --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,41 @@ +--- +name: Tests + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + tests: + runs-on: ubuntu-latest + + strategy: + matrix: + toolchain: + - stable + - beta + use-cache: + - true + - false + + defaults: + run: + working-directory: tests + + steps: + - uses: actions/checkout@v4 + + - uses: ./ + with: + toolchain: ${{ matrix.toolchain }} + use-cache: ${{ matrix.use-cache }} + components: rustfmt + workspaces: tests + + - run: cargo fmt --check + - run: cargo check + - run: cargo build --release diff --git a/tests/.gitignore b/tests/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/tests/.gitignore @@ -0,0 +1 @@ +/target diff --git a/tests/Cargo.lock b/tests/Cargo.lock new file mode 100644 index 0000000..38b565b --- /dev/null +++ b/tests/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "tests" +version = "0.1.0" diff --git a/tests/Cargo.toml b/tests/Cargo.toml new file mode 100644 index 0000000..fa3653e --- /dev/null +++ b/tests/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "tests" +version = "0.1.0" +edition = "2024" +publish = false + +[dependencies] diff --git a/tests/src/main.rs b/tests/src/main.rs new file mode 100644 index 0000000..e7a11a9 --- /dev/null +++ b/tests/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, world!"); +}