fix drone yaml format and switch to drone-matrix plugin (#13)

This commit is contained in:
Robert Kaussow 2021-09-19 20:42:10 +02:00 committed by GitHub
parent d797a814c4
commit da22381307
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 152 additions and 129 deletions

View File

@ -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' },
}, },

View File

@ -1,103 +1,114 @@
--- ---
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
image: golang:1.16
commands:
- go run honnef.co/go/tools/cmd/staticcheck ./... - go run honnef.co/go/tools/cmd/staticcheck ./...
image: golang:1.16
name: staticcheck
volumes: volumes:
- name: gopath - name: gopath
path: /go path: /go
- commands:
- name: lint
image: golang:1.16
commands:
- go run golang.org/x/lint/golint -set_exit_status ./... - go run golang.org/x/lint/golint -set_exit_status ./...
image: golang:1.16
name: lint
volumes: volumes:
- name: gopath - name: gopath
path: /go path: /go
- commands:
- name: vet
image: golang:1.16
commands:
- go vet ./... - go vet ./...
image: golang:1.16
name: vet
volumes: volumes:
- name: gopath - name: gopath
path: /go path: /go
- commands:
- name: test
image: golang:1.16
commands:
- go test -race -coverprofile=coverage.txt -covermode=atomic ./... - go test -race -coverprofile=coverage.txt -covermode=atomic ./...
image: golang:1.16
name: test
volumes: volumes:
- name: gopath - name: gopath
path: /go path: /go
- image: plugins/codecov
name: coverage - name: coverage
image: plugins/codecov
settings: settings:
files: files:
- coverage.txt - coverage.txt
token: token:
from_secret: codecov_token from_secret: codecov_token
volumes:
- name: gopath
temp: {}
image_pull_secrets:
- docker_config
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
commands:
- "[ -z \"${DRONE_TAG}\" ] && BUILD_VERSION=${DRONE_COMMIT_SHA:0:8} || BUILD_VERSION=${DRONE_TAG##v}"
- mkdir -p release/ - mkdir -p release/
- cd cmd/url-parser && xgo -ldflags "-s -w -X main.version=$BUILD_VERSION" -tags - 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 .
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:
- $(find release/ -executable -type f | grep url-parser-linux-amd64) --help
image: alpine image: alpine
name: executable commands:
- commands: - $(find release/ -executable -type f | grep url-parser-linux-amd64) --help
- name: compress
image: alpine
commands:
- apk add upx - apk add upx
- find release/ -maxdepth 1 -executable -type f -exec upx {} \; - find release/ -maxdepth 1 -executable -type f -exec upx {} \;
- ls -lh release/ - ls -lh release/
- name: checksum
image: alpine image: alpine
name: compress commands:
- commands:
- cd release/ && sha256sum * > sha256sum.txt - cd release/ && sha256sum * > sha256sum.txt
image: alpine
name: checksum - name: changelog-generate
- commands:
- git fetch -tq
- git-chglog --no-color --no-emoji -o CHANGELOG.md ${DRONE_TAG:---next-tag unreleased
unreleased}
image: thegeeklab/git-chglog image: thegeeklab/git-chglog
name: changelog-generate commands:
- 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 CHANGELOG.md
- prettier -w CHANGELOG.md - prettier -w CHANGELOG.md
image: thegeeklab/alpine-tools
name: changelog-format - name: publish
- image: plugins/github-release image: plugins/github-release
name: publish
settings: settings:
api_key: api_key:
from_secret: github_token from_secret: github_token
@ -109,24 +120,30 @@ steps:
when: when:
ref: ref:
- refs/tags/** - 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
@ -134,15 +151,17 @@ steps:
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:
{{ build.message }}'
username: username:
from_secret: matrix_username from_secret: matrix_username
when: when:
status: status:
- success - success
- failure - failure
image_pull_secrets:
- docker_config
trigger: trigger:
ref: ref:
- refs/heads/main - refs/heads/main
@ -150,8 +169,12 @@ trigger:
status: status:
- success - success
- failure - failure
depends_on:
- build-binaries
--- ---
kind: signature kind: signature
hmac: ee57fc59656c8ed6edddb3fd63aab7119702447bc8f6185cc4798a21dbac5f5e hmac: 0eb84b9566ce793a5df72fe1035db95dedf02132901e8e3d24dcf93fc7e864ca
... ...