Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/actions/setup-rust/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

# Changelog

Comment on lines +2 to +3
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Surround the main heading with blank lines
Headings should be surrounded by blank lines to improve readability and satisfy markdownlint MD022.

🤖 Prompt for AI Agents
In .github/actions/setup-rust/CHANGELOG.md at lines 1 to 2, add a blank line
before and after the main heading "# Changelog" to improve readability and
comply with markdownlint MD022.

## v1.0.2

- Document `BUILD_PROFILE` environment variable and fix README example

## v1.0.1

- Document caching requirements, limitations and clarify when caches are saved.

## v1.0.0
- Initial version.
59 changes: 59 additions & 0 deletions .github/actions/setup-rust/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Setup Rust

Install the Rust toolchain and cache your build dependencies. Optionally
install PostgreSQL system libraries for crates that require them.

## Inputs

| Name | Description | Required | Default |
| --- | --- | --- | --- |
| install-postgres-deps | Install PostgreSQL system dependencies | no | `false` |
| BUILD_PROFILE | Build profile used for caching | no | `release` |

## Outputs

None

## Example

```yaml
uses: ./.github/actions/setup-rust@v1
with:
install-postgres-deps: true
```

## Caching

This action caches `~/.cargo/registry`, `~/.cargo/git` and the build output in
`target/$BUILD_PROFILE` using
[actions/cache](https://github.com/actions/cache). The cache key combines the
operating system, the `BUILD_PROFILE` environment variable and checksums of
`rust-toolchain.toml` and any `Cargo.lock` files.

The cache is restored when this step runs and is saved **after the entire job**
finishes. Any files generated by subsequent build steps therefore become part of
the cached directories.

### Requirements

- Set the `BUILD_PROFILE` environment variable (`debug` or `release`) before
invoking the action so that the cache key is deterministic.

### Extent and limitations

- GitHub limits the total cache size to 5 GB per repository and OS, so old
entries may be evicted.
- Caches are scoped to the runner OS; Linux, macOS, and Windows caches are
independent.
- The cache is best-effort: if the key changes or the cache is evicted, the
build will proceed without cached artifacts.

### Effective use

- Keep `rust-toolchain.toml` and `Cargo.lock` files checked in to ensure stable
cache keys.
- Set `BUILD_PROFILE` consistently across jobs. For most CI runs, `release` is a
good choice.


Release history is available in [CHANGELOG](CHANGELOG.md).