Add 'checks' Make and CI tasks (#12352)

* Add 'checks' Make and CI tasks

Introduce new "checks" targets that perform tasks that we've been piling
onto the linting tasks. This will make the linter tasks faster and
hopefully encourage some users to use them locally.

* add checks to --help

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
silverwind 2020-08-16 23:43:09 +02:00 committed by GitHub
parent d1e67d7ade
commit d285b5d35a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 36 additions and 10 deletions

View File

@ -34,6 +34,20 @@ steps:
GOSUMDB: sum.golang.org GOSUMDB: sum.golang.org
TAGS: bindata sqlite sqlite_unlock_notify TAGS: bindata sqlite sqlite_unlock_notify
- name: checks-frontend
pull: always
image: node:12
commands:
- make checks-frontend
depends_on: [deps-frontend]
- name: checks-backend
pull: always
image: golang:1.14
commands:
- make checks-backend
depends_on: [lint-backend]
- name: build-frontend - name: build-frontend
pull: always pull: always
image: node:10 # this step is kept at the lowest version of node that we support image: node:10 # this step is kept at the lowest version of node that we support
@ -49,7 +63,7 @@ steps:
GOPROXY: off GOPROXY: off
commands: commands:
- go build -mod=vendor -o gitea_no_gcc # test if build succeeds without the sqlite tag - go build -mod=vendor -o gitea_no_gcc # test if build succeeds without the sqlite tag
depends_on: [lint-backend] depends_on: [checks-backend]
- name: build-backend-arm64 - name: build-backend-arm64
pull: always pull: always
@ -63,7 +77,7 @@ steps:
commands: commands:
- make backend # test cross compile - make backend # test cross compile
- rm ./gitea # clean - rm ./gitea # clean
depends_on: [lint-backend] depends_on: [checks-backend]
- name: build-backend-386 - name: build-backend-386
pull: always pull: always
@ -75,7 +89,7 @@ steps:
GOARCH: 386 GOARCH: 386
commands: commands:
- go build -mod=vendor -o gitea_linux_386 # test if compatible with 32 bit - go build -mod=vendor -o gitea_linux_386 # test if compatible with 32 bit
depends_on: [lint-backend] depends_on: [checks-backend]
--- ---
kind: pipeline kind: pipeline

View File

@ -154,13 +154,16 @@ help:
@echo " - build build everything" @echo " - build build everything"
@echo " - frontend build frontend files" @echo " - frontend build frontend files"
@echo " - backend build backend files" @echo " - backend build backend files"
@echo " - watch-frontend watch frontend files and continuously rebuild"
@echo " - watch-backend watch backend files and continuously rebuild"
@echo " - clean delete backend and integration files" @echo " - clean delete backend and integration files"
@echo " - clean-all delete backend, frontend and integration files" @echo " - clean-all delete backend, frontend and integration files"
@echo " - lint lint everything" @echo " - lint lint everything"
@echo " - lint-frontend lint frontend files" @echo " - lint-frontend lint frontend files"
@echo " - lint-backend lint backend files" @echo " - lint-backend lint backend files"
@echo " - watch-frontend watch frontend files and continuously rebuild" @echo " - check run various consistency checks"
@echo " - watch-backend watch backend files and continuously rebuild" @echo " - check-frontend check frontend files"
@echo " - check-backend check backend files"
@echo " - webpack build webpack files" @echo " - webpack build webpack files"
@echo " - svg build svg files" @echo " - svg build svg files"
@echo " - fomantic build fomantic files" @echo " - fomantic build fomantic files"
@ -290,17 +293,26 @@ fmt-check:
exit 1; \ exit 1; \
fi; fi;
.PHONY: lint .PHONY: checks
lint: lint-backend lint-frontend checks: checks-frontend checks-backend
.PHONY: lint-backend .PHONY: checks-frontend
lint-backend: golangci-lint revive vet swagger-check swagger-validate test-vendor checks-frontend: svg-check
.PHONY: checks-backend
checks-backend: misspell-check test-vendor swagger-check swagger-validate
.PHONY: lint
lint: lint-frontend lint-backend
.PHONY: lint-frontend .PHONY: lint-frontend
lint-frontend: node_modules svg-check lint-frontend: node_modules
npx eslint web_src/js build webpack.config.js npx eslint web_src/js build webpack.config.js
npx stylelint web_src/less npx stylelint web_src/less
.PHONY: lint-backend
lint-backend: golangci-lint revive vet
.PHONY: watch-frontend .PHONY: watch-frontend
watch-frontend: node-check $(FOMANTIC_DEST) node_modules watch-frontend: node-check $(FOMANTIC_DEST) node_modules
rm -rf $(WEBPACK_DEST_ENTRIES) rm -rf $(WEBPACK_DEST_ENTRIES)