-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Include editorconfig in pre-commit and support CI (#28)
Editorconfig can as well run in pre-commit and we should use the same tools and checks for CI lint afterwards. Bootstrap command can enable this now.
- Loading branch information
Showing
4 changed files
with
52 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# This files was added by a devbox script from our devops tools project and is maintained there: | ||
# https://github.com/onlinecity/devops-tools | ||
# The file is added by bootstrap-editorconfig and bootstrap-pre-commit scripts | ||
# and supports conditionally both features. | ||
--- | ||
name: CI | ||
|
||
on: | ||
push: | ||
|
||
jobs: | ||
|
||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install devbox | ||
uses: jetify-com/[email protected] | ||
with: | ||
enable-cache: "true" | ||
|
||
- name: ensure pre-commit verifications | ||
# we're not in an initialized devbox shell so need to run commands with devbox run -- | ||
# Notice also with -a to pre-commit we run all files, not only changed ones as this is a CI check | ||
run: if [ -f .pre-commit-config.yaml ]; then devbox run -- pre-commit run -a; fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,13 @@ | |
// for merging ini, ssh and lines, see https://github.com/pixelb/crudini | ||
// added to merge ansible.cfg files | ||
"[email protected]", | ||
"[email protected]" | ||
"[email protected]", | ||
// Use with ci or cmd line to check files honor .editorconfig | ||
// Multiple checkers are available, but the chosen one below seems to be the only mature and maintained one | ||
// from this FAQ list: https://github.com/editorconfig/editorconfig/wiki/FAQ#are-there-any-tools-to-check-orand-reformat-existing-files-against-editorconfig-rules | ||
// https://github.com/editorconfig-checker/editorconfig-checker | ||
// Megalinter supports editorconfig, but couldn't find Nix package for megalinter: https://github.com/editorconfig-checker/editorconfig-checker?tab=readme-ov-file#mega-linter | ||
"[email protected]" | ||
], | ||
"env": { | ||
// Remote taskfiles are an experimental feature in Taskfile, so it is enabled by setting a feature flag as an environment | ||
|
@@ -48,6 +54,7 @@ | |
"{{ .Virtenv }}/.yamllint": "config/.yamllint", | ||
"{{ .Virtenv }}/taskfile.yml": "config/taskfile.yml", | ||
"{{ .Virtenv }}/.editorconfig": "config/.editorconfig", | ||
"{{ .Virtenv }}/ci-lint.yml": "config/ci-lint.yml", | ||
"{{ .Virtenv }}/release-please.yml": "config/release-please.yml", | ||
"{{ .Virtenv }}/dependabot-gitsubmodules.yml": "config/dependabot-gitsubmodules.yml", | ||
"{{ .Virtenv }}/ansible.cfg": "config/ansible.cfg", | ||
|
@@ -105,10 +112,11 @@ | |
"cp {{ .Virtenv }}/.yamllint .yamllint", | ||
"echo 'Bootstrapping done'" | ||
], | ||
"bootstrap-editorconfig": [ | ||
"echo 'Bootstrapping editorconfig'", | ||
"cp {{ .Virtenv }}/.editorconfig .editorconfig", | ||
"echo 'Bootstrapping editorconfig done'" | ||
"bootstrap-ci-lint": [ | ||
"echo 'Bootstrapping CI lint actions'", | ||
"mkdir -p .github/workflows", | ||
"cp {{ .Virtenv }}/ci-lint.yml .github/workflows/ci-lint.yml", | ||
"echo 'Bootstrapping CI lint actions done'" | ||
], | ||
"bootstrap-taskfile": [ | ||
"echo 'Bootstrapping taskfile'", | ||
|