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

Skip compliance and testing steps where possible on branches and tags #11513

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
221 changes: 141 additions & 80 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ workspace:
base: /go
path: src/code.gitea.io/gitea

trigger:
event:
- pull_request

steps:
- name: deps-frontend
pull: always
Expand Down Expand Up @@ -77,6 +81,109 @@ steps:
- go build -mod=vendor -o gitea_linux_386 # test if compatible with 32 bit
depends_on: [lint-backend]

---
kind: pipeline
name: testing-master

platform:
os: linux
arch: amd64

workspace:
base: /go
path: src/code.gitea.io/gitea

trigger:
branch:
- master
event:
- push

services:
- name: mysql
pull: default
image: mysql:5.7
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: test
GOPROXY: off
TAGS: bindata sqlite sqlite_unlock_notify
GITLAB_READ_TOKEN:
from_secret: gitlab_read_token
depends_on:
- build

- name: ldap
pull: default
image: gitea/test-openldap:latest

- name: elasticsearch
pull: default
environment:
discovery.type: single-node
image: elasticsearch:7.5.0

steps:
- name: build
pull: always
image: golang:1.14
commands:
- make 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: unit-test
pull: always
image: golang:1.14
commands:
- make unit-test-coverage test-check
environment:
GOPROXY: off
TAGS: bindata sqlite sqlite_unlock_notify
GITHUB_READ_TOKEN:
from_secret: github_read_token

- name: test-mysql
pull: always
image: golang:1.14
commands:
- "curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash"
- apt-get install -y git-lfs
- make test-mysql-migration integration-test-coverage
environment:
GOPROXY: off
TAGS: bindata
TEST_LDAP: 1
USE_REPO_TEST_DIR: 1
depends_on:
- build

- name: generate-coverage
pull: always
image: golang:1.14
commands:
- make coverage
environment:
GOPROXY: off
TAGS: bindata
depends_on:
- unit-test
- test-mysql

- name: coverage
pull: always
image: robertstettner/drone-codecov
settings:
files:
- coverage.all
environment:
CODECOV_TOKEN:
from_secret: codecov_token
depends_on:
- generate-coverage

---
kind: pipeline
name: testing-amd64
Expand All @@ -92,6 +199,10 @@ workspace:
base: /go
path: src/code.gitea.io/gitea

trigger:
lafriks marked this conversation as resolved.
Show resolved Hide resolved
event:
- pull_request

services:
- name: mysql
pull: default
Expand All @@ -105,12 +216,6 @@ services:
from_secret: gitlab_read_token
depends_on:
- build
when:
branch:
- master
event:
- push
- pull_request

- name: mysql8
pull: default
Expand Down Expand Up @@ -138,16 +243,6 @@ services:
image: elasticsearch:7.5.0

steps:
- name: fetch-tags
pull: default
image: docker:git
commands:
- git fetch --tags --force
when:
event:
exclude:
- pull_request

- name: build
pull: always
image: golang:1.14
Expand All @@ -158,12 +253,6 @@ steps:
GOSUMDB: sum.golang.org
TAGS: bindata sqlite sqlite_unlock_notify

- name: tag-pre-condition
pull: always
image: alpine/git
commands:
- git update-ref refs/heads/tag_test ${DRONE_COMMIT_SHA}

- name: unit-test
pull: always
image: golang:1.14
Expand Down Expand Up @@ -231,12 +320,6 @@ steps:
depends_on:
- unit-test
- test-mysql
when:
branch:
- master
event:
- push
- pull_request

- name: coverage
pull: always
Expand All @@ -249,12 +332,6 @@ steps:
from_secret: codecov_token
depends_on:
- generate-coverage
when:
branch:
- master
event:
- push
- pull_request

---
kind: pipeline
Expand All @@ -271,6 +348,10 @@ workspace:
base: /go
path: src/code.gitea.io/gitea

trigger:
event:
- pull_request

services:
- name: pgsql
pull: default
Expand All @@ -284,16 +365,6 @@ services:
image: gitea/test-openldap:latest

steps:
- name: fetch-tags
pull: default
image: docker:git
commands:
- git fetch --tags --force
when:
event:
exclude:
- pull_request

- name: build
pull: always
image: golang:1.14
Expand Down Expand Up @@ -415,8 +486,7 @@ trigger:
- push

depends_on:
- testing-amd64
- testing-arm64
- testing-master
- translations

steps:
Expand Down Expand Up @@ -513,10 +583,6 @@ trigger:
event:
- tag

depends_on:
- testing-arm64
- testing-amd64

steps:
- name: fetch-tags
pull: default
Expand Down Expand Up @@ -625,14 +691,13 @@ workspace:
base: /go
path: src/code.gitea.io/gitea

depends_on:
- testing-amd64
- testing-arm64

trigger:
ref:
- refs/heads/master
- "refs/tags/**"
- refs/heads/master
- "refs/tags/**"
event:
exclude:
- pull_request

steps:
- name: fetch-tags
Expand All @@ -654,10 +719,6 @@ steps:
from_secret: docker_password
username:
from_secret: docker_username
when:
event:
exclude:
- pull_request

---
kind: pipeline
Expand All @@ -675,8 +736,8 @@ depends_on:
- compliance

trigger:
ref:
- "refs/pull/**"
event:
- pull_request

steps:
- name: dryrun
Expand All @@ -688,9 +749,6 @@ steps:
tags: linux-arm64
build_args:
- GOPROXY=off
when:
event:
- pull_request

---
kind: pipeline
Expand All @@ -710,8 +768,12 @@ depends_on:

trigger:
ref:
- refs/heads/master
- "refs/tags/**"
- refs/heads/master
- "refs/tags/**"
event:
exclude:
- pull_request

steps:
- name: fetch-tags
pull: default
Expand All @@ -732,10 +794,6 @@ steps:
from_secret: docker_password
username:
from_secret: docker_username
when:
event:
exclude:
- pull_request

---
kind: pipeline
Expand All @@ -745,6 +803,18 @@ platform:
os: linux
arch: amd64

trigger:
ref:
- refs/heads/master
- "refs/tags/**"
event:
exclude:
- pull_request

depends_on:
- docker-linux-amd64-release
- docker-linux-arm64-release

steps:
- name: manifest
pull: always
Expand All @@ -758,15 +828,6 @@ steps:
username:
from_secret: docker_username

trigger:
ref:
- refs/heads/master
- "refs/tags/**"

depends_on:
- docker-linux-amd64-release
- docker-linux-arm64-release

---
kind: pipeline
name: notifications
Expand Down