diff --git a/.woodpecker/docker.yml b/.woodpecker/docker.yml index 5040adbf8..a4151f41c 100644 --- a/.woodpecker/docker.yml +++ b/.woodpecker/docker.yml @@ -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 diff --git a/.woodpecker/test.yml b/.woodpecker/test.yml index 72872c92a..6eaea570c 100644 --- a/.woodpecker/test.yml +++ b/.woodpecker/test.yml @@ -1,14 +1,20 @@ variables: - &golang_image 'golang:1.20.2' - - &when_path - # related config files - - ".woodpecker/test.yml" - - ".golangci.yml" - # go source code - - "**/*.go" - - "go.*" - # schema changes - - "pipeline/schema/**" + - &when + - path: &when_path + # related config files + - ".woodpecker/test.yml" + - ".golangci.yml" + # go source code + - "**/*.go" + - "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 diff --git a/.woodpecker/web.yml b/.woodpecker/web.yml index dae3462c5..f7a608e23 100644 --- a/.woodpecker/web.yml +++ b/.woodpecker/web.yml @@ -1,10 +1,16 @@ variables: - &node_image 'node:18-alpine' - - &when_path - # related config files - - ".woodpecker/web.yml" - # web source code - - "web/**" + - &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