# config

config_hash: 9978aa99084dddf7c1aa76d8f7f5aaa6b51ac13562b9cfced2e64e240144e7d0
config_name: woodpecker/main
config_data:
  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 vet
        - make lint
        - make formatcheck

    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


config_hash: 48051e3480dc20a23bde84598506eac6a3701b23dfdf68f3a9cd3705b58fd906
config_name: woodpecker/main
config_data:
  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 vet
        - make lint
        - make formatcheck

    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_meddler

    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_meddler

    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


config_hash: ff733d9d6538809b31d1190bc4c2199dc5a50f1331e0e369b54ab0320d7d91d5
config_name: woodpecker/main
config_data:
  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 vet
        - make lint
        - make formatcheck

    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_xorm

    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_xorm

    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


config_hash: f5a8b930f73f21bc6718a2e4b1b3d44caa0ef85098459da78b53f8b204404bed
config_name: woodpecker/helm
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    set-version:
      image: alpine/helm:3.5.3
      commands:
        # use tag name or 0.0.0 if not running on a tag
        - export CHART_VERSION="${CI_COMMIT_TAG##v}"
        - export CHART_VERSION=$${CHART_VERSION:=0.0.0}
        - echo "Version $CHART_VERSION"
        - sed -i "s/<version>/$CHART_VERSION/g" charts/woodpecker-agent/Chart.yaml
        - sed -i "s/<version>/$CHART_VERSION/g" charts/woodpecker-server/Chart.yaml
        - cat charts/woodpecker-agent/Chart.yaml
        - cat charts/woodpecker-server/Chart.yaml
      when:
        path: "charts/**"

    lint:
      image: alpine/helm:3.5.3
      commands:
        - helm lint charts/woodpecker-agent/
        - helm lint charts/woodpecker-server/
      when:
        path: "charts/**"

    release:
      image: quay.io/helmpack/chart-releaser:v1.2.1
      secrets:
        - source: github_token
          target: CR_TOKEN
      commands:
        - mkdir -p .cr-index
        - cr package charts/woodpecker-server
        - cr package charts/woodpecker-agent
        - cr upload --owner woodpecker-ci --git-repo woodpecker-ci.github.io --release-name-template "helm-{{ .Name }}-{{ .Version }}"
        - cr index --owner woodpecker-ci --git-repo woodpecker-ci.github.io --pages-branch main --charts-repo https://woodpecker-ci.org --push --release-name-template "helm-{{ .Name }}-{{ .Version }}"
      when:
        event: tag
        path: "charts/**"


config_hash: 27ae38cfddf13877e35d26b3ac110070a30fcdeff596eefa4be2b12a33d1607d
config_name: woodpecker/main
config_data:
  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 vet
        - make lint
        - make formatcheck

    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


config_hash: 3421e34a1be6aeee4e3f1b6741d4a178ed5340700403f5117d3fe32e188d48bf
config_name: woodpecker/main
config_data:
  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


config_hash: 59fa65e9b406c908860579a7248071dd57d36fd531e5f14532221e2bacd2f2a0
config_name: woodpecker/main
config_data:
  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 vet
        - make lint
        - make formatcheck

    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]
      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]
      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]
      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]
      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


config_hash: 963b69c7279409c95c18deec4d90991947abb0795e7a865e5e2b7e77903213e5
config_name: woodpecker/main
config_data:
  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 vet
        - make lint
        - make formatcheck

    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]
      tag: [next]
      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 ]
      tag: [next-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]
      tag: [next]
      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 ]
      tag: [next-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


config_hash: 6525101ed9f35539b4b9ce533f12619059160f9fa184a2e8041dfbba4e9fe934
config_name: woodpecker/main
config_data:
  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


config_hash: 6025f4af3cae84be4986f3e924d72c16e6643c7b3783fb28b2b700006d998d6b
config_name: woodpecker
config_data:
  clone:
    git:
      image: woodpeckerci/plugin-git:next

  pipeline:
    lint:
      group: test
      image: golang:1.16
      commands:
        - make vet
        - make formatcheck

    test:
      group: test
      image: golang:1.16
      commands:
        - make test

    dryrun:
      image: thegeeklab/drone-docker-buildx:latest
      dockerfile: ./docker/Dockerfile.multiarch
      privileged: true
      dry_run: true
      repo: woodpeckerci/plugin-git
      platforms: linux/arm/v7,linux/arm64/v8,linux/amd64
      tags: latest
      secrets: [docker_username, docker_password]
      when:
        event: pull_request

    build-next:
      image: thegeeklab/drone-docker-buildx:latest
      dockerfile: ./docker/Dockerfile.multiarch
      privileged: true
      repo: woodpeckerci/plugin-git
      platforms: linux/arm/v7,linux/arm64/v8,linux/amd64
      tags: next
      secrets: [docker_username, docker_password]
      when:
        branch: master
        event: push

    build-tag:
      image: thegeeklab/drone-docker-buildx:latest
      dockerfile: ./docker/Dockerfile.multiarch
      privileged: true
      repo: woodpeckerci/plugin-git
      platforms: linux/arm/v7,linux/arm64/v8,linux/amd64
      tags: [latest, "${DRONE_TAG}"]
      secrets: [docker_username, docker_password]
      when:
        event: tag


config_hash: f6fc95307c1cdb8f162ccc215e325da79b243e246f2debc501509c93271f9e0e
config_name: woodpecker
config_data:
  clone:
    git:
      image: woodpeckerci/plugin-git:next

  pipeline:
    lint:
      group: test
      image: golang:1.16
      commands:
        - make vet
        - make formatcheck

    test:
      group: test
      image: golang:1.16
      commands:
        - make test

    dryrun:
      image: thegeeklab/drone-docker-buildx:latest
      dockerfile: ./docker/Dockerfile.multiarch
      privileged: true
      dry_run: true
      repo: woodpeckerci/plugin-git
      platforms: linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le
      tags: latest
      secrets: [docker_username, docker_password]
      when:
        event: pull_request

    build-next:
      image: thegeeklab/drone-docker-buildx:latest
      dockerfile: ./docker/Dockerfile.multiarch
      privileged: true
      repo: woodpeckerci/plugin-git
      platforms: linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le
      tags: next
      secrets: [docker_username, docker_password]
      when:
        branch: master
        event: push

    build-tag:
      image: thegeeklab/drone-docker-buildx:latest
      dockerfile: ./docker/Dockerfile.multiarch
      privileged: true
      repo: woodpeckerci/plugin-git
      platforms: linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le
      tags: [latest, "${DRONE_TAG}"]
      secrets: [docker_username, docker_password]
      when:
        event: tag


