Merge pull request #432 from mautrix/pre-commit-config

pre-commit: add config and add lint job to CI
This commit is contained in:
Sumner Evans 2022-03-16 08:41:47 -06:00 committed by GitHub
commit 61409ce2bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 44 additions and 0 deletions

29
.github/workflows/go.yml vendored Normal file
View file

@ -0,0 +1,29 @@
name: Go
on: [push, pull_request]
jobs:
lint:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
go-version: [1.17]
steps:
- uses: actions/checkout@v2
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Install goimports
run: |
go install golang.org/x/tools/cmd/goimports@latest
export PATH="$HOME/go/bin:$PATH"
- name: Install pre-commit
run: pip install pre-commit
- name: Lint
run: pre-commit run -a

1
.gitignore vendored
View file

@ -1,6 +1,7 @@
.idea .idea
*.yaml *.yaml
!.pre-commit-config.yaml
!example-config.yaml !example-config.yaml
*.session *.session

14
.pre-commit-config.yaml Normal file
View file

@ -0,0 +1,14 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
hooks:
- id: trailing-whitespace
exclude_types: [markdown]
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/tekwizely/pre-commit-golang
rev: v1.0.0-beta.5
hooks:
- id: go-imports-repo