url-parser/.drone.yml

181 lines
3.2 KiB
YAML
Raw Normal View History

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