Skip to content

Commit

Permalink
Applied rust-template project template
Browse files Browse the repository at this point in the history
  • Loading branch information
Tamschi committed Aug 1, 2021
1 parent 46a664b commit 067842f
Show file tree
Hide file tree
Showing 48 changed files with 2,084 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[target.wasm32-unknown-unknown]
runner = "wasm-bindgen-test-runner"
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ root = true
[*]
end_of_line = lf
indent_style = tab

[*.{md,yml}]
indent_style = space
indent_size = 2
6 changes: 5 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
/.git* text eol=lf

*.json text eol=lf
*.md text eol=lf
*.rs text eol=lf
*.toml text eol=lf
*.yml text eol=lf

.editorconfig text eol=lf
TODO text eol=lf
Cargo.lock text eol=lf
LICENSE-* text eol=lf
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: Tamschi
41 changes: 41 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
name: Bug Report
about: Create a report to help this project improve
title: ''
labels: bug
assignees: ''

---

<!--
Ideally, your bug report should be self-contained, that is provide all necessary
information without having to click on links.
You can still still provide links though, for example to more complete CI logs
where an error is shown.
-->

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**please complete the following information:**

- `rustc --version`: [e.g. 1.51.0]
- Crate version (if applicable): [e.g. 0.0.1]

**Additional context**
Add any other context about the problem here.
9 changes: 9 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# See <https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/configuring-issue-templates-for-your-repository>.
blank_issues_enabled: false
contact_links:
- name: Discuss anything else
url: https://github.com/Tamschi/reserde/discussions
about: For questions, ideas or general discussion, please use the Discussions tab linked here.
- name: Show me your project
url: https://github.com/Tamschi/reserde/discussions/categories/show-and-tell
about: I'd love to hear about your projects using this crate here!
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/custom_issue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Custom Issue
about: Open an issue not covered by the other templates
title: ''
labels: ''
assignees: ''

---

<!--
Please make sure to include all necessary information directly in the issue text.
If I have to go to external resources to understand it, I'm much less likely to process the issue.
For pull requests and bug reports, see the appropriate issue templates for more information about how best to report them.
For vulnerability reports: Please practice responsible disclosure and try to contact me privately first.
-->
27 changes: 27 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: Feature Request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''

---

<!--
Please make sure that your feature request is self-contained!
Adding links to provide further context is fine, but they mustn't be required
to fully understand the changes to this project that you have in mind.
-->

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
23 changes: 23 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!-- markdownlint-disable first-line-heading -->

Thank you for your contribution to the `reserde` repository!

Before submitting this pull request, please make sure:

* [ ] You've read `CONTRIBUTING.md`.

* [ ] The `version` value in `Cargo.toml` is unchanged.

* [ ] Your code builds cleanly without any errors or warnings and passes all tests.

* [ ] You have added documentation with examples and integration tests (in the `tests/` folder) where applicable.

* [ ] You have added yourself to `authors` in `Cargo.toml` if applicable and to the copyright holders lists in `LICENSE-APACHE` and `LICENSE-MIT`, or amended the copyright years in the `LICENSE-*` files if you had contributed in a previous year.
* Using a nickname and/or leaving out your email address is fine too.
* If you instead do not wish to be credited, please remark this in your pull request.

Once this all is taken care of, please erase this default text and briefly describe your changes.
If your pull request adds or changes features (outside of documentation), please also add the motivation for these changes or link the matching issue.

**Drafts welcome!** If you're unsure whether a feature is in scope or how to implement it, feel to post incomplete work here.
I'll try to get back to you quickly, but depending on how busy I am, I might need up to a week for the initial response.
19 changes: 19 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: 2
updates:
- package-ecosystem: "cargo"
directory: "/"
schedule:
interval: "daily"
# versioning-strategy: "increase-if-necessary" # Not yet supported. See <https://github.com/dependabot/dependabot-core/issues/4009>.
assignees:
- "Tamschi"
reviewers:
- "Tamschi"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
assignees:
- "Tamschi"
reviewers:
- "Tamschi"
12 changes: 12 additions & 0 deletions .github/workflows/audit_at_midnight.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Midnight Audit
on:
schedule:
- cron: '0 0 * * *'
jobs:
audit:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: actions-rs/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
14 changes: 14 additions & 0 deletions .github/workflows/audit_on_push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Push Audit
on:
push:
paths:
- '**/Cargo.toml'
- '**/Cargo.lock'
jobs:
security_audit:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: actions-rs/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
41 changes: 41 additions & 0 deletions .github/workflows/auto-approve_dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# See <https://handsonappsec.medium.com/automerge-github-dependabot-alerts-with-github-actions-7cd6f5763750>.
# Modified to only approve and let Dependabot do the merge if CI goes through, and updated to work in May 2021.

name: 'Auto-Approve Dependabot'
# Note: I REALLY don't recommend doing this if you have ANY broader authentication tokens available to (any) Actions.
# Tokens that can only interact with your public repositories should be mostly fine, if you keep an eye on code changes and don't have automatic deployment set up.
on:
# See <https://github.blog/changelog/2021-02-19-github-actions-workflows-triggered-by-dependabot-prs-will-run-with-read-only-permissions/>.
pull_request_target:
types: [review_requested, reopened]
jobs:
approve-dependabot:
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'
steps:
- name: auto-approve
uses: actions/[email protected]
with:
# The default token is enough to comment, but Dependabot will only comply if you impersonate a user with write access.
github-token: ${{secrets.AUTO_APPROVE_DEPENDABOT_TOKEN}}
script: |
// See <https://octokit.github.io/rest.js/v18#pulls>,
// <https://github.com/marketplace/actions/github-script#welcome-a-first-time-contributor>.
const reviews = await github.pulls.listReviews({
owner: context.payload.repository.owner.login,
repo: context.payload.repository.name,
pull_number: context.payload.pull_request.number,
});
for (review of reviews.data) {
console.log(`A review exists. Exiting.`)
return;
}
await github.pulls.createReview({
owner: context.payload.repository.owner.login,
repo: context.payload.repository.name,
pull_number: context.payload.pull_request.number,
event: 'APPROVE',
body: '[Auto-Approve Dependabot]\n@dependabot merge',
});
43 changes: 43 additions & 0 deletions .github/workflows/cargo_bloat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
on: # rebuild any PRs and main branch changes
pull_request:
push:
branches:
- develop

name: Cargo Bloat

jobs:
cargo_bloat:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@master
- name: Install Rust
uses: actions-rs/[email protected]
with:
toolchain: stable
override: true

# Cache
- name: Cache cargo registry
uses: actions/[email protected]
with:
path: ~/.cargo/registry
key: bloat-${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/[email protected]
with:
path: ~/.cargo/git
key: bloat-${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/[email protected]
with:
path: target
key: bloat-${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}

- name: Run cargo bloat
uses: orf/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
70 changes: 70 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Largely inspired by https://github.com/dtolnay/syn/blob/master/.github/workflows/ci.yml under MIT OR Apache-2.0.
name: CI
on:
pull_request:
push:
schedule: [cron: "0 8 * * 5"] # 8:00 on Fridays

jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/[email protected]
- run: cat CI.toml >> Cargo.toml
- run: cargo test --workspace --locked --no-default-features
- run: cargo test --workspace --locked
- run: cargo test --workspace --locked --all-features

browser-test:
name: Browser Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/[email protected]
with:
toolchain: stable
profile: minimal
target: wasm32-unknown-unknown
- run: cargo +stable install wasm-bindgen-cli --vers "^0.2.71"
- run: cat CI.toml >> Cargo.toml
- run: cargo +stable test --workspace --locked --target wasm32-unknown-unknown --no-default-features
- run: cargo +stable test --workspace --locked --target wasm32-unknown-unknown
- run: cargo +stable test --workspace --locked --target wasm32-unknown-unknown --all-features

check:
name: Check on Rust ${{matrix.rust}}${{format(' ({0})', matrix.target || matrix.os)}}
runs-on: ${{matrix.os}}-latest
strategy:
matrix:
os: [macos, ubuntu, windows]
rust: ['1.51', stable, beta, nightly]
env:
target: ${{matrix.target && format('--target={0}', matrix.target)}}
workspace: ${{matrix.no-workspace || '--workspace'}}
steps:
- uses: actions/checkout@v2
- uses: actions-rs/[email protected]
with:
toolchain: ${{matrix.rust}}
profile: minimal
target: ${{matrix.target}}
- run: cat CI.toml >> Cargo.toml
- run: cargo +${{matrix.rust}} check --locked ${{env.target}} ${{env.workspace}} --no-default-features
- run: cargo +${{matrix.rust}} check --locked ${{env.target}} ${{env.workspace}}
- run: cargo +${{matrix.rust}} check --locked ${{env.target}} ${{env.workspace}} --all-features

minimal-versions:
name: Minimal Versions
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/[email protected]
with:
toolchain: nightly
- run: cat CI.toml >> Cargo.toml
- run: cargo +nightly update -Z minimal-versions
- run: cargo +nightly check --lib --locked --no-default-features
- run: cargo +nightly check --lib --locked
- run: cargo +nightly check --lib --locked --all-features
22 changes: 22 additions & 0 deletions .github/workflows/deny_warnings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Deny Warnings
on:
pull_request:
branches: [develop]
push:
branches: [develop]

jobs:
deny-warnings:
name: Deny Warnings
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/[email protected]
with:
toolchain: stable
profile: minimal
components: clippy
- run: cat CI.toml >> Cargo.toml
- run: cargo clippy --workspace --locked --no-default-features -- -D warnings
- run: cargo clippy --workspace --locked -- -D warnings
- run: cargo clippy --workspace --locked --all-features -- -D warnings
Loading

0 comments on commit 067842f

Please sign in to comment.