ci: add checking of pre-commit rules
This commit is contained in:
@@ -9,6 +9,25 @@ variables:
|
|||||||
|
|
||||||
image: buildtool/build-tools:${BUILDTOOLS_VERSION}
|
image: buildtool/build-tools:${BUILDTOOLS_VERSION}
|
||||||
|
|
||||||
|
run-pre-commit:
|
||||||
|
stage: .pre
|
||||||
|
image: golang:1.19
|
||||||
|
variables:
|
||||||
|
PRE_COMMIT_HOME: ${CI_PROJECT_DIR}/.cache/pre-commit
|
||||||
|
cache:
|
||||||
|
- key:
|
||||||
|
files:
|
||||||
|
- .pre-commit-config.yaml
|
||||||
|
paths:
|
||||||
|
- ${PRE_COMMIT_HOME}
|
||||||
|
before_script:
|
||||||
|
- apt update && apt install -y python3 python3-pip ruby git
|
||||||
|
- go install github.com/lietu/go-pre-commit@latest
|
||||||
|
- curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.49.0
|
||||||
|
- pip install pre-commit
|
||||||
|
script:
|
||||||
|
- pre-commit run --all-files
|
||||||
|
|
||||||
build:
|
build:
|
||||||
stage: build
|
stage: build
|
||||||
services:
|
services:
|
||||||
|
|||||||
@@ -12,10 +12,6 @@ repos:
|
|||||||
rev: 3.0.0
|
rev: 3.0.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: markdownlint
|
- id: markdownlint
|
||||||
- repo: https://github.com/golangci/golangci-lint
|
|
||||||
rev: v1.49.0
|
|
||||||
hooks:
|
|
||||||
- id: golangci-lint
|
|
||||||
- repo: https://gitlab.com/devopshq/gitlab-ci-linter
|
- repo: https://gitlab.com/devopshq/gitlab-ci-linter
|
||||||
rev: v1.0.3
|
rev: v1.0.3
|
||||||
hooks:
|
hooks:
|
||||||
@@ -33,5 +29,6 @@ repos:
|
|||||||
- id: go-fmt-goimports
|
- id: go-fmt-goimports
|
||||||
- id: go-test
|
- id: go-test
|
||||||
- id: go-vet
|
- id: go-vet
|
||||||
|
- id: golangci-lint
|
||||||
- id: gofumpt
|
- id: gofumpt
|
||||||
- id: staticcheck
|
- id: staticcheck
|
||||||
|
|||||||
Reference in New Issue
Block a user