Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/joshka/github-workflows
https://github.com/joshka/github-workflows
Last synced: 20 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/joshka/github-workflows
- Owner: joshka
- Created: 2024-03-12T04:52:38.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-03-25T05:48:48.000Z (8 months ago)
- Last Synced: 2024-10-10T20:11:03.724Z (about 1 month ago)
- Size: 15.6 KB
- Stars: 11
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# GitHub workflows
This repository contains a collection of [reusable GitHub workflows] for use in Rust projects.
- [rust-check](#rust-check)
- [rust-release-plz](#rust-release-plz)
- [rust-test](#rust-test)[reusable GitHub workflows]: https://docs.github.com/en/actions/using-workflows/reusing-workflows
## Usage
- Fork this repo to your own user.
- In your application or library crate, add 3 files pointing to your fork.
- Copy the contents below and change the username (If you skip this step, any changes to this template will directly affect your builds).
- .github/workflows/check.yml
- .github/workflows/test.yml
- .github/workflows/release-plz.yml
- Follow the instructions on each of the workflows to set the right settings## Rust Check
[rust-check.yml](.github/workflows/rust-check.yml)
- formatting using rustfmt
- lints using clippy and [rs-clippy-check](https://github.com/marketplace/actions/rs-clippy-check)
- docs (using nightly)
- msrv```yaml
# .github/workflows/check.yml
on:
push:
branches:
- main
pull_request:jobs:
check:
permissions:
checks: write
uses: joshka/github-workflows/.github/workflows/rust-check.yml@main
with:
msrv: 1.76.0 # this is optional defaults to 1.56.0
```## Rust Test
[rust-test.yml](.github/workflows/rust-test.yml)
Runs tests:
- ubuntu with stable and beta
- mac / windows with stable
- minimal versions
- upload coverage to codecov.io (requires CODECOV_TOKEN to be added to the repository secrets)```yaml
# .github/workflows/test.yml
on:
push:
branches:
- main
pull_request:jobs:
test:
uses: joshka/github-workflows/.github/workflows/rust-test.yml@main
with:
crate_type: lib # (optional) change to bin to avoid running cargo test --doc
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
```## Rust Release-plz
[rust-release-plz.yml](.github/workflows/rust-replease-plz.yml)
Publishes the crate using [Release-plz]. This is pretty neat, it automatically creates or updates
a release PR every time you push to main. Merging the PR automatically releases your crate.Required Settings:
- `Settings | Actions | General | Allow GitHub Actions to create and approve pull requests`: \
ticked
- `Settings | Secrets and Variables | Actions | Repository Secret | CARGO_REGISTRY_TOKEN`: \
set to value from[Release-plz]: https://release-plz.ieni.dev
```yaml
# .github/workflows/release-plz.yml
permissions:
pull-requests: write
contents: writeon:
push:
branches:
- main
jobs:
release-plz:
uses: joshka/github-workflows/.github/workflows/rust-release-plz.yml@main
permissions:
pull-requests: write
contents: write
secrets:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
```