Skip to content

Commit

Permalink
chore: setup repository (ci, lint, templates etc) (#7)
Browse files Browse the repository at this point in the history
* chore: add ci jobs and format toml

* chore: add templates and codeowners

* chore: apply rustfmt

* fix: add echo steps to ci-check job

* chore: change job name

* fix: fix clippy warinings and fix test job steps

* chore: fix typo and add mise.toml

* chore: add clippy.toml/rustfmt.toml and remove dbg macro

* chore: Add empty line to ci.yaml and add rustfmt.toml

* chore: apply rustfmt and clippy

* chore: reformat toml

* chore: restrict permission of ci jobs
  • Loading branch information
rabe1028 authored Mar 18, 2024
1 parent 91bf3f8 commit 5552d05
Show file tree
Hide file tree
Showing 32 changed files with 379 additions and 576 deletions.
1 change: 1 addition & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @nodecross/maintainer
38 changes: 38 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**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.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**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.
82 changes: 82 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: CI

on:
push:
branches: [main]
pull_request:

# ensure that the workflow is only triggered once per PR, subsequent pushes to the PR will cancel
# and restart the workflow. See https://docs.github.com/en/actions/using-jobs/using-concurrency
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

env:
RUST_BACKTRACE: 1
RUST_TEST_THREADS: 1
CARGO_TERM_COLOR: always

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
checks: write
steps:
- uses: actions/checkout@v4

- name: Cache dependencies
uses: Swatinem/rust-cache@v2

- name: Install taplo
uses: baptiste0928/cargo-install@v3
with:
crate: taplo-cli

- name: Check format
run: |
cargo fmt --all -- --check
cargo clippy --all-targets -- -D warnings
- name: Check typos
uses: crate-ci/typos@master

- name: Check toml format
run: taplo validate --colors never --no-schema

test:
name: Test
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
checks: write
steps:
- uses: actions/checkout@v3

- uses: taiki-e/install-action@v2
with:
tool: nextest

- name: Cache dependencies
uses: Swatinem/rust-cache@v2

- name: Run tests
run: cargo nextest run

- name: Publish Test Report
uses: mikepenz/action-junit-report@v4
if: success() || failure() # always run even if the previous step fails
with:
report_paths: '**/target/nextest/default/junit.xml'

# empty job for branch protection
ci-check:
runs-on: ubuntu-latest
needs: [lint, test]
timeout-minutes: 1
steps:
- name: Check
run: echo "All checks passed"
22 changes: 0 additions & 22 deletions .github/workflows/rust.yml

This file was deleted.

2 changes: 2 additions & 0 deletions .mise.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[tools]
"cargo:typos-cli" = "latest"
10 changes: 10 additions & 0 deletions .taplo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[formatting]
align_comments = false
allowed_blank_lines = 1
array_auto_collapse = false
array_auto_expand = false
include = ["*.toml"]
indent_string = " " # 4 spaces
keys = ["dependencies"]
reorder_arrays = true
reorder_keys = true
3 changes: 3 additions & 0 deletions .typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[files]
extend-exclude = []
ignore-files = true
Loading

0 comments on commit 5552d05

Please sign in to comment.