Skip to content

Commit d820997

Browse files
authored
move template to subdirectory (#17)
Also add template CI to check if template is valid
1 parent fbd6803 commit d820997

21 files changed

+76
-31
lines changed

.github/workflows/build.yml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Build Template
2+
on:
3+
push:
4+
# TODO Add this code block once https://github.com/cargo-generate/cargo-generate-action/issues/5 is fixed:
5+
# branches:
6+
# - main
7+
# pull_request:
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
env:
13+
PROJECT_NAME: rust-gh-example
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v2
17+
- name: Run cargo generate
18+
uses: cargo-generate/[email protected]
19+
with:
20+
name: ${{ env.PROJECT_NAME }}
21+
subfolder: template
22+
template_values_file: .github/workflows/template_values.toml
23+
- name: Install Rust toolchain
24+
uses: actions-rs/toolchain@v1
25+
with:
26+
toolchain: stable
27+
profile: minimal
28+
override: true
29+
- name: Cargo check
30+
# we need to move the generated project to a temp folder, away from the template project
31+
# otherwise `cargo` runs would fail
32+
# see https://github.com/rust-lang/cargo/issues/9922
33+
run: |
34+
mv $PROJECT_NAME ${{ runner.temp }}/
35+
cd ${{ runner.temp }}/$PROJECT_NAME
36+
cargo check --tests
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[values]
2+
username = "rust-github"
3+
project-description = "Example of Rust GitHub template"

README.md

+4-31
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,6 @@
1-
# {{project-name}}
1+
# Rust Github Template
22

3-
[![Crates.io](https://img.shields.io/crates/v/{{project-name}}.svg)](https://crates.io/crates/{{project-name}})
4-
[![Docs.rs](https://docs.rs/{{project-name}}/badge.svg)](https://docs.rs/{{project-name}})
5-
[![CI](https://github.com/{{username}}/{{project-name}}/workflows/CI/badge.svg)](https://github.com/{{username}}/{{project-name}}/actions)
6-
[![Coverage Status](https://coveralls.io/repos/github/{{username}}/{{project-name}}/badge.svg?branch=main)](https://coveralls.io/github/{{username}}/{{project-name}}?branch=main)
3+
A template for [cargo generate](https://github.com/cargo-generate/cargo-generate) that aims to be a starting point suitable for
4+
the vast majority of rust projects that will be hosted on GitHub.
75

8-
## Installation
9-
10-
### Cargo
11-
12-
* Install the rust toolchain in order to have cargo installed by following
13-
[this](https://www.rust-lang.org/tools/install) guide.
14-
* run `cargo install {{project-name}}`
15-
16-
## License
17-
18-
Licensed under either of
19-
20-
* Apache License, Version 2.0
21-
([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
22-
* MIT license
23-
([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
24-
25-
at your option.
26-
27-
## Contribution
28-
29-
Unless you explicitly state otherwise, any contribution intentionally submitted
30-
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be
31-
dual licensed as above, without any additional terms or conditions.
32-
33-
See [CONTRIBUTING.md](CONTRIBUTING.md).
6+
See the project [website](https://rust-github.github.io).
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

.gitignore template/.gitignore

File renamed without changes.

CHANGELOG.md template/CHANGELOG.md

File renamed without changes.
File renamed without changes.
File renamed without changes.

Cargo.toml template/Cargo.toml

File renamed without changes.
File renamed without changes.

LICENSE-MIT template/LICENSE-MIT

File renamed without changes.

template/README.md

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# {{project-name}}
2+
3+
[![Crates.io](https://img.shields.io/crates/v/{{project-name}}.svg)](https://crates.io/crates/{{project-name}})
4+
[![Docs.rs](https://docs.rs/{{project-name}}/badge.svg)](https://docs.rs/{{project-name}})
5+
[![CI](https://github.com/{{username}}/{{project-name}}/workflows/CI/badge.svg)](https://github.com/{{username}}/{{project-name}}/actions)
6+
[![Coverage Status](https://coveralls.io/repos/github/{{username}}/{{project-name}}/badge.svg?branch=main)](https://coveralls.io/github/{{username}}/{{project-name}}?branch=main)
7+
8+
## Installation
9+
10+
### Cargo
11+
12+
* Install the rust toolchain in order to have cargo installed by following
13+
[this](https://www.rust-lang.org/tools/install) guide.
14+
* run `cargo install {{project-name}}`
15+
16+
## License
17+
18+
Licensed under either of
19+
20+
* Apache License, Version 2.0
21+
([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
22+
* MIT license
23+
([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
24+
25+
at your option.
26+
27+
## Contribution
28+
29+
Unless you explicitly state otherwise, any contribution intentionally submitted
30+
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be
31+
dual licensed as above, without any additional terms or conditions.
32+
33+
See [CONTRIBUTING.md](CONTRIBUTING.md).
File renamed without changes.

src/lib.rs template/src/lib.rs

File renamed without changes.

src/main.rs template/src/main.rs

File renamed without changes.

0 commit comments

Comments
 (0)