url-parser/.drone.yml

158 lines
3.2 KiB
YAML
Raw Normal View History

2020-02-03 00:05:18 +01:00
---
2021-09-12 21:50:32 +02:00
image_pull_secrets:
- docker_config
2020-02-03 00:05:18 +01:00
kind: pipeline
2020-09-21 20:24:51 +02:00
name: test
2020-02-03 00:05:18 +01:00
platform:
arch: amd64
2021-09-12 21:50:32 +02:00
os: linux
2020-02-03 00:05:18 +01:00
steps:
2021-09-12 21:50:32 +02:00
- commands:
2020-09-21 20:24:51 +02:00
- go run honnef.co/go/tools/cmd/staticcheck ./...
2021-09-12 21:50:32 +02:00
image: golang:1.16
name: staticcheck
2020-09-21 20:24:51 +02:00
volumes:
- name: gopath
path: /go
2021-09-12 21:50:32 +02:00
- commands:
2020-09-21 20:24:51 +02:00
- go run golang.org/x/lint/golint -set_exit_status ./...
2021-09-12 21:50:32 +02:00
image: golang:1.16
name: lint
2020-09-21 20:24:51 +02:00
volumes:
- name: gopath
path: /go
2021-09-12 21:50:32 +02:00
- commands:
2020-02-03 00:05:18 +01:00
- go vet ./...
2021-09-12 21:50:32 +02:00
image: golang:1.16
name: vet
2020-09-21 20:24:51 +02:00
volumes:
- name: gopath
path: /go
2021-09-12 21:50:32 +02:00
- commands:
2020-02-03 12:44:19 +01:00
- go test -race -coverprofile=coverage.txt -covermode=atomic ./...
2021-09-12 21:50:32 +02:00
image: golang:1.16
name: test
2020-09-21 20:24:51 +02:00
volumes:
- name: gopath
path: /go
2021-09-12 21:50:32 +02:00
- image: plugins/codecov
name: coverage
2020-02-03 13:20:31 +01:00
settings:
files:
- coverage.txt
token:
from_secret: codecov_token
2020-02-03 00:05:18 +01:00
trigger:
ref:
- refs/heads/main
2020-02-03 00:05:18 +01:00
- refs/tags/**
- refs/pull/**
2021-09-12 21:50:32 +02:00
volumes:
- name: gopath
temp: {}
2020-02-03 00:05:18 +01:00
---
2021-09-12 21:50:32 +02:00
depends_on:
- test
image_pull_secrets:
- docker_config
2020-02-03 00:05:18 +01:00
kind: pipeline
name: build-binaries
platform:
arch: amd64
2021-09-12 21:50:32 +02:00
os: linux
2020-02-03 00:05:18 +01:00
steps:
2021-09-12 21:50:32 +02:00
- commands:
- '[ -z "${DRONE_TAG}" ] && BUILD_VERSION=${DRONE_COMMIT_SHA:0:8} || BUILD_VERSION=${DRONE_TAG##v}'
2020-02-03 00:05:18 +01:00
- mkdir -p release/
2021-09-12 21:50:32 +02:00
- cd cmd/url-parser && xgo -ldflags "-s -w -X main.version=$BUILD_VERSION" -tags
netgo -targets 'linux/amd64,linux/arm-6,linux/arm-7,linux/arm64' -out url-parser
.
2020-09-21 20:24:51 +02:00
- mv /build/* /drone/src/release/
2021-02-15 21:20:08 +01:00
- ls -l /drone/src/release/
2021-09-12 21:50:32 +02:00
image: techknowlogick/xgo:go-1.16.x
name: build
- commands:
2020-09-21 20:29:21 +02:00
- $(find release/ -executable -type f | grep url-parser-linux-amd64) --help
2020-02-03 01:33:15 +01:00
image: alpine
2021-09-12 21:50:32 +02:00
name: executable
- commands:
2020-02-03 01:33:15 +01:00
- apk add upx
- find release/ -maxdepth 1 -executable -type f -exec upx {} \;
- ls -lh release/
2020-02-03 00:05:18 +01:00
image: alpine
2021-09-12 21:50:32 +02:00
name: compress
- commands:
2020-02-03 00:05:18 +01:00
- cd release/ && sha256sum * > sha256sum.txt
2021-09-12 21:50:32 +02:00
image: alpine
name: checksum
- commands:
2021-02-15 21:18:08 +01:00
- git fetch -tq
2021-09-12 21:50:32 +02:00
- git-chglog --no-color --no-emoji -o CHANGELOG.md ${DRONE_TAG:---next-tag unreleased
unreleased}
image: thegeeklab/git-chglog
name: changelog-generate
- commands:
- prettier CHANGELOG.md
- prettier -w CHANGELOG.md
2021-09-12 21:50:32 +02:00
image: thegeeklab/alpine-tools
name: changelog-format
- image: plugins/github-release
name: publish
2020-02-03 00:05:18 +01:00
settings:
api_key:
from_secret: github_token
files:
- release/*
note: CHANGELOG.md
overwrite: true
title: ${DRONE_TAG}
when:
ref:
- refs/tags/**
trigger:
ref:
- refs/heads/main
2020-02-03 00:05:18 +01:00
- refs/tags/**
- refs/pull/**
---
2021-09-12 21:50:32 +02:00
depends_on:
- build-binaries
image_pull_secrets:
- docker_config
2020-02-03 00:05:18 +01:00
kind: pipeline
2020-09-21 20:24:51 +02:00
name: notifications
2020-02-03 00:05:18 +01:00
platform:
arch: amd64
2021-09-12 21:50:32 +02:00
os: linux
2020-02-03 00:05:18 +01:00
steps:
2021-09-12 21:50:32 +02:00
- image: plugins/matrix
name: matrix
2020-02-03 00:05:18 +01:00
settings:
homeserver:
from_secret: matrix_homeserver
password:
from_secret: matrix_password
roomid:
from_secret: matrix_roomid
2021-09-12 21:50:32 +02:00
template: 'Status: **{{ build.status }}**<br/> Build: [{{ repo.Owner }}/{{ repo.Name
}}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}<br/> Message:
{{ build.message }}'
2020-02-03 00:05:18 +01:00
username:
from_secret: matrix_username
2020-09-21 20:24:51 +02:00
when:
status:
- success
- failure
2020-02-03 00:05:18 +01:00
trigger:
ref:
- refs/heads/main
2020-02-03 00:05:18 +01:00
- refs/tags/**
status:
- success
- failure
---
kind: signature
2021-09-12 21:50:32 +02:00
hmac: ee57fc59656c8ed6edddb3fd63aab7119702447bc8f6185cc4798a21dbac5f5e
2020-02-03 00:05:18 +01:00
...