mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-26 20:01:02 +00:00
Run pipeline for binary files on pull if go code changed (#722)
* run pipeline for binary files on pull if go code changed * add release-dryrun * run "test" only if go code changes * fix-build-checksum
This commit is contained in:
parent
48089f53d8
commit
062579d66f
5 changed files with 189 additions and 77 deletions
126
.woodpecker/binaries.yml
Normal file
126
.woodpecker/binaries.yml
Normal file
|
@ -0,0 +1,126 @@
|
||||||
|
depends_on:
|
||||||
|
- test
|
||||||
|
- web
|
||||||
|
|
||||||
|
pipeline:
|
||||||
|
build-web:
|
||||||
|
image: node:16-alpine
|
||||||
|
commands:
|
||||||
|
- cd web/
|
||||||
|
- yarn install --frozen-lockfile
|
||||||
|
- yarn build
|
||||||
|
when:
|
||||||
|
path:
|
||||||
|
include:
|
||||||
|
# related config files
|
||||||
|
- ".woodpecker/binaries.yml"
|
||||||
|
- "nfpm/*.yml"
|
||||||
|
# go source code
|
||||||
|
- "**/*.go"
|
||||||
|
- "go.*"
|
||||||
|
# web source code
|
||||||
|
- "web/**"
|
||||||
|
|
||||||
|
build-server:
|
||||||
|
group: build
|
||||||
|
image: golang:1.16
|
||||||
|
commands:
|
||||||
|
- make release-server
|
||||||
|
when:
|
||||||
|
path:
|
||||||
|
include:
|
||||||
|
# related config files
|
||||||
|
- ".woodpecker/binaries.yml"
|
||||||
|
- "nfpm/*.yml"
|
||||||
|
# go source code
|
||||||
|
- "**/*.go"
|
||||||
|
- "go.*"
|
||||||
|
# web source code
|
||||||
|
- "web/**"
|
||||||
|
|
||||||
|
build-agent:
|
||||||
|
group: build
|
||||||
|
image: golang:1.16
|
||||||
|
commands:
|
||||||
|
- make release-agent
|
||||||
|
when:
|
||||||
|
path:
|
||||||
|
include:
|
||||||
|
# related config files
|
||||||
|
- ".woodpecker/binaries.yml"
|
||||||
|
- "nfpm/*.yml"
|
||||||
|
# go source code
|
||||||
|
- "**/*.go"
|
||||||
|
- "go.*"
|
||||||
|
|
||||||
|
build-cli:
|
||||||
|
group: build
|
||||||
|
image: golang:1.16
|
||||||
|
commands:
|
||||||
|
- make release-cli
|
||||||
|
when:
|
||||||
|
path:
|
||||||
|
include:
|
||||||
|
# related config files
|
||||||
|
- ".woodpecker/binaries.yml"
|
||||||
|
- "nfpm/*.yml"
|
||||||
|
# go source code
|
||||||
|
- "**/*.go"
|
||||||
|
- "go.*"
|
||||||
|
|
||||||
|
build-deb-rpm:
|
||||||
|
group: bundle
|
||||||
|
image: golang:1.16
|
||||||
|
commands:
|
||||||
|
- make bundle
|
||||||
|
when:
|
||||||
|
path:
|
||||||
|
include:
|
||||||
|
# related config files
|
||||||
|
- ".woodpecker/binaries.yml"
|
||||||
|
- "nfpm/*.yml"
|
||||||
|
# go source code
|
||||||
|
- "**/*.go"
|
||||||
|
- "go.*"
|
||||||
|
# web source code
|
||||||
|
- "web/**"
|
||||||
|
|
||||||
|
checksums:
|
||||||
|
image: golang:1.16
|
||||||
|
commands:
|
||||||
|
- make release-checksums
|
||||||
|
when:
|
||||||
|
path:
|
||||||
|
include:
|
||||||
|
# related config files
|
||||||
|
- ".woodpecker/binaries.yml"
|
||||||
|
- "nfpm/*.yml"
|
||||||
|
# go source code
|
||||||
|
- "**/*.go"
|
||||||
|
- "go.*"
|
||||||
|
# web source code
|
||||||
|
- "web/**"
|
||||||
|
|
||||||
|
# TODO: upload build artifacts for pushes to ${CI_REPO_DEFAULT_BRANCH}
|
||||||
|
|
||||||
|
release-dryrun:
|
||||||
|
image: golang:1.16
|
||||||
|
commands:
|
||||||
|
- ls -la dist/*.*
|
||||||
|
- cat dist/checksums.txt
|
||||||
|
|
||||||
|
release:
|
||||||
|
image: plugins/github-release
|
||||||
|
secrets:
|
||||||
|
- source: github_token
|
||||||
|
target: github_release_api_key
|
||||||
|
settings:
|
||||||
|
files:
|
||||||
|
- dist/*.tar.gz
|
||||||
|
- dist/*.deb
|
||||||
|
- dist/*.rpm
|
||||||
|
- dist/checksums.txt
|
||||||
|
title: ${CI_COMMIT_TAG##v}
|
||||||
|
when:
|
||||||
|
event: tag
|
||||||
|
# path conditions are ignored for tag events
|
|
@ -1,3 +1,7 @@
|
||||||
|
depends_on:
|
||||||
|
- test
|
||||||
|
- web
|
||||||
|
|
||||||
pipeline:
|
pipeline:
|
||||||
build-web:
|
build-web:
|
||||||
image: node:16-alpine
|
image: node:16-alpine
|
||||||
|
@ -217,7 +221,3 @@ pipeline:
|
||||||
tag: [latest-alpine, "${CI_COMMIT_TAG}-alpine"]
|
tag: [latest-alpine, "${CI_COMMIT_TAG}-alpine"]
|
||||||
when:
|
when:
|
||||||
event: tag
|
event: tag
|
||||||
|
|
||||||
depends_on:
|
|
||||||
- test
|
|
||||||
- web
|
|
||||||
|
|
|
@ -1,65 +0,0 @@
|
||||||
pipeline:
|
|
||||||
build-web:
|
|
||||||
image: node:16-alpine
|
|
||||||
commands:
|
|
||||||
- cd web/
|
|
||||||
- yarn install --frozen-lockfile
|
|
||||||
- yarn build
|
|
||||||
|
|
||||||
build-server:
|
|
||||||
group: build
|
|
||||||
image: golang:1.16
|
|
||||||
commands:
|
|
||||||
- make release-server
|
|
||||||
|
|
||||||
build-agent:
|
|
||||||
group: build
|
|
||||||
image: golang:1.16
|
|
||||||
commands:
|
|
||||||
- make release-agent
|
|
||||||
when:
|
|
||||||
event: tag
|
|
||||||
|
|
||||||
build-cli:
|
|
||||||
group: build
|
|
||||||
image: golang:1.16
|
|
||||||
commands:
|
|
||||||
- make release-cli
|
|
||||||
when:
|
|
||||||
event: tag
|
|
||||||
|
|
||||||
build-deb-rpm:
|
|
||||||
group: bundle
|
|
||||||
image: golang:1.16
|
|
||||||
commands:
|
|
||||||
- make bundle
|
|
||||||
when:
|
|
||||||
event: tag
|
|
||||||
|
|
||||||
checksums:
|
|
||||||
image: golang:1.16
|
|
||||||
commands:
|
|
||||||
- make release-checksums
|
|
||||||
when:
|
|
||||||
event: tag
|
|
||||||
|
|
||||||
# TODO: upload build artifacts for pushes to ${CI_REPO_DEFAULT_BRANCH}
|
|
||||||
|
|
||||||
release:
|
|
||||||
image: plugins/github-release
|
|
||||||
secrets:
|
|
||||||
- source: github_token
|
|
||||||
target: github_release_api_key
|
|
||||||
settings:
|
|
||||||
files:
|
|
||||||
- dist/*.tar.gz
|
|
||||||
- dist/*.deb
|
|
||||||
- dist/*.rpm
|
|
||||||
- dist/checksums.txt
|
|
||||||
title: ${CI_COMMIT_TAG##v}
|
|
||||||
when:
|
|
||||||
event: tag
|
|
||||||
|
|
||||||
depends_on:
|
|
||||||
- test
|
|
||||||
- web
|
|
|
@ -4,6 +4,14 @@ pipeline:
|
||||||
commands:
|
commands:
|
||||||
- mkdir -p web/dist/
|
- mkdir -p web/dist/
|
||||||
- echo "test" > web/dist/index.html
|
- echo "test" > web/dist/index.html
|
||||||
|
when:
|
||||||
|
path:
|
||||||
|
include:
|
||||||
|
# related config files
|
||||||
|
- ".woodpecker/test.yml"
|
||||||
|
# go source code
|
||||||
|
- "**/*.go"
|
||||||
|
- "go.*"
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
image: golang:1.16
|
image: golang:1.16
|
||||||
|
@ -13,11 +21,12 @@ pipeline:
|
||||||
when:
|
when:
|
||||||
path:
|
path:
|
||||||
include:
|
include:
|
||||||
- "vendor/**"
|
# related config files
|
||||||
- "go.mod"
|
- ".woodpecker/test.yml"
|
||||||
- "go.sum"
|
|
||||||
- "**/*.go"
|
|
||||||
- ".golangci.yml"
|
- ".golangci.yml"
|
||||||
|
# go source code
|
||||||
|
- "**/*.go"
|
||||||
|
- "go.*"
|
||||||
|
|
||||||
test:
|
test:
|
||||||
image: golang:1.16
|
image: golang:1.16
|
||||||
|
@ -30,10 +39,11 @@ pipeline:
|
||||||
when:
|
when:
|
||||||
path:
|
path:
|
||||||
include:
|
include:
|
||||||
- "vendor/**"
|
# related config files
|
||||||
- "go.mod"
|
- ".woodpecker/test.yml"
|
||||||
- "go.sum"
|
# go source code
|
||||||
- "**/*.go"
|
- "**/*.go"
|
||||||
|
- "go.*"
|
||||||
|
|
||||||
sqlite:
|
sqlite:
|
||||||
image: golang:1.16
|
image: golang:1.16
|
||||||
|
@ -42,6 +52,14 @@ pipeline:
|
||||||
- WOODPECKER_DATABASE_DRIVER=sqlite3
|
- WOODPECKER_DATABASE_DRIVER=sqlite3
|
||||||
commands:
|
commands:
|
||||||
- make test-server-datastore
|
- make test-server-datastore
|
||||||
|
when:
|
||||||
|
path:
|
||||||
|
include:
|
||||||
|
# related config files
|
||||||
|
- ".woodpecker/test.yml"
|
||||||
|
# go source code
|
||||||
|
- "**/*.go"
|
||||||
|
- "go.*"
|
||||||
|
|
||||||
postgres:
|
postgres:
|
||||||
image: golang:1.16
|
image: golang:1.16
|
||||||
|
@ -51,6 +69,14 @@ pipeline:
|
||||||
- WOODPECKER_DATABASE_DATASOURCE=host=service-postgres user=postgres dbname=postgres sslmode=disable
|
- WOODPECKER_DATABASE_DATASOURCE=host=service-postgres user=postgres dbname=postgres sslmode=disable
|
||||||
commands:
|
commands:
|
||||||
- make test-server-datastore
|
- make test-server-datastore
|
||||||
|
when:
|
||||||
|
path:
|
||||||
|
include:
|
||||||
|
# related config files
|
||||||
|
- ".woodpecker/test.yml"
|
||||||
|
# go source code
|
||||||
|
- "**/*.go"
|
||||||
|
- "go.*"
|
||||||
|
|
||||||
mysql:
|
mysql:
|
||||||
image: golang:1.16
|
image: golang:1.16
|
||||||
|
@ -60,6 +86,14 @@ pipeline:
|
||||||
- WOODPECKER_DATABASE_DATASOURCE=root@tcp(service-mysql:3306)/test?parseTime=true
|
- WOODPECKER_DATABASE_DATASOURCE=root@tcp(service-mysql:3306)/test?parseTime=true
|
||||||
commands:
|
commands:
|
||||||
- make test-server-datastore
|
- make test-server-datastore
|
||||||
|
when:
|
||||||
|
path:
|
||||||
|
include:
|
||||||
|
# related config files
|
||||||
|
- ".woodpecker/test.yml"
|
||||||
|
# go source code
|
||||||
|
- "**/*.go"
|
||||||
|
- "go.*"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
service-postgres:
|
service-postgres:
|
||||||
|
@ -68,9 +102,26 @@ services:
|
||||||
environment:
|
environment:
|
||||||
- POSTGRES_USER=postgres
|
- POSTGRES_USER=postgres
|
||||||
- POSTGRES_HOST_AUTH_METHOD=trust
|
- POSTGRES_HOST_AUTH_METHOD=trust
|
||||||
|
when:
|
||||||
|
path:
|
||||||
|
include:
|
||||||
|
# related config files
|
||||||
|
- ".woodpecker/test.yml"
|
||||||
|
# go source code
|
||||||
|
- "**/*.go"
|
||||||
|
- "go.*"
|
||||||
|
|
||||||
service-mysql:
|
service-mysql:
|
||||||
image: mysql:5.6.27
|
image: mysql:5.6.27
|
||||||
ports: ["3306"]
|
ports: ["3306"]
|
||||||
environment:
|
environment:
|
||||||
- MYSQL_DATABASE=test
|
- MYSQL_DATABASE=test
|
||||||
- MYSQL_ALLOW_EMPTY_PASSWORD=yes
|
- MYSQL_ALLOW_EMPTY_PASSWORD=yes
|
||||||
|
when:
|
||||||
|
path:
|
||||||
|
include:
|
||||||
|
# related config files
|
||||||
|
- ".woodpecker/test.yml"
|
||||||
|
# go source code
|
||||||
|
- "**/*.go"
|
||||||
|
- "go.*"
|
||||||
|
|
2
Makefile
2
Makefile
|
@ -128,7 +128,7 @@ release-cli:
|
||||||
|
|
||||||
release-checksums:
|
release-checksums:
|
||||||
# generate shas for tar files
|
# generate shas for tar files
|
||||||
(cd dist/; sha256sum *.{tar.gz,apk,deb,rpm} > checksums.txt)
|
(cd dist/; sha256sum *.* > checksums.txt)
|
||||||
|
|
||||||
release: release-frontend release-server release-agent release-cli
|
release: release-frontend release-server release-agent release-cli
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue