Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement treefmt, generate pre-commit hooks with git-hooks.nix, fix typos, and auto-update nix-direnv #34

Merged
merged 11 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_size = 2
indent_style = space
max_line_length = 120
trim_trailing_whitespace = true

[*.adoc]
indent_size = unset

[*.{adoc,envrc,nu,html}]
max_line_length = off

[{justfile,.justfile,*.just}]
indent_size = 4
20 changes: 0 additions & 20 deletions .github/workflows/format-just.yaml

This file was deleted.

18 changes: 0 additions & 18 deletions .github/workflows/test-nushell.yaml

This file was deleted.

27 changes: 27 additions & 0 deletions .github/workflows/test-update-nix-direnv.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Test update-nix-direnv.nu
"on":
pull_request:
branches: ["main"]
paths:
- .github/workflows/test-update-nix-direnv.yaml
- flake.lock
- update-nix-direnv.nu
- update-nix-direnv-tests.nu
push:
branches: ["main"]
paths:
- .github/workflows/test-update-nix-direnv.yaml
- flake.lock
- update-nix-direnv.nu
- update-nix-direnv-tests.nu
workflow_dispatch:

jobs:
test-update-nix-direnv:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@v14
- uses: DeterminateSystems/magic-nix-cache-action@v8
- name: Run the Nushell tests
run: nix develop --command nu update-nix-direnv-tests.nu
27 changes: 27 additions & 0 deletions .github/workflows/test-update-nixos-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Test update-nixos-release.nu
"on":
pull_request:
branches: ["main"]
paths:
- .github/workflows/test-update-nixos-release.yaml
- flake.lock
- update-nixos-release.nu
- update-nixos-release-tests.nu
push:
branches: ["main"]
paths:
- .github/workflows/test-update-nixos-release.yaml
- flake.lock
- update-nixos-release.nu
- update-nixos-release-tests.nu
workflow_dispatch:

jobs:
test-update-nixos-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@v14
- uses: DeterminateSystems/magic-nix-cache-action@v8
- name: Run the Nushell tests
run: nix develop --command nu update-nixos-release-tests.nu
21 changes: 21 additions & 0 deletions .github/workflows/treefmt.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Check files with treefmt
"on":
pull_request:
branches: ["main"]
push:
branches: ["main"]

jobs:
treefmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@v14
- uses: DeterminateSystems/magic-nix-cache-action@v8
- name: Run treefmt
run: nix develop --command treefmt --fail-on-change --no-cache
- uses: reviewdog/action-suggester@v1
with:
fail_on_error: true
github_token: ${{ secrets.GH_TOKEN_FOR_UPDATES }}
tool_name: treefmt
Original file line number Diff line number Diff line change
@@ -1,31 +1,28 @@
name: Pre-commit auto-update
name: Update nix-direnv

"on":
schedule:
# Once a month on the 2nd
- cron: "0 0 2 * *"
- cron: "0 0 16 * *"
workflow_dispatch:

permissions:
contents: write
pull-requests: write

jobs:
pre-commit-autoupdate:
update-nix-direnv:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@v14
- uses: DeterminateSystems/magic-nix-cache-action@v8
- name: Update pre-commit hooks
run: nix develop --command pre-commit autoupdate
- name: Run pre-commit hooks
run: nix develop --command pre-commit run --all-files
- name: Update nix-direnv to the latest version
run: nix develop --command nu update-nix-direnv.nu
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
assignees: ${{ github.repository_owner }}
branch: "update/pre-commit-hooks"
commit-message: "chore(deps): Update pre-commit hooks"
title: "chore(deps): Update pre-commit hooks"
branch: "update/nix-direnv"
commit-message: "chore(deps): Update nix-direnv"
title: "chore(deps): Update nix-direnv"
token: ${{ secrets.GH_TOKEN_FOR_UPDATES }}
12 changes: 10 additions & 2 deletions .github/workflows/yamllint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,16 @@ name: yamllint
- .github/workflows/yamllint.yaml
- .yamllint.yaml
- flake.lock
- '**.yaml'
- '**.yml'
- "**.yaml"
- "**.yml"
push:
branches: ["main"]
paths:
- .github/workflows/yamllint.yaml
- .yamllint.yaml
- flake.lock
- "**.yaml"
- "**.yml"

jobs:
yamllint:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,6 @@ build-iPhoneSimulator/

# Nix
result

# git-hooks.nix
/.pre-commit-config.yaml
2 changes: 2 additions & 0 deletions .ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.jpg
*.png
5 changes: 3 additions & 2 deletions .justfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ alias f := format
alias fmt := format

format:
just --fmt --unstable
treefmt

alias l := lint

Expand All @@ -25,6 +25,7 @@ alias t := test

test:
nu update-nixos-release-tests.nu
nu update-nix-direnv-tests.nu

alias u := update
alias up := update
Expand All @@ -34,4 +35,4 @@ update: && build test
nix flake update
bundle update
bundix
pre-commit autoupdate
nu update-nix-direnv.nu
34 changes: 0 additions & 34 deletions .pre-commit-config.yaml

This file was deleted.

2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Ignore HTML documents since they use Liquid templating
**/*.html
11 changes: 11 additions & 0 deletions .typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[default]
extend-ignore-re = [
"sha256[[:space:]]*=[[:space:]]*\"[[:alnum:]]+\"",
"SHA256:[[:space:]]*[[a-zA-Z0-9+]]+[[:space:]]*",
]

[default.extend-identifiers]
96AFE6CB = "96AFE6CB"

[default.extend-words]
hda = "hda"
11 changes: 11 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"recommendations": [
"ibecker.treefmt-vscode",
"asciidoctor.asciidoctor-vscode",
"mkhl.direnv",
"bbenoist.nix",
"thenuprojectcontributors.vscode-nushell-lang",
"nefrob.vscode-just-syntax",
"tekumara.typos-vscode"
]
}
Loading
Loading