woodpecker/.woodpecker/main.yml
Anbraten 063d0bb32a
Replace DRONE_ with CI_ variables in pipeline steps (#427)
Dropped support for `DRONE_*` environment variables in pipeline steps. Pipeline meta-data can be accessed with `CI_*` variables.
  - `CI_*` prefix replaces `DRONE_*`
  - `CI` value is now `woodpecker`
  - `DRONE=true` has been removed
2021-11-25 20:43:31 +01:00

284 lines
6.4 KiB
YAML

clone:
git:
image: plugins/git:next
pipeline:
web-deps:
image: node:16-alpine
commands:
- cd web/
- yarn install --frozen-lockfile
when:
path: "web/**"
# TODO: enable if we have enouth mem (~2g) to lint, cause an oom atm.
# For reviewers, please run localy to verify it passes
# web-lint:
# TODO: disabled group for now to prevent oom
# group: web-test
# image: node:16-alpine
# commands:
# - cd web/
# - yarn lint
# when:
# path: "web/**"
web-formatcheck:
group: web-test
image: node:16-alpine
commands:
- cd web/
- yarn formatcheck
when:
path: "web/**"
web-typecheck:
group: web-test
image: node:16-alpine
commands:
- cd web/
- yarn typecheck
when:
path: "web/**"
web-test:
group: web-test
image: node:16-alpine
commands:
- cd web/
- yarn test
when:
path: "web/**"
web-build:
image: node:16-alpine
commands:
- cd web/
- yarn build
when:
path: "web/**"
test:
image: golang:1.16
group: test
commands:
- make test
- make lint
test-postgres:
image: golang:1.16
group: db-test
environment:
- WOODPECKER_DATABASE_DRIVER=postgres
- WOODPECKER_DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
commands:
- go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore
test-mysql:
image: golang:1.16
group: db-test
environment:
- WOODPECKER_DATABASE_DRIVER=mysql
- WOODPECKER_DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
commands:
- go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore
build-frontend:
image: node:16-alpine
commands:
- apk add make
- make release-frontend
build-server:
group: build
image: golang:1.16
commands:
- make release-server
build-agent:
group: build
image: golang:1.16
commands:
- make release-agent
build-cli:
group: build
image: golang:1.16
commands:
- make release-cli
build-deb-rpm:
group: bundle
image: golang:1.16
commands:
- make bundle
when:
event: [push, tag]
branch: master
publish-server:
group: bundle
image: plugins/docker
repo: woodpeckerci/woodpecker-server
dockerfile: docker/Dockerfile.server
secrets: [docker_username, docker_password]
# TODO: only release as next after 0.15.0 got released
tag: [next, latest]
when:
branch: master
event: push
publish-server-alpine:
group: bundle
image: plugins/docker
repo: woodpeckerci/woodpecker-server
dockerfile: docker/Dockerfile.server.alpine
secrets: [ docker_username, docker_password ]
# TODO: only release as next-alpine after 0.15.0 got released
tag: [next-alpine, latest-alpine]
when:
branch: master
event: push
publish-agent:
group: bundle
image: plugins/docker
repo: woodpeckerci/woodpecker-agent
dockerfile: docker/Dockerfile.agent
secrets: [docker_username, docker_password]
# TODO: only release as next after 0.15.0 got released
tag: [next, latest]
when:
branch: master
event: push
publish-agent-alpine:
group: bundle
image: plugins/docker
repo: woodpeckerci/woodpecker-agent
dockerfile: docker/Dockerfile.agent.alpine
secrets: [ docker_username, docker_password ]
# TODO: only release as next-alpine after 0.15.0 got released
tag: [next-alpine, latest-alpine]
when:
branch: master
event: push
publish-cli:
group: docker
image: plugins/docker
repo: woodpeckerci/woodpecker-cli
dockerfile: docker/Dockerfile.cli
secrets: [docker_username, docker_password]
tag: [next]
when:
branch: master
event: push
publish-cli-alpine:
group: docker
image: plugins/docker
repo: woodpeckerci/woodpecker-cli
dockerfile: docker/Dockerfile.cli.alpine
secrets: [ docker_username, docker_password ]
tag: [next-alpine]
when:
branch: master
event: push
release-server:
group: bundle
image: plugins/docker
repo: woodpeckerci/woodpecker-server
dockerfile: docker/Dockerfile.server
secrets: [docker_username, docker_password]
tag: [latest, "${CI_COMMIT_TAG}"]
when:
event: tag
release-server-alpine:
group: bundle
image: plugins/docker
repo: woodpeckerci/woodpecker-server
dockerfile: docker/Dockerfile.server.alpine
secrets: [ docker_username, docker_password ]
tag: [latest-alpine, "${CI_COMMIT_TAG}-alpine"]
when:
event: tag
release-agent:
group: bundle
image: plugins/docker
repo: woodpeckerci/woodpecker-agent
dockerfile: docker/Dockerfile.agent
secrets: [docker_username, docker_password]
tag: [latest, "${CI_COMMIT_TAG}"]
when:
event: tag
release-agent-alpine:
group: bundle
image: plugins/docker
repo: woodpeckerci/woodpecker-agent
dockerfile: docker/Dockerfile.agent.alpine
secrets: [ docker_username, docker_password ]
tag: [latest-alpine, "${CI_COMMIT_TAG}-alpine"]
when:
event: tag
release-cli:
group: docker
image: plugins/docker
repo: woodpeckerci/woodpecker-cli
dockerfile: docker/Dockerfile.cli
secrets: [docker_username, docker_password]
tag: [latest, "${CI_COMMIT_TAG}"]
when:
event: tag
release-cli-alpine:
group: docker
image: plugins/docker
repo: woodpeckerci/woodpecker-cli
dockerfile: docker/Dockerfile.cli.alpine
secrets: [ docker_username, docker_password ]
tag: [latest-alpine, "${CI_COMMIT_TAG}-alpine"]
when:
event: tag
checksums:
image: golang:1.16
commands:
- make release-checksums
when:
event: tag
# TODO: upload build artifacts for pushes to master
release:
image: plugins/github-release
files:
- dist/*.tar.gz
- dist/*.deb
- dist/*.rpm
- dist/checksums.txt
title: ${CI_COMMIT_TAG##v}
secrets:
- source: github_token
target: github_release_api_key
when:
event: tag
services:
postgres:
image: postgres:9.6
ports: ["5432"]
environment:
- POSTGRES_USER=postgres
- POSTGRES_HOST_AUTH_METHOD=trust
mysql:
image: mysql:5.6.27
ports: ["3306"]
environment:
- MYSQL_DATABASE=test
- MYSQL_ALLOW_EMPTY_PASSWORD=yes