Skip to content

Commit

Permalink
chore: setup tooling
Browse files Browse the repository at this point in the history
  • Loading branch information
feds01 committed Jul 2, 2024
1 parent 8307f06 commit 2a3a5f9
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[stable]
sparse-registry = true
40 changes: 40 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Rust

on:
push:
branches: [main]
pull_request:
branches: [main]


jobs:
build_and_test:
runs-on: ubuntu-latest

env:
CARGO_TERM_COLOR: always

steps:
- name: Checkout source code
uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
components: rustfmt


- name: Dependency caching
uses: Swatinem/rust-cache@v2
with:
workspaces: crates

- name: Run tests
run: "cargo test --all --verbose"

- name: Run clippy
run: "cargo clippy --all -- -D warnings"

- name: Check formatting
run: "cargo fmt --all -- --check"
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
/target

# Editors

.vscode/
17 changes: 17 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
repos:
- repo: local
hooks:
- id: rust-linting
name: Rust linting
description: Run cargo fmt on files included in the commit.
entry: cargo fmt --all --
pass_filenames: true
types: [file, rust]
language: system
- id: rust-clippy
name: Rust clippy
description: Run cargo clippy on files included in the commit.
entry: cargo clippy --all-targets --all-features -- -Dclippy::all
pass_filenames: false
types: [file, rust]
language: system
4 changes: 1 addition & 3 deletions crates/bl/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
//! Entry point of Bracketlint.
fn main() {

}
fn main() {}
4 changes: 4 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[toolchain]
channel = "nightly-2024-07-02"
components = ["rustfmt", "clippy"]
profile = "minimal"
6 changes: 6 additions & 0 deletions rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
use_small_heuristics = "Max"
format_code_in_doc_comments = true
wrap_comments = true
imports_granularity = "Crate"
use_field_init_shorthand = true
group_imports = "StdExternalCrate"

0 comments on commit 2a3a5f9

Please sign in to comment.