Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce CI go module downloads, add make targets #18708

Merged
merged 13 commits into from
Feb 12, 2022
173 changes: 145 additions & 28 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,25 @@ trigger:
- tag
- pull_request

volumes:
- name: deps
temp: {}

steps:
- name: deps-frontend
pull: always
image: node:16
commands:
- make node_modules
- make deps-frontend

- name: deps-backend
pull: always
image: golang:1.17
commands:
- make deps-backend
volumes:
- name: deps
path: /go

- name: lint-frontend
image: node:16
Expand All @@ -27,17 +40,16 @@ steps:
depends_on: [deps-frontend]

- name: lint-backend
pull: always
silverwind marked this conversation as resolved.
Show resolved Hide resolved
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
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
depends_on: [deps-backend]

- name: lint-backend-windows
pull: always
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
commands:
- make golangci-lint vet
Expand All @@ -47,16 +59,17 @@ steps:
TAGS: bindata sqlite sqlite_unlock_notify
GOOS: windows
GOARCH: amd64
depends_on: [deps-backend]

- name: lint-backend-gogit
pull: always
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
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 gogit sqlite sqlite_unlock_notify
depends_on: [deps-backend]

- name: checks-frontend
image: node:16
Expand All @@ -69,7 +82,10 @@ steps:
image: golang:1.17
commands:
- make checks-backend
depends_on: [lint-backend]
depends_on: [deps-backend]
volumes:
- name: deps
path: /go

- name: test-frontend
image: node:16
Expand All @@ -91,7 +107,10 @@ steps:
GOPROXY: https://goproxy.cn
commands:
- go build -o gitea_no_gcc # test if build succeeds without the sqlite tag
depends_on: [checks-backend]
depends_on: [deps-backend, checks-backend]
volumes:
- name: deps
path: /go

- name: build-backend-arm64
image: golang:1.17
Expand All @@ -104,7 +123,10 @@ steps:
commands:
- make backend # test cross compile
- rm ./gitea # clean
depends_on: [checks-backend]
depends_on: [deps-backend, checks-backend]
volumes:
- name: deps
path: /go

- name: build-backend-windows
image: golang:1.17
Expand All @@ -116,7 +138,10 @@ steps:
TAGS: bindata gogit
commands:
- go build -o gitea_windows
depends_on: [checks-backend]
depends_on: [deps-backend, checks-backend]
volumes:
- name: deps
path: /go

- name: build-backend-386
image: golang:1.17
Expand All @@ -127,7 +152,10 @@ steps:
GOARCH: 386
commands:
- go build -o gitea_linux_386 # test if compatible with 32 bit
depends_on: [checks-backend]
depends_on: [deps-backend, checks-backend]
volumes:
- name: deps
path: /go

---
kind: pipeline
Expand All @@ -147,6 +175,10 @@ trigger:
- tag
- pull_request

volumes:
- name: deps
temp: {}

services:
- name: mysql
image: mysql:5.7
Expand Down Expand Up @@ -193,6 +225,15 @@ steps:
exclude:
- pull_request

- name: deps-backend
pull: always
image: golang:1.17
commands:
- make deps-backend
volumes:
- name: deps
path: /go

- name: tag-pre-condition
pull: always
image: drone/git
Expand All @@ -215,8 +256,10 @@ steps:
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:
- prepare-test-env
depends_on: [deps-backend, prepare-test-env]
volumes:
- name: deps
path: /go

- name: unit-test
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
Expand All @@ -229,6 +272,10 @@ steps:
RACE_ENABLED: true
GITHUB_READ_TOKEN:
from_secret: github_read_token
depends_on: [deps-backend, prepare-test-env]
volumes:
- name: deps
path: /go

- name: unit-test-gogit
pull: always
Expand All @@ -242,6 +289,10 @@ steps:
RACE_ENABLED: true
GITHUB_READ_TOKEN:
from_secret: github_read_token
depends_on: [deps-backend, prepare-test-env]
volumes:
- name: deps
path: /go

- name: test-mysql
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
Expand All @@ -255,8 +306,10 @@ steps:
TEST_LDAP: 1
USE_REPO_TEST_DIR: 1
TEST_INDEXER_CODE_ES_URL: "http://elastic:changeme@elasticsearch:9200"
depends_on:
- build
depends_on: [build]
volumes:
- name: deps
path: /go

- name: test-mysql8
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
Expand All @@ -269,8 +322,10 @@ steps:
RACE_ENABLED: true
TEST_LDAP: 1
USE_REPO_TEST_DIR: 1
depends_on:
- build
depends_on: [build]
volumes:
- name: deps
path: /go

- name: test-mssql
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
Expand All @@ -283,8 +338,10 @@ steps:
RACE_ENABLED: true
TEST_LDAP: 1
USE_REPO_TEST_DIR: 1
depends_on:
- build
depends_on: [build]
volumes:
- name: deps
path: /go

- name: generate-coverage
image: golang:1.17
Expand All @@ -293,9 +350,7 @@ steps:
environment:
GOPROXY: https://goproxy.cn
TAGS: bindata
depends_on:
- unit-test
- test-mysql
depends_on: [unit-test, test-mysql]
when:
branch:
- main
Expand All @@ -311,8 +366,7 @@ steps:
- coverage.all
token:
from_secret: codecov_token
depends_on:
- generate-coverage
depends_on: [generate-coverage]
when:
branch:
- main
Expand All @@ -337,6 +391,10 @@ trigger:
- tag
- pull_request

volumes:
- name: deps
temp: {}

services:
- name: pgsql
pull: default
Expand All @@ -359,6 +417,15 @@ steps:
exclude:
- pull_request

- name: deps-backend
pull: always
image: golang:1.17
commands:
- make deps-backend
volumes:
- name: deps
path: /go

- name: prepare-test-env
image: gitea/test_env:linux-arm64 # https://gitea.com/gitea/test-env
commands:
Expand All @@ -375,8 +442,10 @@ steps:
GOPROXY: https://goproxy.cn # proxy.golang.org is blocked in China, this proxy is not
GOSUMDB: sum.golang.org
TAGS: bindata gogit sqlite sqlite_unlock_notify
depends_on:
- prepare-test-env
depends_on: [deps-backend, prepare-test-env]
volumes:
- name: deps
path: /go

- name: test-sqlite
image: gitea/test_env:linux-arm64 # https://gitea.com/gitea/test-env
Expand All @@ -389,8 +458,10 @@ steps:
RACE_ENABLED: true
TEST_TAGS: gogit sqlite sqlite_unlock_notify
USE_REPO_TEST_DIR: 1
depends_on:
- build
depends_on: [build]
volumes:
- name: deps
path: /go

- name: test-pgsql
image: gitea/test_env:linux-arm64 # https://gitea.com/gitea/test-env
Expand All @@ -404,8 +475,10 @@ steps:
TEST_TAGS: gogit
TEST_LDAP: 1
USE_REPO_TEST_DIR: 1
depends_on:
- build
depends_on: [build]
volumes:
- name: deps
path: /go

---
kind: pipeline
Expand Down Expand Up @@ -529,12 +602,31 @@ depends_on:
- testing-amd64
- testing-arm64

volumes:
- name: deps
temp: {}

steps:
- name: fetch-tags
image: docker:git
commands:
- git fetch --tags --force

- name: deps-frontend
pull: always
image: node:16
commands:
- make deps-frontend

- name: deps-backend
pull: always
image: golang:1.17
commands:
- make deps-backend
volumes:
- name: deps
path: /go

- name: static
pull: always
image: techknowlogick/xgo:go-1.17.x
Expand All @@ -545,6 +637,9 @@ steps:
environment:
GOPROXY: https://goproxy.cn # proxy.golang.org is blocked in China, this proxy is not
TAGS: bindata sqlite sqlite_unlock_notify
volumes:
- name: deps
path: /go

- name: gpg-sign
pull: always
Expand Down Expand Up @@ -624,13 +719,32 @@ depends_on:
- testing-arm64
- testing-amd64

volumes:
- name: deps
temp: {}

steps:
- name: fetch-tags
pull: default
image: docker:git
commands:
- git fetch --tags --force

- name: deps-frontend
pull: always
image: node:16
commands:
- make deps-frontend

- name: deps-backend
pull: always
image: golang:1.17
commands:
- make deps-backend
volumes:
- name: deps
path: /go

- name: static
pull: always
image: techknowlogick/xgo:go-1.17.x
Expand All @@ -642,6 +756,9 @@ steps:
GOPROXY: https://goproxy.cn # proxy.golang.org is blocked in China, this proxy is not
TAGS: bindata sqlite sqlite_unlock_notify
depends_on: [fetch-tags]
volumes:
- name: deps
path: /go

- name: gpg-sign
pull: always
Expand Down
Loading