From e45a354eef079ebb6fee27c41c690ab66c7da4d2 Mon Sep 17 00:00:00 2001 From: pat-s Date: Sat, 27 Apr 2024 21:26:21 +0000 Subject: [PATCH] CI modifications (#318) Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/318 Co-authored-by: pat-s Co-committed-by: pat-s --- .woodpecker.yml => .woodpecker/build.yml | 60 ++++++++++++++---------- .woodpecker/lint.yml | 26 ++++++++++ 2 files changed, 60 insertions(+), 26 deletions(-) rename .woodpecker.yml => .woodpecker/build.yml (70%) create mode 100644 .woodpecker/lint.yml diff --git a/.woodpecker.yml b/.woodpecker/build.yml similarity index 70% rename from .woodpecker.yml rename to .woodpecker/build.yml index 25beb00..00097b2 100644 --- a/.woodpecker.yml +++ b/.woodpecker/build.yml @@ -5,6 +5,9 @@ when: - ${CI_REPO_DEFAULT_BRANCH} - renovate/* +depends_on: + - lint + steps: # use vendor to cache dependencies vendor: @@ -12,20 +15,6 @@ steps: commands: - go mod vendor - lint: - image: golangci/golangci-lint:latest - depends_on: vendor - pull: true - commands: - - go version - - go install mvdan.cc/gofumpt@latest - - "[ $(gofumpt -extra -l . | wc -l) != 0 ] && { echo 'code not formated'; exit 1; }" - - golangci-lint run --timeout 5m --build-tags integration - - editor-config: - depends_on: [] - image: mstruebing/editorconfig-checker - build: depends_on: vendor image: codeberg.org/6543/docker-images/golang_just @@ -33,18 +22,24 @@ steps: - go version - just build when: - event: ["pull_request", "push"] + - event: [push, pull_request] + branch: + - ${CI_REPO_DEFAULT_BRANCH} + - renovate/* docker-dryrun: depends_on: vendor - image: plugins/kaniko + image: plugins/kaniko:1.8.8 settings: dockerfile: Dockerfile no_push: true tags: latest when: - event: ["pull_request", "push"] - path: Dockerfile + - event: [push, pull_request] + branch: + - ${CI_REPO_DEFAULT_BRANCH} + - renovate/* + path: Dockerfile build-tag: depends_on: vendor @@ -53,13 +48,19 @@ steps: - go version - just build-tag ${CI_COMMIT_TAG##v} when: - event: ["tag"] + - event: ["tag"] + branch: + - ${CI_REPO_DEFAULT_BRANCH} test: depends_on: build image: codeberg.org/6543/docker-images/golang_just commands: - just test + when: + - event: pull_request + - event: push + branch: renovate/* integration-tests: depends_on: build @@ -71,10 +72,14 @@ steps: - PAGES_DOMAIN=localhost.mock.directory - RAW_DOMAIN=raw.localhost.mock.directory - PORT=4430 + when: + - event: pull_request + - event: push + branch: renovate/* release: depends_on: build - image: plugins/gitea-release + image: plugins/gitea-release:0.3.1 settings: base_url: https://codeberg.org file_exists: overwrite @@ -87,11 +92,13 @@ steps: - CI_BUILD_EVENT=${CI_BUILD_EVENT} - CI_COMMIT_REF=${CI_COMMIT_REF} when: - event: ["tag"] + - event: ["tag"] + branch: + - ${CI_REPO_DEFAULT_BRANCH} docker-next: depends_on: vendor - image: plugins/kaniko + image: plugins/kaniko:1.8.8 settings: registry: codeberg.org dockerfile: Dockerfile @@ -102,12 +109,12 @@ steps: password: from_secret: bot_token when: - event: ["push"] - branch: ${CI_REPO_DEFAULT_BRANCH} + - event: ["push"] + branch: ${CI_REPO_DEFAULT_BRANCH} docker-tag: depends_on: vendor - image: plugins/kaniko + image: plugins/kaniko:1.8.8 settings: registry: codeberg.org dockerfile: Dockerfile @@ -118,4 +125,5 @@ steps: password: from_secret: bot_token when: - event: ["tag"] + - event: ["push"] + branch: ${CI_REPO_DEFAULT_BRANCH} diff --git a/.woodpecker/lint.yml b/.woodpecker/lint.yml new file mode 100644 index 0000000..02d9ec8 --- /dev/null +++ b/.woodpecker/lint.yml @@ -0,0 +1,26 @@ +when: + - event: pull_request + - event: push + branch: renovate/* + +steps: + lint: + depends_on: [] + image: golangci/golangci-lint:v1.57.2 + commands: + - go version + - go install mvdan.cc/gofumpt@latest + - "[ $(gofumpt -extra -l . | wc -l) != 0 ] && { echo 'code not formated'; exit 1; }" + - golangci-lint run --timeout 5m --build-tags integration + when: + - event: pull_request + - event: push + branch: renovate/* + + editor-config: + depends_on: [] + image: mstruebing/editorconfig-checker:2.7.2 + when: + - event: pull_request + - event: push + branch: renovate/*