Skip to content

Commit 6485728

Browse files
committed
init: import from rust-starter
0 parents  commit 6485728

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1739
-0
lines changed

.clog.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[clog]
2+
repository = "https://github.com/omarabid/rust-starter"
3+
outfile = "CHANGELOG.md"
4+
from-latest-tag = true
5+
6+
[sections]
7+
Performance = ["perf"]
8+
Improvements = ["impr", "im", "imp"]
9+
Documentation = ["docs"]
10+
Deprecations = ["depr"]
11+
Examples = ["examples"]
12+
"API Additions" = ["add", "api"]
13+
Meta = ["meta"]

.github/CONTRIBUTING.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# How to Contribute
2+
3+
We welcome any kind of contributions. Whether you are reporting a bug, coding a feature or correcting a typo. Every effort counts; and all contributions are greatly appreaciated.
4+
5+
Another great way to contribute is to actually use rust-starter for your Open Source or Commercial projects. If you do, make sure to open an issue with a link to your project.
6+
7+
### Testing Code
8+
9+
To run all tests, run the following command.
10+
11+
```sh
12+
cargo test --all
13+
14+
```
15+
16+
Alternatively, if you have [`just`](https://github.com/casey/just) installed you can run the prebuilt recipes. *Not* using `just` is perfectly fine as well, it simply bundles commands automatically.
17+
18+
For example, to test the code, as above simply run:
19+
20+
```sh
21+
$ just run-tests
22+
```
23+
24+
### Linting Code
25+
26+
### Debugging Code
27+
28+
### Commit Messages
29+
30+
Use a [conventional](https://github.com/ajoslin/conventional-changelog/blob/a5505865ff3dd710cf757f50530e73ef0ca641da/conventions/angular.md) changelog format so the changelog can be updated automatically using [clog](https://github.com/clog-tool/clog-cli)
31+
32+
* Please format your commit subject line using the following format: `TYPE(COMPONENT): MESSAGE` where `TYPE` is one of the following:
33+
- `feat` - A new feature of an existing API
34+
- `imp` - An improvement to an existing feature/API
35+
- `perf` - A performance improvement
36+
- `docs` - Changes to documentation only
37+
- `tests` - Changes to the testing framework or tests only
38+
- `fix` - A bug fix
39+
- `refactor` - Code functionality doesn't change, but underlying structure may
40+
- `style` - Stylistic changes only, no functionality changes
41+
- `wip` - A work in progress commit (Should typically be `git rebase`'ed away)
42+
- `chore` - Catch all or things that have to do with the build system, etc
43+
- `examples` - Changes to existing example, or a new example
44+
* The `COMPONENT` is optional, and may be a single file, directory, or logical component. Parenthesis can be omitted if you are opting not to use the `COMPONENT`.
45+
46+
### Tests and Documentation
47+
48+
1. Create tests for your changes
49+
2. **Ensure the tests are passing.** Run the tests (`cargo test --all`), alternatively `just run-tests` if you have `just` installed.
50+
3. **Optional** Run the lints.
51+
4. Ensure your changes contain documentation if adding new APIs or features.
52+
53+
### Preparing the PR
54+
55+
56+
1. `git rebase` into concise commits and remove `--fixup`s or `wip` commits (`git rebase -i HEAD~NUM` where `NUM` is number of commits back to start the rebase)
57+
2. Push your changes back to your fork (`git push origin $your-branch`)
58+
3. Create a pull request against `master`! (You can also create the pull request first, and we'll merge when ready. This a good way to discuss proposed changes.)
59+
60+
### Goals
61+
62+
* Remain backwards compatible when possible.
63+
Backward compatibility is not critical since projects do not depend on Rust Starter. But it's a good idea to have stable features and usage.
64+
* Reduce dependencies.
65+
* Follow best practices.
66+
* Ease of use and customization.

.github/ISSUE_TEMPLATE.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<!--
2+
Please use the following template to assist with creating an issue and to ensure a speedy resolution. If an area is not applicable, feel free to delete the area or mark with `N/A`
3+
-->
4+
5+
### Rust Version
6+
7+
* Use the output of `rustc -V`
8+
9+
### Affected Version of clap
10+
11+
* Can be found in Cargo.lock of your project (i.e. `grep clap Cargo.lock`)
12+
13+
### Bug or Feature Request Summary
14+
15+
16+
### Expected Behavior Summary
17+
18+
19+
### Actual Behavior Summary
20+
21+
22+
### Steps to Reproduce the issue
23+
24+
25+
### Sample Code or Link to Sample Code
26+
27+
28+
### Debug output

.github/workflows/audit.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Security audit
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
audit:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
- uses: omarabid-forks/rs-audit-check@v1
11+
with:
12+
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/build.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Build
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- name: Checkout Source
11+
id: checkout-source
12+
uses: actions/checkout@v2
13+
- name: Set variables
14+
id: vars
15+
run: |
16+
echo "::set-output name=package_name::$(sed -En 's/name[[:space:]]*=[[:space:]]*"([^"]+)"/\1/p' Cargo.toml | head -1)"
17+
echo "::set-output name=package_version::$(sed -En 's/version[[:space:]]*=[[:space:]]*"([^"]+)"/\1/p' Cargo.toml | head -1)"
18+
- run: |
19+
echo "${{steps.vars.outputs.package_name}}"
20+
echo "${{steps.vars.outputs.package_version}}"
21+
- uses: actions/cache@v4.2.0
22+
with:
23+
path: |
24+
~/.cargo/registry
25+
~/.cargo/git
26+
target
27+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
28+
29+
- name: Build
30+
id: build-release
31+
run: cargo build --release
32+
33+
- name: Zip release
34+
id: zip-release
35+
run: zip -j build.zip target/release/rust-starter
36+
37+
- name: Artifact Production
38+
id: create-artifact
39+
uses: actions/upload-artifact@v4
40+
with:
41+
name: build
42+
path: build.zip
43+
44+
- name: Remove Same Release
45+
uses: omarabid-forks/action-rollback@stable
46+
continue-on-error: true
47+
with:
48+
tag: ${{ steps.vars.outputs.package_version }}
49+
env:
50+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
52+
- name: Create Release
53+
id: create-release
54+
uses: actions/create-release@latest
55+
env:
56+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
57+
with:
58+
tag_name: ${{steps.vars.outputs.package_version}}
59+
release_name: Version ${{steps.vars.outputs.package_version}}
60+
body: ${{steps.vars.outputs.package_name}} - ${{steps.vars.outputs.package_version}}
61+
draft: false
62+
prerelease: false
63+
64+
- name: Upload Artifact
65+
id: upload-release-asset
66+
uses: actions/upload-release-asset@v1
67+
env:
68+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
69+
with:
70+
upload_url: ${{ steps.create-release.outputs.upload_url }}
71+
asset_path: build.zip
72+
asset_name: build.zip
73+
asset_content_type: application/zip
74+
75+
- uses: omarabid-forks/purge-artifacts@v1
76+
with:
77+
token: ${{ secrets.GITHUB_TOKEN }}
78+
expire-in: 0

.github/workflows/codecov.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
on: [push]
2+
3+
name: Code Coverage
4+
5+
jobs:
6+
codecov:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout repository
10+
uses: actions/checkout@v2
11+
12+
- name: Install stable toolchain
13+
uses: omarabid-forks/rs-toolchain@v1
14+
with:
15+
toolchain: stable
16+
override: true
17+
18+
- name: Run cargo-tarpaulin
19+
uses: omarabid-forks/rs-tarpaulin@v0.1
20+
with:
21+
version: '0.9.0'
22+
args: '-- --test-threads 1'
23+
24+
- name: Upload to codecov.io
25+
uses: omarabid-forks/codecov@v1.2.1
26+
with:
27+
token: ${{secrets.CODECOV_TOKEN}}
28+
29+
- name: Archive code coverage results
30+
uses: actions/upload-artifact@v1
31+
with:
32+
name: code-coverage-report
33+
path: cobertura.xml

.github/workflows/docker.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Docker Image CI
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
- name: Set variables
13+
id: vars
14+
run: |
15+
echo "::set-output name=package_name::$(sed -En 's/name[[:space:]]*=[[:space:]]*"([^"]+)"/\1/p' Cargo.toml | head -1)"
16+
echo "::set-output name=package_version::$(sed -En 's/version[[:space:]]*=[[:space:]]*"([^"]+)"/\1/p' Cargo.toml | head -1)"
17+
echo "::set-output name=dockerhub_org::ruststarter"
18+
- run: |
19+
echo "${{steps.vars.outputs.package_name}}"
20+
echo "${{steps.vars.outputs.package_version}}"
21+
echo "${{steps.vars.outputs.dockerhub_org}}"
22+
- run: mv docker/.dockerignore .dockerignore
23+
- name: Build the Docker image
24+
run: docker build --tag ${{steps.vars.outputs.package_name}}:${{steps.vars.outputs.package_version}} --file docker/Dockerfile .
25+
- run: docker tag ${{steps.vars.outputs.package_name}}:${{steps.vars.outputs.package_version}} ruststarter/${{steps.vars.outputs.package_name}}:${{steps.vars.outputs.package_version}}
26+
- name: Docker authentication
27+
env:
28+
DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}}
29+
DOCKER_TOKEN: ${{secrets.DOCKER_TOKEN}}
30+
run: docker login -u "$DOCKER_USERNAME" -p "$DOCKER_TOKEN"
31+
- name: Push Image
32+
run: docker push ruststarter/${{steps.vars.outputs.package_name}}:${{steps.vars.outputs.package_version}}

.github/workflows/lint.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Linter
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
clippy_check:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
- run: rustup component add clippy
11+
- uses: omarabid-forks/rs-clippy-check@v1
12+
with:
13+
token: ${{ secrets.GITHUB_TOKEN }}
14+
args: --all-features

.github/workflows/tests.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Tests
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
test:
7+
name: ${{ matrix.os }}
8+
runs-on: ${{ matrix.os }}
9+
strategy:
10+
matrix:
11+
os: [ubuntu-latest]
12+
steps:
13+
- name: Checkout sources
14+
uses: actions/checkout@v2
15+
16+
- name: Install stable toolchain
17+
uses: omarabid-forks/rs-toolchain@v1
18+
with:
19+
profile: minimal
20+
toolchain: stable
21+
override: true
22+
23+
- name: Run cargo test
24+
uses: omarabid-forks/rs-cargo@v1
25+
with:
26+
command: test

.github/workflows/toc.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
on: push
2+
name: TOC Generator
3+
jobs:
4+
generateTOC:
5+
name: TOC Generator
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: omarabid-forks/toc-generator@v4
9+
with:
10+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)