2020-02-02 23:05:18 +00:00
|
|
|
---
|
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
|
|
|
name: testing
|
|
|
|
|
|
|
|
platform:
|
|
|
|
os: linux
|
|
|
|
arch: amd64
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: vet
|
|
|
|
image: golang:1.12
|
|
|
|
commands:
|
|
|
|
- go vet ./...
|
|
|
|
|
|
|
|
- name: test
|
|
|
|
image: golang:1.12
|
|
|
|
commands:
|
2020-02-03 11:44:19 +00:00
|
|
|
- go test -race -coverprofile=coverage.txt -covermode=atomic ./...
|
2020-02-02 23:05:18 +00:00
|
|
|
|
|
|
|
trigger:
|
|
|
|
ref:
|
|
|
|
- refs/heads/master
|
|
|
|
- refs/tags/**
|
|
|
|
- refs/pull/**
|
|
|
|
|
|
|
|
---
|
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
|
|
|
name: build-binaries
|
|
|
|
|
|
|
|
platform:
|
|
|
|
os: linux
|
|
|
|
arch: amd64
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: build
|
|
|
|
image: techknowlogick/xgo:latest
|
|
|
|
commands:
|
|
|
|
- "[ -z \"${DRONE_TAG}\" ] && BUILD_VERSION=${DRONE_COMMIT_SHA:0:8} || BUILD_VERSION=${DRONE_TAG##v}"
|
|
|
|
- mkdir -p release/
|
2020-02-03 00:22:38 +00:00
|
|
|
- cd cmd/url-parser && xgo -ldflags "-s -w -X main.Version=$BUILD_VERSION" -tags netgo -targets 'linux/amd64,linux/arm-6,linux/arm64' -out url-parser-$BUILD_VERSION .
|
2020-02-02 23:35:33 +00:00
|
|
|
- cp /build/* /drone/src/release/
|
2020-02-02 23:05:18 +00:00
|
|
|
|
|
|
|
- name: executable
|
2020-02-03 00:01:51 +00:00
|
|
|
image: alpine
|
2020-02-02 23:05:18 +00:00
|
|
|
commands:
|
2020-02-03 00:01:51 +00:00
|
|
|
- $(find release/ -executable -type f | grep url-parser-.*-linux-amd64) --help
|
2020-02-02 23:05:18 +00:00
|
|
|
|
2020-02-03 00:33:15 +00:00
|
|
|
- name: compress
|
|
|
|
image: alpine
|
|
|
|
commands:
|
|
|
|
- apk add upx
|
|
|
|
- find release/ -maxdepth 1 -executable -type f -exec upx {} \;
|
|
|
|
- ls -lh release/
|
|
|
|
|
2020-02-02 23:05:18 +00:00
|
|
|
- name: checksum
|
|
|
|
image: alpine
|
|
|
|
commands:
|
|
|
|
- cd release/ && sha256sum * > sha256sum.txt
|
|
|
|
|
|
|
|
- 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/**
|
|
|
|
|
|
|
|
trigger:
|
|
|
|
ref:
|
|
|
|
- refs/heads/master
|
|
|
|
- refs/tags/**
|
|
|
|
- refs/pull/**
|
|
|
|
|
|
|
|
depends_on:
|
|
|
|
- testing
|
|
|
|
|
|
|
|
---
|
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
|
|
|
name: notification
|
|
|
|
|
|
|
|
platform:
|
|
|
|
os: linux
|
|
|
|
arch: amd64
|
|
|
|
|
|
|
|
steps:
|
2020-02-03 11:44:19 +00:00
|
|
|
- name: coverage
|
2020-02-03 11:58:14 +00:00
|
|
|
image: plugins/codecov
|
2020-02-03 11:44:19 +00:00
|
|
|
settings:
|
|
|
|
files:
|
|
|
|
- coverage.txt
|
|
|
|
token:
|
|
|
|
from_secret: codecov_token
|
|
|
|
when:
|
|
|
|
status:
|
|
|
|
- success
|
|
|
|
|
2020-02-02 23:05:18 +00:00
|
|
|
- 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-02-03 11:44:19 +00:00
|
|
|
when:
|
|
|
|
ref:
|
|
|
|
- refs/heads/master
|
|
|
|
- refs/tags/**
|
2020-02-02 23:05:18 +00:00
|
|
|
|
|
|
|
trigger:
|
|
|
|
ref:
|
|
|
|
- refs/heads/master
|
|
|
|
- refs/tags/**
|
2020-02-03 11:44:19 +00:00
|
|
|
- refs/pull/**
|
2020-02-02 23:05:18 +00:00
|
|
|
status:
|
|
|
|
- success
|
|
|
|
- failure
|
|
|
|
|
|
|
|
depends_on:
|
|
|
|
- build-binaries
|
|
|
|
|
|
|
|
---
|
|
|
|
kind: signature
|
2020-02-03 11:58:14 +00:00
|
|
|
hmac: e861eec40c380dc94525d15f454ec7df9dc941623435d9ccf1975fd8f90bd9c0
|
2020-02-02 23:05:18 +00:00
|
|
|
|
|
|
|
...
|