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 | 227 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 129 insertions(+), 98 deletions(-) diff --git a/.drone.yml b/.drone.yml index 7a844af8eb..dc47f8dd5d 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,6 +1,6 @@ --- kind: pipeline -name: testing +name: init platform: os: linux @@ -10,39 +10,6 @@ workspace: base: /go path: src/code.gitea.io/gitea -services: - - name: mysql - pull: default - image: mysql:5.7 - environment: - MYSQL_ALLOW_EMPTY_PASSWORD: yes - MYSQL_DATABASE: test - - - name: mysql8 - pull: default - image: mysql:8.0 - environment: - MYSQL_ALLOW_EMPTY_PASSWORD: yes - MYSQL_DATABASE: testgitea - - - name: pgsql - pull: default - image: postgres:9.5 - environment: - POSTGRES_DB: test - - - name: mssql - pull: default - image: microsoft/mssql-server-linux:latest - environment: - ACCEPT_EULA: Y - MSSQL_PID: Standard - SA_PASSWORD: MwantsaSecurePassword1 - - - name: ldap - pull: default - image: gitea/test-openldap:latest - steps: - name: fetch-tags pull: default @@ -54,6 +21,30 @@ steps: 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 @@ -83,7 +74,7 @@ steps: - 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 + - name: generate-build pull: always image: golang:1.13 commands: @@ -100,6 +91,55 @@ steps: GOSUMDB: sum.golang.org TAGS: bindata sqlite sqlite_unlock_notify +--- +kind: pipeline +name: testing + +platform: + os: linux + arch: amd64 + +workspace: + base: /go + path: src/code.gitea.io/gitea + +depends_on: + - init + +services: + - name: mysql + pull: default + image: mysql:5.7 + environment: + MYSQL_ALLOW_EMPTY_PASSWORD: yes + MYSQL_DATABASE: test + + - name: mysql8 + pull: default + image: mysql:8.0 + environment: + MYSQL_ALLOW_EMPTY_PASSWORD: yes + MYSQL_DATABASE: testgitea + + - name: pgsql + pull: default + image: postgres:9.5 + environment: + POSTGRES_DB: test + + - name: mssql + pull: default + image: microsoft/mssql-server-linux:latest + environment: + ACCEPT_EULA: Y + MSSQL_PID: Standard + SA_PASSWORD: MwantsaSecurePassword1 + + - name: ldap + pull: default + image: gitea/test-openldap:latest + +steps: - 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,7 @@ steps: --- kind: pipeline -name: docker-linux-amd64 +name: docker-linux-amd64-dry-run platform: os: linux @@ -589,25 +603,13 @@ workspace: path: src/code.gitea.io/gitea depends_on: - - testing + - build 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 @@ -621,6 +623,27 @@ steps: event: - pull_request +--- +kind: pipeline +name: docker-linux-amd64-release + +platform: + os: linux + arch: amd64 + +workspace: + base: /go + path: src/code.gitea.io/gitea + +depends_on: + - testing + +trigger: + ref: + - refs/heads/master + - "refs/tags/**" + +steps: - name: publish pull: always image: plugins/docker:linux-amd64 @@ -641,7 +664,7 @@ steps: --- kind: pipeline -name: docker-linux-arm64 +name: docker-linux-arm64-dry-run platform: os: linux @@ -652,25 +675,13 @@ workspace: path: src/code.gitea.io/gitea depends_on: - - testing + - build 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 @@ -684,6 +695,26 @@ steps: event: - pull_request +--- +kind: pipeline +name: docker-linux-arm64-release + +platform: + os: linux + arch: arm64 + +workspace: + base: /go + path: src/code.gitea.io/gitea + +depends_on: + - testing + +trigger: + ref: + - refs/heads/master + - "refs/tags/**" + - name: publish pull: always image: plugins/docker:linux-arm64 @@ -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