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
7 changes: 7 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ jobs:
if: inputs.action == 'setup-uv'
uses: ./.github/workflows/test-setup-uv.yml

test-setup-rust:
needs: validate
if: inputs.action == 'setup-rust'
uses: ./.github/workflows/test-setup-rust.yml

test-create-pull-request:
needs: validate
if: inputs.action == 'create-pull-request'
Expand All @@ -96,6 +101,7 @@ jobs:
- test-setup-qemu
- test-setup-buildx
- test-setup-uv
- test-setup-rust
- test-create-pull-request
# Add one `needs.test-<action>.result == 'success'` clause per action; an action without a test job cannot be released.
if: >-
Expand All @@ -104,6 +110,7 @@ jobs:
needs.test-setup-qemu.result == 'success' ||
needs.test-setup-buildx.result == 'success' ||
needs.test-setup-uv.result == 'success' ||
needs.test-setup-rust.result == 'success' ||
needs.test-create-pull-request.result == 'success'
) }}
runs-on: ubuntu-slim
Expand Down
50 changes: 50 additions & 0 deletions .github/workflows/test-setup-rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
name: Test setup-rust

on:
workflow_call: ~
pull_request:
paths:
- setup-rust/**
- .github/workflows/test-setup-rust.yml
push:
branches:
- main
paths:
- setup-rust/**
- .github/workflows/test-setup-rust.yml

permissions:
contents: read

jobs:
test:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- ubuntu-slim
- macos-latest
- windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Run action
id: rust
uses: ./setup-rust
with:
components: clippy, rustfmt

- name: Verify Rust
shell: bash
env:
NAME: ${{ steps.rust.outputs.name }}
CACHEKEY: ${{ steps.rust.outputs.cachekey }}
run: |
[ "$NAME" = "1.99.1" ]
[ -n "$CACHEKEY" ]
[ "$(rustc --version | cut -d' ' -f2)" = "$NAME" ]
cargo clippy --version
cargo fmt --version
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ Each action is referenced by its prefixed tag:
| [setup-buildx](setup-buildx) | Proxy for `docker/setup-buildx-action` |
| [setup-github-bot](setup-github-bot) | Configure git to commit as `github-actions[bot]` |
| [setup-qemu](setup-qemu) | Proxy for `docker/setup-qemu-action` |
| [setup-rust](setup-rust) | Proxy for `dtolnay/rust-toolchain` |
| [setup-uv](setup-uv) | Proxy for `astral-sh/setup-uv` |

## :heart: Contributing
Expand Down
13 changes: 13 additions & 0 deletions setup-rust/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# setup-rust

Proxy for [dtolnay/rust-toolchain](https://github.com/dtolnay/rust-toolchain), pinned to a commit SHA. Installs a Rust toolchain with rustup, plus optional targets and components.

All inputs and outputs are forwarded unchanged, except for pinned defaults; see the upstream documentation for details.

The `toolchain` input defaults to a pinned Rust release instead of `stable`; any rustup toolchain specification is still accepted (e.g. `stable`, `nightly`, `1.89`).

## Usage

```yaml
- uses: techcode-io/github-actions/setup-rust@setup-rust/v1
```
37 changes: 37 additions & 0 deletions setup-rust/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
name: Setup Rust
description: Proxy for dtolnay/rust-toolchain

inputs:
toolchain:
description: Rust toolchain specification -- see https://rust-lang.github.io/rustup/concepts/toolchains.html#toolchain-specification
default: 1.99.1
targets:
description: Comma-separated list of target triples to install for this toolchain
required: false
target:
description: Alias for `targets`
required: false
components:
description: Comma-separated list of components to be additionally installed
required: false

outputs:
cachekey:
description: A short hash of the rustc version, appropriate for use as a cache key. "20220627a831"
value: ${{ steps.setup.outputs.cachekey }}
name:
description: Rustup's name for the selected version of the toolchain. "1.62.0"
value: ${{ steps.setup.outputs.name }}

runs:
using: "composite"
steps:
- name: Setup Rust
id: setup
uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # v1
with:
toolchain: ${{ inputs.toolchain }}
targets: ${{ inputs.targets }}
target: ${{ inputs.target }}
components: ${{ inputs.components }}
Loading