fix drone yaml format and switch to drone-matrix plugin (#13)
This commit is contained in:
parent
d797a814c4
commit
da22381307
|
@ -181,11 +181,11 @@ local PipelineNotifications = {
|
||||||
steps: [
|
steps: [
|
||||||
{
|
{
|
||||||
name: 'matrix',
|
name: 'matrix',
|
||||||
image: 'plugins/matrix',
|
image: 'thegeeklab/drone-matrix',
|
||||||
settings: {
|
settings: {
|
||||||
homeserver: { from_secret: 'matrix_homeserver' },
|
homeserver: { from_secret: 'matrix_homeserver' },
|
||||||
roomid: { from_secret: 'matrix_roomid' },
|
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 }}',
|
template: 'Status: **{{ build.Status }}**<br/> Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.Link }}) ({{ build.Branch }}) by {{ commit.Author }}<br/> Message: {{ commit.Message }}',
|
||||||
username: { from_secret: 'matrix_username' },
|
username: { from_secret: 'matrix_username' },
|
||||||
password: { from_secret: 'matrix_password' },
|
password: { from_secret: 'matrix_password' },
|
||||||
},
|
},
|
||||||
|
|
277
.drone.yml
277
.drone.yml
|
@ -1,157 +1,180 @@
|
||||||
---
|
---
|
||||||
image_pull_secrets:
|
|
||||||
- docker_config
|
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
name: test
|
name: test
|
||||||
|
|
||||||
platform:
|
platform:
|
||||||
arch: amd64
|
|
||||||
os: linux
|
os: linux
|
||||||
|
arch: amd64
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- commands:
|
- name: staticcheck
|
||||||
- go run honnef.co/go/tools/cmd/staticcheck ./...
|
image: golang:1.16
|
||||||
image: golang:1.16
|
commands:
|
||||||
name: staticcheck
|
- go run honnef.co/go/tools/cmd/staticcheck ./...
|
||||||
volumes:
|
volumes:
|
||||||
|
- name: gopath
|
||||||
|
path: /go
|
||||||
|
|
||||||
|
- name: lint
|
||||||
|
image: golang:1.16
|
||||||
|
commands:
|
||||||
|
- go run golang.org/x/lint/golint -set_exit_status ./...
|
||||||
|
volumes:
|
||||||
|
- name: gopath
|
||||||
|
path: /go
|
||||||
|
|
||||||
|
- name: vet
|
||||||
|
image: golang:1.16
|
||||||
|
commands:
|
||||||
|
- go vet ./...
|
||||||
|
volumes:
|
||||||
|
- name: gopath
|
||||||
|
path: /go
|
||||||
|
|
||||||
|
- name: test
|
||||||
|
image: golang:1.16
|
||||||
|
commands:
|
||||||
|
- go test -race -coverprofile=coverage.txt -covermode=atomic ./...
|
||||||
|
volumes:
|
||||||
|
- name: gopath
|
||||||
|
path: /go
|
||||||
|
|
||||||
|
- name: coverage
|
||||||
|
image: plugins/codecov
|
||||||
|
settings:
|
||||||
|
files:
|
||||||
|
- coverage.txt
|
||||||
|
token:
|
||||||
|
from_secret: codecov_token
|
||||||
|
|
||||||
|
volumes:
|
||||||
- name: gopath
|
- name: gopath
|
||||||
path: /go
|
temp: {}
|
||||||
- commands:
|
|
||||||
- go run golang.org/x/lint/golint -set_exit_status ./...
|
image_pull_secrets:
|
||||||
image: golang:1.16
|
- docker_config
|
||||||
name: lint
|
|
||||||
volumes:
|
|
||||||
- name: gopath
|
|
||||||
path: /go
|
|
||||||
- commands:
|
|
||||||
- go vet ./...
|
|
||||||
image: golang:1.16
|
|
||||||
name: vet
|
|
||||||
volumes:
|
|
||||||
- name: gopath
|
|
||||||
path: /go
|
|
||||||
- commands:
|
|
||||||
- go test -race -coverprofile=coverage.txt -covermode=atomic ./...
|
|
||||||
image: golang:1.16
|
|
||||||
name: test
|
|
||||||
volumes:
|
|
||||||
- name: gopath
|
|
||||||
path: /go
|
|
||||||
- image: plugins/codecov
|
|
||||||
name: coverage
|
|
||||||
settings:
|
|
||||||
files:
|
|
||||||
- coverage.txt
|
|
||||||
token:
|
|
||||||
from_secret: codecov_token
|
|
||||||
trigger:
|
trigger:
|
||||||
ref:
|
ref:
|
||||||
- refs/heads/main
|
- refs/heads/main
|
||||||
- refs/tags/**
|
- refs/tags/**
|
||||||
- refs/pull/**
|
- refs/pull/**
|
||||||
volumes:
|
|
||||||
- name: gopath
|
|
||||||
temp: {}
|
|
||||||
---
|
---
|
||||||
depends_on:
|
|
||||||
- test
|
|
||||||
image_pull_secrets:
|
|
||||||
- docker_config
|
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
name: build-binaries
|
name: build-binaries
|
||||||
|
|
||||||
platform:
|
platform:
|
||||||
arch: amd64
|
|
||||||
os: linux
|
os: linux
|
||||||
|
arch: amd64
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- commands:
|
- name: build
|
||||||
- '[ -z "${DRONE_TAG}" ] && BUILD_VERSION=${DRONE_COMMIT_SHA:0:8} || BUILD_VERSION=${DRONE_TAG##v}'
|
image: techknowlogick/xgo:go-1.16.x
|
||||||
- mkdir -p release/
|
commands:
|
||||||
- cd cmd/url-parser && xgo -ldflags "-s -w -X main.version=$BUILD_VERSION" -tags
|
- "[ -z \"${DRONE_TAG}\" ] && BUILD_VERSION=${DRONE_COMMIT_SHA:0:8} || BUILD_VERSION=${DRONE_TAG##v}"
|
||||||
netgo -targets 'linux/amd64,linux/arm-6,linux/arm-7,linux/arm64' -out url-parser
|
- mkdir -p release/
|
||||||
.
|
- 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 .
|
||||||
- mv /build/* /drone/src/release/
|
- mv /build/* /drone/src/release/
|
||||||
- ls -l /drone/src/release/
|
- ls -l /drone/src/release/
|
||||||
image: techknowlogick/xgo:go-1.16.x
|
|
||||||
name: build
|
- name: executable
|
||||||
- commands:
|
image: alpine
|
||||||
- $(find release/ -executable -type f | grep url-parser-linux-amd64) --help
|
commands:
|
||||||
image: alpine
|
- $(find release/ -executable -type f | grep url-parser-linux-amd64) --help
|
||||||
name: executable
|
|
||||||
- commands:
|
- name: compress
|
||||||
- apk add upx
|
image: alpine
|
||||||
- find release/ -maxdepth 1 -executable -type f -exec upx {} \;
|
commands:
|
||||||
- ls -lh release/
|
- apk add upx
|
||||||
image: alpine
|
- find release/ -maxdepth 1 -executable -type f -exec upx {} \;
|
||||||
name: compress
|
- ls -lh release/
|
||||||
- commands:
|
|
||||||
- cd release/ && sha256sum * > sha256sum.txt
|
- name: checksum
|
||||||
image: alpine
|
image: alpine
|
||||||
name: checksum
|
commands:
|
||||||
- commands:
|
- cd release/ && sha256sum * > sha256sum.txt
|
||||||
- git fetch -tq
|
|
||||||
- git-chglog --no-color --no-emoji -o CHANGELOG.md ${DRONE_TAG:---next-tag unreleased
|
- name: changelog-generate
|
||||||
unreleased}
|
image: thegeeklab/git-chglog
|
||||||
image: thegeeklab/git-chglog
|
commands:
|
||||||
name: changelog-generate
|
- git fetch -tq
|
||||||
- commands:
|
- git-chglog --no-color --no-emoji -o CHANGELOG.md ${DRONE_TAG:---next-tag unreleased unreleased}
|
||||||
- prettier CHANGELOG.md
|
|
||||||
- prettier -w CHANGELOG.md
|
- name: changelog-format
|
||||||
image: thegeeklab/alpine-tools
|
image: thegeeklab/alpine-tools
|
||||||
name: changelog-format
|
commands:
|
||||||
- image: plugins/github-release
|
- prettier CHANGELOG.md
|
||||||
name: publish
|
- prettier -w CHANGELOG.md
|
||||||
settings:
|
|
||||||
api_key:
|
- name: publish
|
||||||
from_secret: github_token
|
image: plugins/github-release
|
||||||
files:
|
settings:
|
||||||
- release/*
|
api_key:
|
||||||
note: CHANGELOG.md
|
from_secret: github_token
|
||||||
overwrite: true
|
files:
|
||||||
title: ${DRONE_TAG}
|
- release/*
|
||||||
when:
|
note: CHANGELOG.md
|
||||||
ref:
|
overwrite: true
|
||||||
- refs/tags/**
|
title: ${DRONE_TAG}
|
||||||
|
when:
|
||||||
|
ref:
|
||||||
|
- refs/tags/**
|
||||||
|
|
||||||
|
image_pull_secrets:
|
||||||
|
- docker_config
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
ref:
|
ref:
|
||||||
- refs/heads/main
|
- refs/heads/main
|
||||||
- refs/tags/**
|
- refs/tags/**
|
||||||
- refs/pull/**
|
- refs/pull/**
|
||||||
---
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- build-binaries
|
- test
|
||||||
image_pull_secrets:
|
|
||||||
- docker_config
|
---
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
name: notifications
|
name: notifications
|
||||||
|
|
||||||
platform:
|
platform:
|
||||||
arch: amd64
|
|
||||||
os: linux
|
os: linux
|
||||||
|
arch: amd64
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- image: plugins/matrix
|
- name: matrix
|
||||||
name: matrix
|
image: thegeeklab/drone-matrix
|
||||||
settings:
|
settings:
|
||||||
homeserver:
|
homeserver:
|
||||||
from_secret: matrix_homeserver
|
from_secret: matrix_homeserver
|
||||||
password:
|
password:
|
||||||
from_secret: matrix_password
|
from_secret: matrix_password
|
||||||
roomid:
|
roomid:
|
||||||
from_secret: matrix_roomid
|
from_secret: matrix_roomid
|
||||||
template: 'Status: **{{ build.status }}**<br/> Build: [{{ repo.Owner }}/{{ repo.Name
|
template: "Status: **{{ build.Status }}**<br/> Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.Link }}) ({{ build.Branch }}) by {{ commit.Author }}<br/> Message: {{ commit.Message }}"
|
||||||
}}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}<br/> Message:
|
username:
|
||||||
{{ build.message }}'
|
from_secret: matrix_username
|
||||||
username:
|
when:
|
||||||
from_secret: matrix_username
|
status:
|
||||||
when:
|
- success
|
||||||
status:
|
- failure
|
||||||
- success
|
|
||||||
- failure
|
image_pull_secrets:
|
||||||
|
- docker_config
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
ref:
|
ref:
|
||||||
- refs/heads/main
|
- refs/heads/main
|
||||||
- refs/tags/**
|
- refs/tags/**
|
||||||
status:
|
status:
|
||||||
- success
|
- success
|
||||||
- failure
|
- failure
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- build-binaries
|
||||||
|
|
||||||
---
|
---
|
||||||
kind: signature
|
kind: signature
|
||||||
hmac: ee57fc59656c8ed6edddb3fd63aab7119702447bc8f6185cc4798a21dbac5f5e
|
hmac: 0eb84b9566ce793a5df72fe1035db95dedf02132901e8e3d24dcf93fc7e864ca
|
||||||
|
|
||||||
...
|
...
|
||||||
|
|
Loading…
Reference in New Issue