woodpecker/.woodpecker/main.yml
Lukas c28f7cb29f
Add golangci-lint (#502)
Initial part of #435
2021-11-14 21:01:54 +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, "${DRONE_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, "${DRONE_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, "${DRONE_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, "${DRONE_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, "${DRONE_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, "${DRONE_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: ${DRONE_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