Partial-Backport of pipeline from current master (#1167)

This commit is contained in:
6543 2022-09-04 23:25:40 +02:00 committed by GitHub
parent 98dae07c59
commit bffdc0a7bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 183 additions and 183 deletions

View file

@ -2,120 +2,94 @@ depends_on:
- test
- web
variables:
- &golang_image 'golang:1.18'
- &node_image 'node:16-alpine'
- &when_path
# related config files
- ".woodpecker/binaries.yml"
- "nfpm/*.yml"
# go source code
- "**/*.go"
- "go.*"
# web source code
- "web/**"
pipeline:
build-web:
image: node:16-alpine
group: prepare
image: *node_image
commands:
- cd web/
- yarn install --frozen-lockfile
- yarn build
when:
path:
# related config files
- ".woodpecker/binaries.yml"
- "nfpm/*.yml"
# go source code
- "**/*.go"
- "go.*"
# web source code
- "web/**"
path: *when_path
vendor:
group: prepare
image: *golang_image
commands:
- go mod vendor
when:
path: *when_path
build-server:
group: build
image: golang:1.18
image: *golang_image
commands:
- make release-server
when:
path:
# related config files
- ".woodpecker/binaries.yml"
- "nfpm/*.yml"
# go source code
- "**/*.go"
- "go.*"
# web source code
- "web/**"
path: *when_path
build-agent:
group: build
image: golang:1.18
image: *golang_image
commands:
- make release-agent
when:
path:
# related config files
- ".woodpecker/binaries.yml"
- "nfpm/*.yml"
# go source code
- "**/*.go"
- "go.*"
# web source code
- "web/**"
path: *when_path
build-cli:
group: build
image: golang:1.18
image: *golang_image
commands:
- make release-cli
when:
path:
# related config files
- ".woodpecker/binaries.yml"
- "nfpm/*.yml"
# go source code
- "**/*.go"
- "go.*"
# web source code
- "web/**"
path: *when_path
build-deb-rpm:
group: bundle
image: golang:1.18
image: *golang_image
commands:
- make bundle
when:
path:
# related config files
- ".woodpecker/binaries.yml"
- "nfpm/*.yml"
# go source code
- "**/*.go"
- "go.*"
# web source code
- "web/**"
path: *when_path
build-tarball:
group: bundle
image: *golang_image
commands:
- make release-tarball
when:
path: *when_path
checksums:
image: golang:1.18
image: *golang_image
commands:
- make release-checksums
when:
path:
# related config files
- ".woodpecker/binaries.yml"
- "nfpm/*.yml"
# go source code
- "**/*.go"
- "go.*"
# web source code
- "web/**"
path: *when_path
# TODO: upload build artifacts for pushes to ${CI_REPO_DEFAULT_BRANCH}
release-dryrun:
image: golang:1.18
image: *golang_image
commands:
- ls -la dist/*.*
- cat dist/checksums.txt
when:
path:
# related config files
- ".woodpecker/binaries.yml"
- "nfpm/*.yml"
# go source code
- "**/*.go"
- "go.*"
# web source code
- "web/**"
path: *when_path
release:
image: plugins/github-release

View file

@ -2,27 +2,44 @@ depends_on:
- test
- web
variables:
- &golang_image 'golang:1.18'
- &node_image 'node:16-alpine'
- &xgo_image 'techknowlogick/xgo:go-1.18.x'
- &xgo_version 'go-1.18.x'
- &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_alpine 'linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le'
pipeline:
vendor:
image: *golang_image
pull: true
commands:
- go mod vendor
###############
# S e r v e r #
###############
build-web:
image: node:16-alpine
image: *node_image
commands:
- cd web/
- yarn install --frozen-lockfile
- yarn build
cross-compile-server:
image: techknowlogick/xgo:go-1.18.x
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
PLATFORMS: linux|arm/v7;linux|arm64/v8;linux|amd64;linux|ppc64le;linux|riscv64
TAGS: bindata sqlite sqlite_unlock_notify
XGO_VERSION: go-1.18.x
XGO_VERSION: *xgo_version
publish-server-dryrun:
image: woodpeckerci/plugin-docker-buildx
@ -31,8 +48,8 @@ pipeline:
dry_run: true
repo: woodpeckerci/woodpecker-server
dockerfile: docker/Dockerfile.server.multiarch
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le
tag: test
platforms: *platforms_server
tag: pull_${CI_COMMIT_PULL_REQUEST}
when:
event: pull_request
@ -43,8 +60,8 @@ pipeline:
dry_run: true
repo: woodpeckerci/woodpecker-server
dockerfile: docker/Dockerfile.server.alpine.multiarch
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le
tag: next-alpine
platforms: *platforms_alpine
tag: pull_${CI_COMMIT_PULL_REQUEST}-alpine
when:
event: pull_request
@ -55,7 +72,7 @@ pipeline:
settings:
repo: woodpeckerci/woodpecker-server
dockerfile: docker/Dockerfile.server.multiarch
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le
platforms: *platforms_server
tag: next
when:
branch: ${CI_REPO_DEFAULT_BRANCH}
@ -68,7 +85,7 @@ pipeline:
settings:
repo: woodpeckerci/woodpecker-server
dockerfile: docker/Dockerfile.server.alpine.multiarch
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le
platforms: *platforms_alpine
tag: next-alpine
when:
branch: ${CI_REPO_DEFAULT_BRANCH}
@ -81,7 +98,7 @@ pipeline:
settings:
repo: woodpeckerci/woodpecker-server
dockerfile: docker/Dockerfile.server.multiarch
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le
platforms: *platforms_server
tag: ${CI_COMMIT_BRANCH##release/}
when:
branch: release/*
@ -94,7 +111,7 @@ pipeline:
settings:
repo: woodpeckerci/woodpecker-server
dockerfile: docker/Dockerfile.server.alpine.multiarch
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le
platforms: *platforms_alpine
tag: ${CI_COMMIT_BRANCH##release/}
when:
branch: release/*
@ -107,7 +124,7 @@ pipeline:
settings:
repo: woodpeckerci/woodpecker-server
dockerfile: docker/Dockerfile.server.multiarch
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le
platforms: *platforms_server
# remove 'latest' on older version branches to avoid accidental downgrade
tag: [latest, "${CI_COMMIT_TAG}"]
when:
@ -120,7 +137,7 @@ pipeline:
settings:
repo: woodpeckerci/woodpecker-server
dockerfile: docker/Dockerfile.server.alpine.multiarch
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le
platforms: *platforms_alpine
# remove 'latest-alpine' on older version branches to avoid accidental downgrade
tag: [latest-alpine, "${CI_COMMIT_TAG}-alpine"]
when:
@ -137,8 +154,8 @@ pipeline:
dry_run: true
repo: woodpeckerci/woodpecker-agent
dockerfile: docker/Dockerfile.agent.multiarch
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le,windows/amd64,darwin/amd64,darwin/arm64
tag: test
platforms: *platforms_preview
tag: pull_${CI_COMMIT_PULL_REQUEST}
when:
event: pull_request
@ -149,7 +166,7 @@ pipeline:
settings:
repo: woodpeckerci/woodpecker-agent
dockerfile: docker/Dockerfile.agent.multiarch
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le,windows/amd64,darwin/amd64,darwin/arm64,freebsd/arm64,freebsd/amd64,openbsd/arm64,openbsd/amd64
platforms: *platforms_release
tag: next
when:
branch: ${CI_REPO_DEFAULT_BRANCH}
@ -162,7 +179,7 @@ pipeline:
settings:
repo: woodpeckerci/woodpecker-agent
dockerfile: docker/Dockerfile.agent.alpine.multiarch
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le
platforms: *platforms_alpine
tag: next-alpine
when:
branch: ${CI_REPO_DEFAULT_BRANCH}
@ -175,7 +192,7 @@ pipeline:
settings:
repo: woodpeckerci/woodpecker-agent
dockerfile: docker/Dockerfile.agent.multiarch
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le,windows/amd64,darwin/amd64,darwin/arm64,freebsd/arm64,freebsd/amd64,openbsd/arm64,openbsd/amd64
platforms: *platforms_release
tag: ${CI_COMMIT_BRANCH##release/}
when:
branch: release/*
@ -188,7 +205,7 @@ pipeline:
settings:
repo: woodpeckerci/woodpecker-agent
dockerfile: docker/Dockerfile.agent.alpine.multiarch
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le
platforms: *platforms_alpine
tag: ${CI_COMMIT_BRANCH##release/}
when:
branch: release/*
@ -201,7 +218,7 @@ pipeline:
settings:
repo: woodpeckerci/woodpecker-agent
dockerfile: docker/Dockerfile.agent.multiarch
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le,windows/amd64,darwin/amd64,darwin/arm64,freebsd/arm64,freebsd/amd64,openbsd/arm64,openbsd/amd64
platforms: *platforms_release
# remove 'latest' on older version branches to avoid accidental downgrade
tag: [latest, "${CI_COMMIT_TAG}"]
when:
@ -214,7 +231,7 @@ pipeline:
settings:
repo: woodpeckerci/woodpecker-agent
dockerfile: docker/Dockerfile.agent.alpine.multiarch
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le
platforms: *platforms_alpine
# remove 'latest-alpine' on older version branches to avoid accidental downgrade
tag: [latest-alpine, "${CI_COMMIT_TAG}-alpine"]
when:
@ -231,8 +248,8 @@ pipeline:
dry_run: true
repo: woodpeckerci/woodpecker-cli
dockerfile: docker/Dockerfile.cli.multiarch
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le,windows/amd64,darwin/amd64,darwin/arm64
tag: test
platforms: *platforms_preview
tag: pull_${CI_COMMIT_PULL_REQUEST}
when:
event: pull_request
@ -243,7 +260,7 @@ pipeline:
settings:
repo: woodpeckerci/woodpecker-cli
dockerfile: docker/Dockerfile.cli.multiarch
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le,windows/amd64,darwin/amd64,darwin/arm64,freebsd/arm64,freebsd/amd64,openbsd/arm64,openbsd/amd64
platforms: *platforms_release
tag: next
when:
branch: ${CI_REPO_DEFAULT_BRANCH}
@ -256,7 +273,7 @@ pipeline:
settings:
repo: woodpeckerci/woodpecker-cli
dockerfile: docker/Dockerfile.cli.alpine.multiarch
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le
platforms: *platforms_alpine
tag: next-alpine
when:
branch: ${CI_REPO_DEFAULT_BRANCH}
@ -269,7 +286,7 @@ pipeline:
settings:
repo: woodpeckerci/woodpecker-cli
dockerfile: docker/Dockerfile.cli.multiarch
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le,windows/amd64,darwin/amd64,darwin/arm64,freebsd/arm64,freebsd/amd64,openbsd/arm64,openbsd/amd64
platforms: *platforms_release
tag: ${CI_COMMIT_BRANCH##release/}
when:
branch: release/*
@ -282,7 +299,7 @@ pipeline:
settings:
repo: woodpeckerci/woodpecker-cli
dockerfile: docker/Dockerfile.cli.alpine.multiarch
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le
platforms: *platforms_alpine
tag: ${CI_COMMIT_BRANCH##release/}
when:
branch: release/*
@ -295,7 +312,7 @@ pipeline:
settings:
repo: woodpeckerci/woodpecker-cli
dockerfile: docker/Dockerfile.cli.multiarch
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le,windows/amd64,darwin/amd64,darwin/arm64,freebsd/arm64,freebsd/amd64,openbsd/arm64,openbsd/amd64
platforms: *platforms_release
# remove 'latest' on older version branches to avoid accidental downgrade
tag: [latest, "${CI_COMMIT_TAG}"]
when:
@ -308,7 +325,7 @@ pipeline:
settings:
repo: woodpeckerci/woodpecker-cli
dockerfile: docker/Dockerfile.cli.alpine.multiarch
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le
platforms: *platforms_alpine
# remove 'latest-alpine' on older version branches to avoid accidental downgrade
tag: [latest-alpine, "${CI_COMMIT_TAG}-alpine"]
when:

View file

@ -1,13 +1,19 @@
variables:
- &node_image 'node:16-alpine'
- &when_path
- "docs/**"
- ".woodpecker/docs.yml"
pipeline:
build:
image: node:14-alpine
image: *node_image
commands:
- cd docs/
- yarn install --frozen-lockfile
- yarn build
when:
event: [push, pull_request]
path: "docs/**"
path: *when_path
deploy:
image: alpine:3.14.2
@ -33,5 +39,4 @@ pipeline:
when:
event: push
branch: ${CI_REPO_DEFAULT_BRANCH}
path: "docs/**"
path: *when_path

View file

@ -1,35 +1,45 @@
variables:
- &golang_image 'golang:1.18'
- &node_image 'node:16-alpine'
- &when_path
# related config files
- ".woodpecker/test.yml"
- ".golangci.yml"
# go source code
- "**/*.go"
- "go.*"
# schema changes
- "pipeline/schema/**"
pipeline:
vendor:
image: *golang_image
group: prepare
commands:
- go mod vendor
when:
path: *when_path
dummy-web:
image: golang:1.16
image: *golang_image
pull: true
group: prepare
commands:
- mkdir -p web/dist/
- echo "test" > web/dist/index.html
when:
path:
# related config files
- ".woodpecker/test.yml"
# go source code
- "**/*.go"
- "go.*"
# schema changes
- "pipeline/schema/**"
path: *when_path
lint:
image: golang:1.16
image: *golang_image
group: test
commands:
- make lint
when:
path:
# related config files
- ".woodpecker/test.yml"
- ".golangci.yml"
# go source code
- "**/*.go"
- "go.*"
path: *when_path
test:
image: golang:1.16
image: *golang_image
group: test
commands:
- make test-agent
@ -37,32 +47,20 @@ pipeline:
- make test-cli
- make test-lib
when:
path:
# related config files
- ".woodpecker/test.yml"
# go source code
- "**/*.go"
- "go.*"
# schema changes
- "pipeline/schema/**"
path: *when_path
sqlite:
image: golang:1.16
image: *golang_image
group: test
environment:
- WOODPECKER_DATABASE_DRIVER=sqlite3
commands:
- make test-server-datastore-coverage
when:
path:
# related config files
- ".woodpecker/test.yml"
# go source code
- "**/*.go"
- "go.*"
path: *when_path
postgres:
image: golang:1.16
image: *golang_image
group: test
environment:
- WOODPECKER_DATABASE_DRIVER=postgres
@ -70,15 +68,10 @@ pipeline:
commands:
- make test-server-datastore
when:
path:
# related config files
- ".woodpecker/test.yml"
# go source code
- "**/*.go"
- "go.*"
path: *when_path
mysql:
image: golang:1.16
image: *golang_image
group: test
environment:
- WOODPECKER_DATABASE_DRIVER=mysql
@ -86,12 +79,7 @@ pipeline:
commands:
- make test-server-datastore
when:
path:
# related config files
- ".woodpecker/test.yml"
# go source code
- "**/*.go"
- "go.*"
path: *when_path
codecov:
pull: true
@ -105,14 +93,7 @@ pipeline:
token:
from_secret: codecov_token
when:
path:
# related config files
- ".woodpecker/test.yml"
# go source code
- "**/*.go"
- "go.*"
# schema changes
- "pipeline/schema/**"
path: *when_path
services:
service-postgres:
@ -122,12 +103,7 @@ services:
- POSTGRES_USER=postgres
- POSTGRES_HOST_AUTH_METHOD=trust
when:
path:
# related config files
- ".woodpecker/test.yml"
# go source code
- "**/*.go"
- "go.*"
path: *when_path
service-mysql:
image: mysql:5.6.27
@ -136,9 +112,4 @@ services:
- MYSQL_DATABASE=test
- MYSQL_ALLOW_EMPTY_PASSWORD=yes
when:
path:
# related config files
- ".woodpecker/test.yml"
# go source code
- "**/*.go"
- "go.*"
path: *when_path

View file

@ -1,45 +1,53 @@
variables:
- &node_image 'node:16-alpine'
- &when_path
# related config files
- ".woodpecker/web.yml"
# web source code
- "web/**"
pipeline:
deps:
image: node:16-alpine
image: *node_image
commands:
- cd web/
- yarn install --frozen-lockfile
when:
path: "web/**"
path: *when_path
lint:
group: test
image: node:16-alpine
image: *node_image
commands:
- cd web/
- yarn lint
when:
path: "web/**"
path: *when_path
formatcheck:
group: test
image: node:16-alpine
image: *node_image
commands:
- cd web/
- yarn formatcheck
when:
path: "web/**"
path: *when_path
typecheck:
group: test
image: node:16-alpine
image: *node_image
commands:
- cd web/
- yarn typecheck
when:
path: "web/**"
path: *when_path
test:
group: test
image: node:16-alpine
image: *node_image
commands:
- cd web/
- yarn test
when:
path: "web/**"
path: *when_path

View file

@ -35,7 +35,7 @@ ifeq (in_docker,$(firstword $(MAKECMDGOALS)))
$(eval $(MAKE_ARGS):;@:)
in_docker:
@[ "1" == "$(shell docker image ls woodpecker/make:local -a | wc -l)" ] && docker build -f ./docker/Dockerfile.make -t woodpecker/make:local . || echo reuse existing docker image
@[ "1" -eq "$(shell docker image ls woodpecker/make:local -a | wc -l)" ] && docker build -f ./docker/Dockerfile.make -t woodpecker/make:local . || echo reuse existing docker image
@echo run in docker:
@docker run -it \
--user $(shell id -u):$(shell id -g) \
@ -188,6 +188,31 @@ release-cli:
tar -cvzf dist/woodpecker-cli_darwin_amd64.tar.gz -C dist/cli/darwin_amd64 woodpecker-cli
tar -cvzf dist/woodpecker-cli_darwin_arm64.tar.gz -C dist/cli/darwin_arm64 woodpecker-cli
release-tarball:
tar -cvzf dist/woodpecker-src-$(BUILD_VERSION).tar.gz \
agent \
cli \
cmd \
go.??? \
LICENSE \
Makefile \
pipeline \
server \
shared \
vendor \
version \
woodpecker-go \
web/index.html \
web/node_modules \
web/package.json \
web/public \
web/src \
web/package.json \
web/tsconfig.* \
web/*.ts \
web/yarn.lock \
web/web.go
release-checksums:
# generate shas for tar files
(cd dist/; sha256sum *.* > checksums.txt)

View file

@ -1,4 +1,4 @@
FROM golang:1.18 AS certs
FROM --platform=$BUILDPLATFORM golang:1.18 AS certs
FROM scratch
ARG TARGETOS TARGETARCH