Speed up pipelines (#2127)

- Use workflow-global conditions to also skip the `clone` step for
`docs` and `web` workflows
- never run `test` and `web` for pushes (they're running for PRs and
every change we do must pass checks on PRs, so they're unnecessary)

https://github.com/woodpecker-ci/woodpecker/issues/1910
This commit is contained in:
qwerty287 2023-08-07 10:58:42 +02:00 committed by GitHub
parent cdb52015f4
commit 516bc475b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 38 deletions

View file

@ -1,12 +1,7 @@
when: when:
event: [pull_request, push, cron] event: [pull_request, push, cron]
branch: ${CI_REPO_DEFAULT_BRANCH} branch: ${CI_REPO_DEFAULT_BRANCH}
path:
variables:
- &golang_image 'golang:1.20.2'
- &node_image 'node:18-alpine'
- &when_path
- "docs/**" - "docs/**"
- ".woodpecker/docs.yml" - ".woodpecker/docs.yml"
# since we generate docs for cli tool we have to watch this too # since we generate docs for cli tool we have to watch this too
@ -15,13 +10,16 @@ variables:
# api docs # api docs
- "server/api/**" - "server/api/**"
variables:
- &golang_image 'golang:1.20.2'
- &node_image 'node:18-alpine'
steps: steps:
build-cli: build-cli:
image: *golang_image image: *golang_image
commands: commands:
- make docs - make docs
when: when:
- path: *when_path
- cron: update_docs - cron: update_docs
event: cron event: cron
@ -33,7 +31,6 @@ steps:
- pnpm install --frozen-lockfile - pnpm install --frozen-lockfile
- pnpm build - pnpm build
when: when:
- path: *when_path
- cron: update_docs - cron: update_docs
event: cron event: cron
@ -50,7 +47,6 @@ steps:
failure: ignore failure: ignore
when: when:
event: pull_request event: pull_request
path: *when_path
# TODO: add step to remove preview again after PR is closed (waiting for #286) # TODO: add step to remove preview again after PR is closed (waiting for #286)
@ -78,6 +74,5 @@ steps:
when: when:
- event: push - event: push
branch: ${CI_REPO_DEFAULT_BRANCH} branch: ${CI_REPO_DEFAULT_BRANCH}
path: *when_path
- cron: update_docs - cron: update_docs
event: cron event: cron

View file

@ -1,9 +1,5 @@
when: when:
- event: [pull_request, tag] event: [pull_request, tag]
- event: push
branch:
- ${CI_REPO_DEFAULT_BRANCH}
- release/*
variables: variables:
- &golang_image 'golang:1.20.2' - &golang_image 'golang:1.20.2'

View file

@ -1,25 +1,15 @@
when: when:
- event: [pull_request, tag] event: [pull_request, tag]
- event: push path: &when_path
branch:
- ${CI_REPO_DEFAULT_BRANCH}
- release/*
variables:
- &node_image 'node:18-alpine'
- &when
- path: &when_path
# related config files # related config files
- ".woodpecker/web.yml" - ".woodpecker/web.yml"
# web source code # web source code
- "web/**" - "web/**"
# api source code # api source code
- "server/api/**" - "server/api/**"
branch:
exclude: ${CI_REPO_DEFAULT_BRANCH} variables:
event: push - &node_image 'node:18-alpine'
- path: *when_path
event: [pull_request, tag, deployment]
steps: steps:
deps: deps:
@ -28,7 +18,6 @@ steps:
commands: commands:
- corepack enable - corepack enable
- pnpm install --frozen-lockfile - pnpm install --frozen-lockfile
when: *when
lint: lint:
group: test group: test
@ -37,7 +26,6 @@ steps:
commands: commands:
- corepack enable - corepack enable
- pnpm lint - pnpm lint
when: *when
formatcheck: formatcheck:
group: test group: test
@ -46,7 +34,6 @@ steps:
commands: commands:
- corepack enable - corepack enable
- pnpm format:check - pnpm format:check
when: *when
typecheck: typecheck:
group: test group: test
@ -55,7 +42,6 @@ steps:
commands: commands:
- corepack enable - corepack enable
- pnpm typecheck - pnpm typecheck
when: *when
test: test:
group: test group: test
@ -64,4 +50,3 @@ steps:
commands: commands:
- corepack enable - corepack enable
- pnpm test - pnpm test
when: *when