add pre-commit lint environment
authorWolf Vollprecht <w.vollprecht@gmail.com>
Sun, 9 Jan 2022 12:19:26 +0000 (13:19 +0100)
committerWolf Vollprecht <w.vollprecht@gmail.com>
Sun, 9 Jan 2022 12:37:38 +0000 (13:37 +0100)
.github/lint_environment.yml [new file with mode: 0644]
.github/workflows/linter.yml [new file with mode: 0644]
.pre-commit-config.yaml [new file with mode: 0644]

diff --git a/.github/lint_environment.yml b/.github/lint_environment.yml
new file mode 100644 (file)
index 0000000..7772b59
--- /dev/null
@@ -0,0 +1,7 @@
+name: lint
+channels:
+  - conda-forge
+dependencies:
+  - pre-commit
+  - pip
+  # - clang-format ==X.X
diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml
new file mode 100644 (file)
index 0000000..03acc62
--- /dev/null
@@ -0,0 +1,23 @@
+name: Run Linters
+
+on:
+  push:
+   branches:
+     - main
+  pull_request:
+    branches:
+     - main
+
+jobs:
+  build:
+    runs-on: ubuntu-latest
+    steps:
+    - uses: actions/checkout@v1
+    - name: install mamba
+      uses: mamba-org/provision-with-micromamba@v11
+      with:
+        environment-file: .github/lint_environment.yml
+    - name: Run all linters
+      shell: bash -l {0}
+      run: |
+        pre-commit run --all-files --verbose
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644 (file)
index 0000000..7773d25
--- /dev/null
@@ -0,0 +1,5 @@
+-   repo: https://github.com/pre-commit/pre-commit-hooks
+    rev: v4.1.0
+    hooks:
+    -   id: end-of-file-fixer
+        exclude: ^(test/files|autotest/)