- Added 'lint', 'lint-frontend', 'lint-backend' targets - Added 'lint-frontend', 'lint-backend' ci steps and restructure the 'compliance' pipeline to have a clear separation between frontend and backend and use parallelism where possible. Also, the main build pipelines now depend on 'compliance' so they will skip if it fails. - Added dependencies on ci steps so they skip when 'compliance' fails - Moved JS linters to devDependencies - Removed deprecated 'js' and 'css' targetstags/v1.21.12.1
| @@ -11,13 +11,37 @@ workspace: | |||
| path: src/code.gitea.io/gitea | |||
| steps: | |||
| - name: pre-build | |||
| - name: deps-frontend | |||
| pull: always | |||
| image: node:12 | |||
| commands: | |||
| - make node_modules | |||
| - name: lint-frontend | |||
| pull: always | |||
| image: node:12 | |||
| commands: | |||
| - make lint-frontend | |||
| depends_on: [deps-frontend] | |||
| - name: lint-backend | |||
| pull: always | |||
| image: golang:1.14 | |||
| commands: | |||
| - make lint-backend | |||
| environment: | |||
| GOPROXY: https://goproxy.cn # proxy.golang.org is blocked in China, this proxy is not | |||
| GOSUMDB: sum.golang.org | |||
| TAGS: bindata sqlite sqlite_unlock_notify | |||
| - name: build-frontend | |||
| pull: always | |||
| image: node:10 # this step is kept at the lowest version of node that we support | |||
| commands: | |||
| - make webpack | |||
| - make frontend | |||
| depends_on: [lint-frontend] | |||
| - name: build-without-gcc | |||
| - name: build-backend-no-gcc | |||
| pull: always | |||
| image: golang:1.12 # this step is kept as the lowest version of golang that we support | |||
| environment: | |||
| @@ -25,8 +49,9 @@ steps: | |||
| GOPROXY: off | |||
| commands: | |||
| - go build -mod=vendor -o gitea_no_gcc # test if build succeeds without the sqlite tag | |||
| depends_on: [lint-backend] | |||
| - name: build-linux-386 | |||
| - name: build-backend-386 | |||
| pull: always | |||
| image: golang:1.14 | |||
| environment: | |||
| @@ -36,16 +61,7 @@ steps: | |||
| GOARCH: 386 | |||
| commands: | |||
| - go build -mod=vendor -o gitea_linux_386 # test if compatible with 32 bit | |||
| - name: check | |||
| pull: always | |||
| image: golang:1.14 | |||
| commands: | |||
| - make clean golangci-lint revive swagger-check swagger-validate test-vendor | |||
| environment: | |||
| GOPROXY: https://goproxy.cn # proxy.golang.org is blocked in China, this proxy is not | |||
| GOSUMDB: sum.golang.org | |||
| TAGS: bindata sqlite sqlite_unlock_notify | |||
| depends_on: [lint-backend] | |||
| --- | |||
| kind: pipeline | |||
| @@ -55,6 +71,9 @@ platform: | |||
| os: linux | |||
| arch: amd64 | |||
| depends_on: | |||
| - compliance | |||
| workspace: | |||
| base: /go | |||
| path: src/code.gitea.io/gitea | |||
| @@ -209,8 +228,6 @@ steps: | |||
| - push | |||
| - pull_request | |||
| --- | |||
| kind: pipeline | |||
| name: testing-arm64 | |||
| @@ -219,6 +236,9 @@ platform: | |||
| os: linux | |||
| arch: arm64 | |||
| depends_on: | |||
| - compliance | |||
| workspace: | |||
| base: /go | |||
| path: src/code.gitea.io/gitea | |||
| @@ -537,6 +557,9 @@ platform: | |||
| os: linux | |||
| arch: arm64 | |||
| depends_on: | |||
| - compliance | |||
| steps: | |||
| - name: build-docs | |||
| pull: always | |||
| @@ -69,7 +69,7 @@ LDFLAGS := $(LDFLAGS) -X "main.MakeVersion=$(MAKE_VERSION)" -X "main.Version=$(G | |||
| GO_PACKAGES ?= $(filter-out code.gitea.io/gitea/integrations/migration-test,$(filter-out code.gitea.io/gitea/integrations,$(shell GO111MODULE=on $(GO) list -mod=vendor ./... | grep -v /vendor/))) | |||
| WEBPACK_SOURCES := $(shell find web_src/js web_src/less -type f) | |||
| WEBPACK_CONFIGS := webpack.config.js .eslintrc .stylelintrc | |||
| WEBPACK_CONFIGS := webpack.config.js | |||
| WEBPACK_DEST := public/js/index.js public/css/index.css | |||
| WEBPACK_DEST_DIRS := public/js public/css | |||
| @@ -133,14 +133,18 @@ help: | |||
| @echo " - backend build backend files" | |||
| @echo " - clean delete backend and integration files" | |||
| @echo " - clean-all delete backend, frontend and integration files" | |||
| @echo " - lint lint everything" | |||
| @echo " - lint-frontend lint frontend files" | |||
| @echo " - lint-backend lint backend files" | |||
| @echo " - webpack build webpack files" | |||
| @echo " - fomantic build fomantic files" | |||
| @echo " - generate run \"go generate\"" | |||
| @echo " - fmt format the Go code" | |||
| @echo " - generate-swagger generate the swagger spec from code comments" | |||
| @echo " - swagger-validate check if the swagger spec is valid" | |||
| @echo " - revive run code linter revive" | |||
| @echo " - misspell check if a word is written wrong" | |||
| @echo " - golangci-lint run golangci-lint linter" | |||
| @echo " - revive run revive linter" | |||
| @echo " - misspell check for misspellings" | |||
| @echo " - vet examines Go source code and reports suspicious constructs" | |||
| @echo " - test run unit test" | |||
| @echo " - test-sqlite run integration test for sqlite" | |||
| @@ -259,6 +263,17 @@ fmt-check: | |||
| exit 1; \ | |||
| fi; | |||
| .PHONY: lint | |||
| lint: lint-backend lint-frontend | |||
| .PHONY: lint-backend | |||
| lint-backend: golangci-lint revive swagger-check swagger-validate test-vendor | |||
| .PHONY: lint-frontend | |||
| lint-frontend: node_modules | |||
| npx eslint web_src/js webpack.config.js | |||
| npx stylelint web_src/less | |||
| .PHONY: test | |||
| test: | |||
| GO111MODULE=on $(GO) test $(GOTESTFLAGS) -mod=vendor -tags='sqlite sqlite_unlock_notify' $(GO_PACKAGES) | |||
| @@ -540,16 +555,6 @@ npm-update: node-check | node_modules | |||
| rm -rf node_modules package-lock.json | |||
| npm install --package-lock | |||
| .PHONY: js | |||
| js: | |||
| @echo "'make js' is deprecated, please use 'make webpack'" | |||
| $(MAKE) webpack | |||
| .PHONY: css | |||
| css: | |||
| @echo "'make css' is deprecated, please use 'make webpack'" | |||
| $(MAKE) webpack | |||
| .PHONY: fomantic | |||
| fomantic: $(FOMANTIC_DEST) | |||
| @@ -564,8 +569,6 @@ $(FOMANTIC_DEST): $(FOMANTIC_CONFIGS) package-lock.json | node_modules | |||
| webpack: $(WEBPACK_DEST) | |||
| $(WEBPACK_DEST): $(WEBPACK_SOURCES) $(WEBPACK_CONFIGS) package-lock.json | node_modules | |||
| npx eslint web_src/js webpack.config.js | |||
| npx stylelint web_src/less | |||
| npx webpack --hide-modules --display-entrypoints=false | |||
| @touch $(WEBPACK_DEST) | |||
| @@ -18,9 +18,6 @@ | |||
| "css-loader": "3.4.2", | |||
| "cssnano": "4.1.10", | |||
| "dropzone": "5.7.0", | |||
| "eslint": "6.8.0", | |||
| "eslint-config-airbnb-base": "14.1.0", | |||
| "eslint-plugin-import": "2.20.1", | |||
| "fast-glob": "3.2.2", | |||
| "fomantic-ui": "2.8.4", | |||
| "highlight.js": "9.18.1", | |||
| @@ -35,8 +32,6 @@ | |||
| "postcss-loader": "3.0.0", | |||
| "postcss-preset-env": "6.7.0", | |||
| "postcss-safe-parser": "4.0.2", | |||
| "stylelint": "13.2.1", | |||
| "stylelint-config-standard": "20.0.0", | |||
| "svg-sprite-loader": "4.2.1", | |||
| "svgo": "1.3.2", | |||
| "svgo-loader": "2.2.1", | |||
| @@ -52,6 +47,11 @@ | |||
| "webpack-fix-style-only-entries": "0.4.0" | |||
| }, | |||
| "devDependencies": { | |||
| "eslint": "6.8.0", | |||
| "eslint-config-airbnb-base": "14.1.0", | |||
| "eslint-plugin-import": "2.20.1", | |||
| "stylelint": "13.2.1", | |||
| "stylelint-config-standard": "20.0.0", | |||
| "updates": "10.2.4" | |||
| }, | |||
| "browserslist": [ | |||