@@ -24,6 +24,7 @@ This GitHub Action allows you to easily run tests for your Rust library and uplo
2424- 💾 Optional Rust toolchain caching for faster builds
2525- 🎛️ Pass additional arguments to the ` cargo test ` command
2626- 🚀 Run custom commands before test execution
27+ - 🏗️ Full cargo workspace support - test all packages or a specific subset
2728
2829## Usage
2930
@@ -60,7 +61,7 @@ To use this action in your GitHub workflow, add the following step:
6061
6162| Input | Description | Required | Default |
6263| --------------------------- | -------------------------------------------------------------------------------------------------- | -------- | -------------------- |
63- | ` rust-project-path` | Path to the Rust project | No | `'.'` |
64+ | ` rust-project-path` | Directory containing `Cargo.toml` (crate root or workspace root) | No | `'.'` |
6465| `rust-toolchain` | Rust toolchain to use for building and testing (e.g., stable, nightly, 1.75.0, nightly-2024-02-08) | No | `'stable'` |
6566| `target` | The target platform for the Rust compiler | No | `''` |
6667| `install-rust-toolchain` | Whether to install the specified Rust toolchain | No | `true` |
@@ -73,16 +74,49 @@ To use this action in your GitHub workflow, add the following step:
7374| `codecov-flags` | Flags to pass to Codecov | No | `'unittests'` |
7475| `codecov-name` | Custom defined name for the upload | No | `'codecov-umbrella'` |
7576| `features` | Space-separated list of features to enable during testing | No | `''` |
76- | `packages` | Multi-line list of package names to test (one per line). If empty, tests all packages in workspace | No | `''` |
77+ | `packages` | Packages to test (one per line). Empty tests all workspace members. | No | `''` |
7778| `no-default-features` | Disable default features during testing | No | `false` |
7879| `use-cross` | Use cross-rs for testing. If false, use cargo. | No | `false` |
7980| `additional-test-args` | Additional arguments to pass to the cargo test command | No | `''` |
8081| `additional-tarpaulin-args` | Additional arguments to pass to the cargo tarpaulin command | No | `''` |
8182| `pre-test-command` | Bash command to run before executing tests | No | `''` |
8283
83- # # Example Workflow
84+ > **Note:** `rust-project-path` is a **directory** (not a file).
85+ > It should point to the folder containing `Cargo.toml`:
86+ >
87+ > - **Single crate** - the crate root (e.g. `'.'`)
88+ > - **Workspace** - the workspace root
89+ >
90+ > Defaults to `'.'` (current directory).
8491
85- Here's an example workflow that uses this action with a matrix of configurations :
92+ # # Example Workflows
93+
94+ # ## Testing Specific Packages
95+
96+ Use `packages` to control which packages are tested :
97+
98+ ` ` ` yaml
99+ # Omit packages to test the entire workspace
100+ - uses: Reloaded-Project/devops-rust-test-and-coverage@v1
101+ with:
102+ rust-project-path: 'my-workspace'
103+
104+ # Specify package names to test only those
105+ - uses: Reloaded-Project/devops-rust-test-and-coverage@v1
106+ with:
107+ rust-project-path: 'my-workspace'
108+ packages: |
109+ my-core-lib
110+ my-utils
111+ ` ` `
112+
113+ Both `cargo`, `cross`, and Tarpaulin coverage respect the `packages` input.
114+ Use `codecov-flags` to segment coverage when testing
115+ different packages in parallel jobs.
116+
117+ # ## Testing Multiple Targets
118+
119+ Test across multiple platforms and targets using a matrix strategy :
86120
87121` ` ` yaml
88122name: Test and Coverage
@@ -108,11 +142,10 @@ jobs:
108142 use-cross: true
109143 runs-on: ${{ matrix.os }}
110144 steps:
111- - uses: actions/checkout@v2
145+ - uses: actions/checkout@v6
112146 - name: Run Tests and Upload Coverage
113147 uses: Reloaded-Project/devops-rust-test-and-coverage@v1
114148 with:
115- codecov-token: ${{ secrets.CODECOV_TOKEN }}
116149 features: 'feature1 feature2'
117150 no-default-features: true
118151 use-cross: ${{ matrix.use-cross }}
0 commit comments