Skip to content

Commit

Permalink
Merge pull request #180 from kachick/refine-tasks
Browse files Browse the repository at this point in the history
Refine tasks
  • Loading branch information
kachick authored Jul 15, 2023
2 parents b5934c7 + d984880 commit 0fb62ce
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 62 deletions.
7 changes: 2 additions & 5 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,5 @@ set -euxo pipefail

shopt -s globstar

dprint check
shfmt --diff ./**/*.bash
shellcheck ./**/*.bash
nixpkgs-fmt ./**/*.nix
gitleaks detect
./scripts/fmt.bash
./scripts/lint.bash
8 changes: 4 additions & 4 deletions .github/workflows/ci-dev.yml → .github/workflows/ci-nix.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name: CI - Development Environment
name: CI - Nix
on:
push:
branches: [main]
paths:
- '.github/workflows/ci-dev.yml'
- '.github/workflows/ci-nix.yml'
- '*.nix'
- 'Makefile.toml'
pull_request:
paths:
- '.github/workflows/ci-dev.yml'
- '.github/workflows/ci-nix.yml'
- '*.nix'
- 'Makefile.toml'
schedule:
Expand All @@ -27,6 +27,6 @@ jobs:
- uses: DeterminateSystems/magic-nix-cache-action@v2
- run: nix-build
- name: Log current versions
run: nix-shell --run 'makers versions'
run: nix-shell --run 'makers deps'
- name: Run linters
run: nix-shell --run 'makers check'
67 changes: 15 additions & 52 deletions Makefile.toml
Original file line number Diff line number Diff line change
@@ -1,69 +1,32 @@
[config]
skip_core_tasks = true

[tasks.default]
alias = "help"

[tasks.help]
script = [
'makers --list-all-steps',
]

[tasks.setup]
category = "Tools"
description = "Install and configure dependencies (WIP)"
script = [
"git config --local core.hooksPath .githooks",
]

[tasks.update]
category = "Tools"
script = [
"dprint config update --yes",
]

[tasks.format-check]
category = "Tools"
description = "Run formatters without changes"
script = [
"dprint check",
]
[tasks.lint]
command = './scripts/lint.bash'

[tasks.format-apply]
category = "Tools"
description = "Run formatters with changes"
script = [
"dprint fmt",
]

[tasks.typos-check]
category = "Tools"
description = "Run formatters without changes"
script = [
"typos",
]

[tasks.prevent-secret]
category = "Tools"
script = [
"gitleaks detect",
]
[tasks.fmt]
command = './scripts/fmt.bash'

[tasks.check]
category = "Tools"
description = 'Parallel runner for all tests and linters'
run_task = { name = ["typos-check", "format-check", "prevent-secret"] }

[tasks.versions]
category = "Tools"
description = 'Print dependency versions'
script = [
"makers --version",
"dprint --version",
"shellcheck --version",
"shfmt --version",
# Returns NON 0, why...? :<
# "nixpkgs-fmt --version",
"gitleaks version",
"fd --version",
"typos --version",
]
alias = "lint"

[tasks.help]
category = "Tools"
description = 'Might help you - (This one)'
script = [
'makers --list-category-steps Tools',
]
[tasks.deps]
command = './scripts/print-deps.bash'
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# dotfiles

[![Linter Status](https://github.com/kachick/dotfiles/actions/workflows/lint.yml/badge.svg?branch=main)](https://github.com/kachick/dotfiles/actions/workflows/lint.yml?query=branch%3Amain+)
[![Development Environment Status](https://github.com/kachick/dotfiles/actions/workflows/ci-dev.yml/badge.svg?branch=main)](https://github.com/kachick/dotfiles/actions/workflows/ci-dev.yml?query=branch%3Amain+)
[![Nix Status](https://github.com/kachick/dotfiles/actions/workflows/ci-nix.yml/badge.svg?branch=main)](https://github.com/kachick/dotfiles/actions/workflows/ci-nix.yml?query=branch%3Amain+)

Personal dotfiles that can be placed in the public repository

Expand Down
10 changes: 10 additions & 0 deletions scripts/fmt.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

set -euxo pipefail

shopt -s globstar

# fixing typo is a fmt ...?
typos . .github .config .vscode --write-changes

dprint fmt
12 changes: 12 additions & 0 deletions scripts/lint.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

set -euxo pipefail

shopt -s globstar

dprint check
shfmt --diff ./**/*.bash
shellcheck ./**/*.bash
nixpkgs-fmt --check ./**/*.nix
typos . .github .config .vscode
gitleaks detect
17 changes: 17 additions & 0 deletions scripts/print-deps.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

set -euxo pipefail

shopt -s globstar

makers --version
nix --version
dprint --version
shellcheck --version
shfmt --version
gitleaks version
fd --version
typos --version

# Returns NON 0, why...? :<
# "nixpkgs-fmt --version",

0 comments on commit 0fb62ce

Please sign in to comment.