From 7819a84853ea4ab97c0ef216380db231e4c36770 Mon Sep 17 00:00:00 2001 From: Antoine GIRARD Date: Sun, 12 Jan 2020 05:39:54 +0100 Subject: [PATCH] ci: try re-ordering for optimizing time --- .drone.yml | 315 +++++++++++++++++++++++++++++------------------------ 1 file changed, 173 insertions(+), 142 deletions(-) diff --git a/.drone.yml b/.drone.yml index 7a844af8eb..dc47f8dd5d 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,3 +1,96 @@ +--- +kind: pipeline +name: init + +platform: + os: linux + arch: amd64 + +workspace: + base: /go + path: src/code.gitea.io/gitea + +steps: + - name: fetch-tags + pull: default + image: docker:git + commands: + - git fetch --tags --force + when: + event: + exclude: + - pull_request + + - name: tag-pre-condition + pull: always + image: alpine/git + commands: + - git update-ref refs/heads/tag_test ${DRONE_COMMIT_SHA} + when: + event: + - tag +--- +kind: pipeline +name: build + +platform: + os: linux + arch: amd64 + +workspace: + base: /go + path: src/code.gitea.io/gitea + +depends_on: + - init + +steps: + - name: pre-build + pull: always + image: node:10 # this step is kept at the lowest version of node that we support + commands: + - make css + - make js + + - name: build-without-gcc + pull: always + image: golang:1.11 # this step is kept as the lowest version of golang that we support + environment: + GO111MODULE: on + GOPROXY: off + commands: + - curl -sL https://deb.nodesource.com/setup_12.x | bash - && apt -y install nodejs + - go build -mod=vendor -o gitea_no_gcc # test if build succeeds without the sqlite tag + + - name: build-linux-386 + pull: always + image: golang:1.13 + environment: + GO111MODULE: on + GOPROXY: off + GOOS: linux + GOARCH: 386 + commands: + - curl -sL https://deb.nodesource.com/setup_12.x | bash - && apt -y install nodejs + - go build -mod=vendor -o gitea_linux_386 # test if compatible with 32 bit + + - name: generate-build + pull: always + image: golang:1.13 + commands: + - curl -sL https://deb.nodesource.com/setup_12.x | bash - && apt -y install nodejs + - make clean + - make golangci-lint + - make revive + - make swagger-check + - make swagger-validate + - make test-vendor + - make build + 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 + --- kind: pipeline name: testing @@ -10,6 +103,9 @@ workspace: base: /go path: src/code.gitea.io/gitea +depends_on: + - init + services: - name: mysql pull: default @@ -44,62 +140,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: pre-build - pull: always - image: node:10 # this step is kept at the lowest version of node that we support - commands: - - make css - - make js - - - name: build-without-gcc - pull: always - image: golang:1.11 # this step is kept as the lowest version of golang that we support - environment: - GO111MODULE: on - GOPROXY: off - commands: - - curl -sL https://deb.nodesource.com/setup_12.x | bash - && apt -y install nodejs - - go build -mod=vendor -o gitea_no_gcc # test if build succeeds without the sqlite tag - - - name: build-linux-386 - pull: always - image: golang:1.13 - environment: - GO111MODULE: on - GOPROXY: off - GOOS: linux - GOARCH: 386 - commands: - - curl -sL https://deb.nodesource.com/setup_12.x | bash - && apt -y install nodejs - - go build -mod=vendor -o gitea_linux_386 # test if compatible with 32 bit - - - name: build - pull: always - image: golang:1.13 - commands: - - curl -sL https://deb.nodesource.com/setup_12.x | bash - && apt -y install nodejs - - make clean - - make golangci-lint - - make revive - - make swagger-check - - make swagger-validate - - make test-vendor - - make build - 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.13 @@ -108,8 +148,6 @@ steps: environment: GOPROXY: off TAGS: bindata sqlite sqlite_unlock_notify - depends_on: - - build when: branch: - master @@ -125,8 +163,6 @@ steps: environment: GOPROXY: off TAGS: bindata sqlite sqlite_unlock_notify - depends_on: - - build when: branch: - "release/*" @@ -134,17 +170,6 @@ steps: - push - pull_request - - name: tag-pre-condition - pull: always - image: alpine/git - commands: - - git update-ref refs/heads/tag_test ${DRONE_COMMIT_SHA} - depends_on: - - build - when: - event: - - tag - - name: tag-test pull: always image: golang:1.13 @@ -153,8 +178,6 @@ steps: environment: GOPROXY: off TAGS: bindata - depends_on: - - tag-pre-condition when: event: - tag @@ -170,8 +193,6 @@ steps: environment: GOPROXY: off TAGS: bindata - depends_on: - - build - name: test-mysql pull: always @@ -185,8 +206,6 @@ steps: GOPROXY: off TAGS: bindata TEST_LDAP: 1 - depends_on: - - build when: branch: - master @@ -206,8 +225,6 @@ steps: GOPROXY: off TAGS: bindata TEST_LDAP: 1 - depends_on: - - build when: event: - tag @@ -224,8 +241,6 @@ steps: GOPROXY: off TAGS: bindata TEST_LDAP: 1 - depends_on: - - build - name: test-pgsql pull: always @@ -239,8 +254,6 @@ steps: GOPROXY: off TAGS: bindata TEST_LDAP: 1 - depends_on: - - build - name: test-mssql pull: always @@ -254,8 +267,6 @@ steps: GOPROXY: off TAGS: bindata TEST_LDAP: 1 - depends_on: - - build - name: generate-coverage pull: always @@ -292,7 +303,7 @@ steps: event: - push - pull_request - + --- kind: pipeline name: translations @@ -311,6 +322,9 @@ trigger: event: - push +depends_on: + - init + steps: - name: download pull: always @@ -476,7 +490,7 @@ trigger: - tag depends_on: - - testing + - build steps: - name: fetch-tags @@ -578,7 +592,40 @@ steps: --- kind: pipeline -name: docker-linux-amd64 +name: docker-linux-amd64-dry-run + +platform: + os: linux + arch: amd64 + +workspace: + base: /go + path: src/code.gitea.io/gitea + +depends_on: + - build + +trigger: + ref: + - "refs/pull/**" + +steps: + - name: dryrun + pull: always + image: plugins/docker:linux-amd64 + settings: + dry_run: true + repo: gitea/gitea + tags: linux-amd64 + build_args: + - GOPROXY=off + when: + event: + - pull_request + +--- +kind: pipeline +name: docker-linux-amd64-release platform: os: linux @@ -595,32 +642,8 @@ trigger: ref: - refs/heads/master - "refs/tags/**" - - "refs/pull/**" steps: - - name: fetch-tags - pull: default - image: docker:git - commands: - - git fetch --tags --force - when: - event: - exclude: - - pull_request - - - name: dryrun - pull: always - image: plugins/docker:linux-amd64 - settings: - dry_run: true - repo: gitea/gitea - tags: linux-amd64 - build_args: - - GOPROXY=off - when: - event: - - pull_request - - name: publish pull: always image: plugins/docker:linux-amd64 @@ -641,7 +664,40 @@ steps: --- kind: pipeline -name: docker-linux-arm64 +name: docker-linux-arm64-dry-run + +platform: + os: linux + arch: arm64 + +workspace: + base: /go + path: src/code.gitea.io/gitea + +depends_on: + - build + +trigger: + ref: + - "refs/pull/**" + +steps: + - name: dryrun + pull: always + image: plugins/docker:linux-arm64 + settings: + dry_run: true + repo: gitea/gitea + tags: linux-arm64 + build_args: + - GOPROXY=off + when: + event: + - pull_request + +--- +kind: pipeline +name: docker-linux-arm64-release platform: os: linux @@ -658,31 +714,6 @@ trigger: ref: - refs/heads/master - "refs/tags/**" - - "refs/pull/**" - -steps: - - name: fetch-tags - pull: default - image: docker:git - commands: - - git fetch --tags --force - when: - event: - exclude: - - pull_request - - - name: dryrun - pull: always - image: plugins/docker:linux-arm64 - settings: - dry_run: true - repo: gitea/gitea - tags: linux-arm64 - build_args: - - GOPROXY=off - when: - event: - - pull_request - name: publish pull: always @@ -729,8 +760,8 @@ trigger: - "refs/tags/**" depends_on: - - docker-linux-amd64 - - docker-linux-arm64 + - docker-linux-amd64-release + - docker-linux-arm64-release --- kind: pipeline @@ -757,8 +788,8 @@ depends_on: - translations - release-version - release-master - - docker-linux-amd64 - - docker-linux-arm64 + - docker-linux-amd64-release + - docker-linux-arm64-release - docker-manifest - docs