mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-23 00:46:30 +00:00
Speedup pipeline (#1966)
- only build preview images for x86 - do not run `test` and `web` on default branch
This commit is contained in:
parent
2c1fc4b500
commit
a6d2c78916
3 changed files with 68 additions and 56 deletions
|
@ -9,7 +9,7 @@ variables:
|
|||
- &xgo_version 'go-1.20.2'
|
||||
- &platforms_release 'linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/386,linux/amd64,linux/ppc64le,linux/riscv64,linux/s390x,windows/amd64,freebsd/arm64,freebsd/amd64,openbsd/arm64,openbsd/amd64'
|
||||
- &platforms_server 'linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le,linux/riscv64'
|
||||
- &platforms_preview 'linux/arm/v6,linux/arm64/v8,linux/amd64,linux/riscv64,windows/amd64'
|
||||
- &platforms_preview 'linux/amd64'
|
||||
- &platforms_alpine 'linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le'
|
||||
|
||||
steps:
|
||||
|
@ -30,7 +30,7 @@ steps:
|
|||
- pnpm install --frozen-lockfile
|
||||
- pnpm build
|
||||
|
||||
cross-compile-server:
|
||||
cross-compile-server-preview:
|
||||
image: *xgo_image
|
||||
pull: true
|
||||
commands:
|
||||
|
@ -38,9 +38,11 @@ steps:
|
|||
- apt install -y tree
|
||||
- make cross-compile-server
|
||||
environment:
|
||||
PLATFORMS: linux|arm/v7;linux|arm64/v8;linux|amd64;linux|ppc64le;linux|riscv64
|
||||
PLATFORMS: linux|amd64
|
||||
TAGS: bindata sqlite sqlite_unlock_notify netgo
|
||||
XGO_VERSION: *xgo_version
|
||||
when:
|
||||
event: pull_request
|
||||
|
||||
publish-server-preview:
|
||||
image: woodpeckerci/plugin-docker-buildx
|
||||
|
@ -49,7 +51,7 @@ steps:
|
|||
settings:
|
||||
repo: woodpeckerci/woodpecker-server
|
||||
dockerfile: docker/Dockerfile.server.multiarch
|
||||
platforms: *platforms_server
|
||||
platforms: *platforms_preview
|
||||
tag: pull_${CI_COMMIT_PULL_REQUEST}
|
||||
when:
|
||||
event: pull_request
|
||||
|
@ -61,11 +63,26 @@ steps:
|
|||
settings:
|
||||
repo: woodpeckerci/woodpecker-server
|
||||
dockerfile: docker/Dockerfile.server.alpine.multiarch
|
||||
platforms: *platforms_alpine
|
||||
platforms: *platforms_preview
|
||||
tag: pull_${CI_COMMIT_PULL_REQUEST}-alpine
|
||||
when:
|
||||
event: pull_request
|
||||
|
||||
cross-compile-server:
|
||||
image: *xgo_image
|
||||
pull: true
|
||||
commands:
|
||||
- apt update
|
||||
- apt install -y tree
|
||||
- make cross-compile-server
|
||||
environment:
|
||||
PLATFORMS: linux|arm/v7;linux|arm64/v8;linux|amd64;linux|ppc64le;linux|riscv64
|
||||
TAGS: bindata sqlite sqlite_unlock_notify netgo
|
||||
XGO_VERSION: *xgo_version
|
||||
when:
|
||||
branch: ${CI_REPO_DEFAULT_BRANCH}
|
||||
event: push
|
||||
|
||||
publish-next-server:
|
||||
image: woodpeckerci/plugin-docker-buildx
|
||||
group: docker
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
variables:
|
||||
- &golang_image 'golang:1.20.2'
|
||||
- &when_path
|
||||
- &when
|
||||
- path: &when_path
|
||||
# related config files
|
||||
- ".woodpecker/test.yml"
|
||||
- ".golangci.yml"
|
||||
|
@ -9,6 +10,11 @@ variables:
|
|||
- "go.*"
|
||||
# schema changes
|
||||
- "pipeline/schema/**"
|
||||
branch:
|
||||
exclude: ${CI_REPO_DEFAULT_BRANCH}
|
||||
event: push
|
||||
- path: *when_path
|
||||
event: [pull_request, tag, deployment]
|
||||
|
||||
steps:
|
||||
vendor:
|
||||
|
@ -16,15 +22,15 @@ steps:
|
|||
group: prepare
|
||||
commands:
|
||||
- go mod vendor
|
||||
when:
|
||||
path: *when_path
|
||||
when: *when
|
||||
|
||||
lint-pipeline:
|
||||
image: *golang_image
|
||||
commands:
|
||||
- go run github.com/woodpecker-ci/woodpecker/cmd/cli lint
|
||||
when:
|
||||
path:
|
||||
- <<: *when
|
||||
- path:
|
||||
- ".woodpecker/**"
|
||||
- "pipeline/schema/**"
|
||||
|
||||
|
@ -34,16 +40,14 @@ steps:
|
|||
commands:
|
||||
- mkdir -p web/dist/
|
||||
- echo "test" > web/dist/index.html
|
||||
when:
|
||||
path: *when_path
|
||||
when: *when
|
||||
|
||||
lint:
|
||||
image: *golang_image
|
||||
group: test
|
||||
commands:
|
||||
- make lint
|
||||
when:
|
||||
path: *when_path
|
||||
when: *when
|
||||
|
||||
check_swagger:
|
||||
image: *golang_image
|
||||
|
@ -52,8 +56,7 @@ steps:
|
|||
- "make generate-swagger"
|
||||
- "DIFF=$(git diff | head)"
|
||||
- "[ -n \"$DIFF\" ] && { echo \"swagger not up to date, exec 'make generate-swagger' and commit\"; exit 1; } || true"
|
||||
when:
|
||||
path: *when_path
|
||||
when: *when
|
||||
|
||||
lint-editorconfig:
|
||||
image: mstruebing/editorconfig-checker
|
||||
|
@ -66,8 +69,7 @@ steps:
|
|||
# commands:
|
||||
# - trivy fs --exit-code 0 --skip-dirs web/ --skip-dirs docs/ --severity UNKNOWN,LOW .
|
||||
# - trivy fs --exit-code 1 --skip-dirs web/ --skip-dirs docs/ --severity MEDIUM,HIGH,CRITICAL .
|
||||
# when:
|
||||
# path: *when_path
|
||||
# when: *when
|
||||
|
||||
test:
|
||||
image: *golang_image
|
||||
|
@ -77,8 +79,7 @@ steps:
|
|||
- make test-server
|
||||
- make test-cli
|
||||
- make test-lib
|
||||
when:
|
||||
path: *when_path
|
||||
when: *when
|
||||
|
||||
sqlite:
|
||||
image: *golang_image
|
||||
|
@ -87,8 +88,7 @@ steps:
|
|||
- WOODPECKER_DATABASE_DRIVER=sqlite3
|
||||
commands:
|
||||
- make test-server-datastore-coverage
|
||||
when:
|
||||
path: *when_path
|
||||
when: *when
|
||||
|
||||
postgres:
|
||||
image: *golang_image
|
||||
|
@ -98,8 +98,7 @@ steps:
|
|||
- WOODPECKER_DATABASE_DATASOURCE=host=service-postgres user=postgres dbname=postgres sslmode=disable
|
||||
commands:
|
||||
- make test-server-datastore
|
||||
when:
|
||||
path: *when_path
|
||||
when: *when
|
||||
|
||||
mysql:
|
||||
image: *golang_image
|
||||
|
@ -109,8 +108,7 @@ steps:
|
|||
- WOODPECKER_DATABASE_DATASOURCE=root@tcp(service-mysql:3306)/test?parseTime=true
|
||||
commands:
|
||||
- make test-server-datastore
|
||||
when:
|
||||
path: *when_path
|
||||
when: *when
|
||||
|
||||
codecov:
|
||||
pull: true
|
||||
|
@ -124,8 +122,7 @@ steps:
|
|||
- datastore-coverage.out
|
||||
token:
|
||||
from_secret: codecov_token
|
||||
when:
|
||||
path: *when_path
|
||||
when: *when
|
||||
failure: ignore
|
||||
|
||||
services:
|
||||
|
@ -135,8 +132,7 @@ services:
|
|||
environment:
|
||||
- POSTGRES_USER=postgres
|
||||
- POSTGRES_HOST_AUTH_METHOD=trust
|
||||
when:
|
||||
path: *when_path
|
||||
when: *when
|
||||
|
||||
service-mysql:
|
||||
image: mysql:5.6.27
|
||||
|
@ -144,5 +140,4 @@ services:
|
|||
environment:
|
||||
- MYSQL_DATABASE=test
|
||||
- MYSQL_ALLOW_EMPTY_PASSWORD=yes
|
||||
when:
|
||||
path: *when_path
|
||||
when: *when
|
||||
|
|
|
@ -1,10 +1,16 @@
|
|||
variables:
|
||||
- &node_image 'node:18-alpine'
|
||||
- &when_path
|
||||
- &when
|
||||
- path: &when_path
|
||||
# related config files
|
||||
- ".woodpecker/web.yml"
|
||||
# web source code
|
||||
- "web/**"
|
||||
branch:
|
||||
exclude: ${CI_REPO_DEFAULT_BRANCH}
|
||||
event: push
|
||||
- path: *when_path
|
||||
event: [pull_request, tag, deployment]
|
||||
|
||||
steps:
|
||||
deps:
|
||||
|
@ -13,8 +19,7 @@ steps:
|
|||
commands:
|
||||
- corepack enable
|
||||
- pnpm install --frozen-lockfile
|
||||
when:
|
||||
path: *when_path
|
||||
when: *when
|
||||
|
||||
lint:
|
||||
group: test
|
||||
|
@ -23,8 +28,7 @@ steps:
|
|||
commands:
|
||||
- corepack enable
|
||||
- pnpm lint
|
||||
when:
|
||||
path: *when_path
|
||||
when: *when
|
||||
|
||||
formatcheck:
|
||||
group: test
|
||||
|
@ -33,8 +37,7 @@ steps:
|
|||
commands:
|
||||
- corepack enable
|
||||
- pnpm formatcheck
|
||||
when:
|
||||
path: *when_path
|
||||
when: *when
|
||||
|
||||
typecheck:
|
||||
group: test
|
||||
|
@ -43,8 +46,7 @@ steps:
|
|||
commands:
|
||||
- corepack enable
|
||||
- pnpm typecheck
|
||||
when:
|
||||
path: *when_path
|
||||
when: *when
|
||||
|
||||
securitycheck:
|
||||
group: test
|
||||
|
@ -52,8 +54,7 @@ steps:
|
|||
commands:
|
||||
- trivy fs --exit-code 0 --skip-dirs node_modules/ --severity UNKNOWN,LOW web/
|
||||
- trivy fs --exit-code 1 --skip-dirs node_modules/ --severity MEDIUM,HIGH,CRITICAL web/
|
||||
when:
|
||||
path: *when_path
|
||||
when: *when
|
||||
|
||||
test:
|
||||
group: test
|
||||
|
@ -62,5 +63,4 @@ steps:
|
|||
commands:
|
||||
- corepack enable
|
||||
- pnpm test
|
||||
when:
|
||||
path: *when_path
|
||||
when: *when
|
||||
|
|
Loading…
Reference in a new issue