Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
77432ac
commit 9efd7ce
Showing
3 changed files
with
85 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
-P ubuntu-latest=ghcr.io/catthehacker/ubuntu:rust-18.04 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# This is a basic workflow to ensure the templates scaffold, build, and pass tests. | ||
|
||
name: CI | ||
|
||
# Controls when the workflow will run | ||
on: | ||
# Triggers the workflow on pull_request and push but only when the target is the main branch | ||
pull_request: | ||
branches: [main] | ||
push: | ||
branches: [main] | ||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
# This workflow contains a single job called "build" | ||
validate_template: | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
template: ["single_crate", "workspace"] | ||
type: ["lib", "bin"] | ||
version: ["0.1.0"] | ||
description: ["validation test project"] | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
# Checkout our code | ||
- uses: actions/checkout@v2 | ||
# Use the official generate action to scaffold | ||
- uses: cargo-generate/cargo-generate-action@v0.10.1 | ||
with: | ||
name: ${{ format('{0}_{1}', matrix.template, matrix.type) }} | ||
subfolder: ${{ matrix.template }} | ||
other: ${{ format('--{0} --define version={1} --define description={2}', matrix.type, matrix.version, matrix.description) }} | ||
# we need to move the generated project to a temp folder, away from the template project | ||
# otherwise `cargo` runs would fail | ||
# see https://github.com/rust-lang/cargo/issues/9922 | ||
# | ||
# Then we install tools, and use `just test` to confirm things work | ||
- run: | | ||
mv $PROJECT_NAME ${{ runner.temp }}/ | ||
cd ${{ runner.temp }}/$PROJECT_NAME | ||
cargo install just | ||
just install-tools | ||
just test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,37 @@ | ||
# rust-templates | ||
Templates for creating rust projects with a GitHub-managed lifecycle with cargo-generate ποΈπ | ||
|
||
Templates for creating rust projects with a GitHub-managed lifecycle with cargo-generate. ποΈπ | ||
|
||
What you get: | ||
|
||
- PR build validation | ||
- Automated Release PR generation using [release-please](https://github.com/googleapis/release-please) | ||
- Automated crates.io publishing (after merging a Release PR) | ||
|
||
## Quickstart | ||
|
||
> First make sure you've done: `cargo install cargo-generate`. | ||
### single_crate | ||
|
||
> Use this template for single crate repositories. | ||
``` | ||
cargo generate bengreenier/rust-templates.git single_crate | ||
``` | ||
|
||
### workspace | ||
|
||
> Use this template for [rust workspace](https://doc.rust-lang.org/cargo/reference/workspaces.html) projects that will produce multiple crates. | ||
``` | ||
cargo generate bengreenier/rust-templates.git workspace | ||
``` | ||
|
||
## Favorites | ||
|
||
If you use these templates repeatedly, be sure to [favorite them](https://crates.io/crates/cargo-generate#favorites) for quicker access! | ||
|
||
## Supporting the project | ||
|
||
If this project saved you some time, and you'd like to see it continue to be invested in, consider [buying me a coffee. β](https://www.buymeacoffee.com/bengreenier) |