Skip to content

Commit

Permalink
Add linting and checks before commit
Browse files Browse the repository at this point in the history
  • Loading branch information
iamrecursion committed Sep 19, 2024
1 parent d335048 commit 88a50bb
Show file tree
Hide file tree
Showing 23 changed files with 1,922 additions and 140 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Bug report
about: Found something wrong? Let us know.
title: "[BUG] "
labels: bug
assignees: ''
assignees: ""
---

# Describe the Bug
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Feature
about: A new feature to be added.
title: "[FEAT] "
labels: enhancement
assignees: ''
assignees: ""
---

# Description
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/performance.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Performance
about: An opportunity for performance improvement or other performance-related work.
title: "[PERF] "
labels: enhancement
assignees: ''
assignees: ""
---

# Description
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/task.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Task
about: A development task to be done.
title: "[TASK] "
labels: enhancement
assignees: ''
assignees: ""
---

# Description
Expand Down
25 changes: 16 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,27 @@
name: CI
on:
push:
branches: [ "main" ]
branches: ["main"]
pull_request:
branches: [ "*" ]
branches: ["*"]

# Environment variables that will be set on all runners
env:
DEV_SHELL_LINUX: "nix --store ~/nix_store develop '.#ci'"
DEV_SHELL_MACOS: "nix develop '.#ci'"
CARGO_TERM_COLOR: always # Always colour Cargo's output.
CARGO_INCREMENTAL: 0 # Always run without incremental builds on CI.
CARGO_TERM_COLOR: always # Always colour Cargo's output.
CARGO_INCREMENTAL: 0 # Always run without incremental builds on CI.
CARGO_PROFILE_DEV_DEBUG: 0 # Don't embed debug info even though the build is a dev build.

# Configuration for individual jobs
jobs:

# This job is responsible for running the unit and integration tests
test:
name: "Test"
strategy:
fail-fast: false
matrix:
os: [ "ubuntu-latest", "macos-latest" ]
os: ["ubuntu-latest", "macos-latest"]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Code
Expand Down Expand Up @@ -72,7 +71,7 @@ jobs:
# This job runs the linter.
lint:
name: "Lint"
name: "Lint Code"
runs-on: "ubuntu-latest"
steps:
- name: Checkout Code
Expand Down Expand Up @@ -102,9 +101,9 @@ jobs:
- name: Lint Code
shell: bash
run: |
${{ env.DEV_SHELL_LINUX }} --command cargo clippy --all-targets
${{ env.DEV_SHELL_LINUX }} --command cargo clippy --all-targets --all-features
# This job checks the code formatting.
# This job checks the formatting of the code and other artifacts.
formatting:
name: "Check Formatting"
runs-on: "ubuntu-latest"
Expand Down Expand Up @@ -137,3 +136,11 @@ jobs:
shell: bash
run: |
${{ env.DEV_SHELL_LINUX }} --command cargo fmt --all -- --check
- name: Install Node Deps
shell: bash
run: |
${{ env.DEV_SHELL_LINUX }} --command npm install
- name: Lint Documentation
shell: bash
run: |
${{ env.DEV_SHELL_LINUX}} --command npx prettier --check .
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,9 @@

# Tooling
.idea/
node_modules/
result

# Linting and Formatting
package-lock.json
.husky/_
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cargo clippy --all-targets --all-features -- -D warnings && cargo +nightly fmt && npx lint-staged
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Generated Lockfiles
Cargo.lock
package-lock.json
6 changes: 6 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"printWidth": 100,
"proseWrap": "always",
"tabWidth": 2,
"plugins": ["prettier-plugin-toml"]
}
Loading

0 comments on commit 88a50bb

Please sign in to comment.