chore: update drone build flow

This commit is contained in:
Bo-Yi Wu 2022-06-15 22:24:28 +08:00
parent 2407d7a56b
commit 492a5db6ae
4 changed files with 35 additions and 59 deletions

View File

@ -7,7 +7,7 @@ platform:
steps:
- commands:
- make vet
image: golang:1.17
image: golang:1.18
name: vet
pull: always
volumes:
@ -15,26 +15,18 @@ steps:
path: /go
- commands:
- make lint
image: golang:1.17
image: golang:1.18
name: lint
pull: always
volumes:
- name: gopath
path: /go
- commands:
- make misspell-check
image: golang:1.17
name: misspell
pull: always
volumes:
- name: gopath
path: /go
- commands:
- apk add git make curl perl bash build-base zlib-dev ucl-dev
- make ssh-server
- make test
- make coverage
image: golang:1.17-alpine
image: golang:1.18-alpine
name: test
pull: always
volumes:
@ -62,7 +54,7 @@ steps:
- go build -v -ldflags '-X main.build=${DRONE_BUILD_NUMBER}' -a -o release/linux/amd64/drone-ssh
environment:
CGO_ENABLED: "0"
image: golang:1.17
image: golang:1.18
name: build-push
pull: always
when:
@ -74,7 +66,7 @@ steps:
-a -o release/linux/amd64/drone-ssh
environment:
CGO_ENABLED: "0"
image: golang:1.17
image: golang:1.18
name: build-tag
pull: always
when:
@ -82,7 +74,7 @@ steps:
- tag
- commands:
- ./release/linux/amd64/drone-ssh --help
image: golang:1.17
image: golang:1.18
name: executable
pull: always
- image: plugins/docker:linux-amd64
@ -134,7 +126,7 @@ steps:
- go build -v -ldflags '-X main.build=${DRONE_BUILD_NUMBER}' -a -o release/linux/arm64/drone-ssh
environment:
CGO_ENABLED: "0"
image: golang:1.17
image: golang:1.18
name: build-push
pull: always
when:
@ -146,7 +138,7 @@ steps:
-a -o release/linux/arm64/drone-ssh
environment:
CGO_ENABLED: "0"
image: golang:1.17
image: golang:1.18
name: build-tag
pull: always
when:
@ -154,7 +146,7 @@ steps:
- tag
- commands:
- ./release/linux/arm64/drone-ssh --help
image: golang:1.17
image: golang:1.18
name: executable
pull: always
- image: plugins/docker:linux-arm64
@ -206,7 +198,7 @@ steps:
- go build -v -ldflags '-X main.build=${DRONE_BUILD_NUMBER}' -a -o release/linux/arm/drone-ssh
environment:
CGO_ENABLED: "0"
image: golang:1.17
image: golang:1.18
name: build-push
pull: always
when:
@ -218,7 +210,7 @@ steps:
-a -o release/linux/arm/drone-ssh
environment:
CGO_ENABLED: "0"
image: golang:1.17
image: golang:1.18
name: build-tag
pull: always
when:
@ -226,7 +218,7 @@ steps:
- tag
- commands:
- ./release/linux/arm/drone-ssh --help
image: golang:1.17
image: golang:1.18
name: executable
pull: always
- image: plugins/docker:linux-arm
@ -276,7 +268,7 @@ platform:
steps:
- commands:
- make release
image: golang:1.17
image: golang:1.18
name: build-all-binary
pull: always
when:

View File

@ -38,24 +38,10 @@ vet:
lint:
@hash revive > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
$(GO) get -u github.com/mgechev/revive; \
$(GO) install github.com/mgechev/revive; \
fi
revive -config .revive.toml ./... || exit 1
.PHONY: misspell-check
misspell-check:
@hash misspell > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
$(GO) get -u github.com/client9/misspell/cmd/misspell; \
fi
misspell -error $(SOURCES)
.PHONY: misspell
misspell:
@hash misspell > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
$(GO) get -u github.com/client9/misspell/cmd/misspell; \
fi
misspell -w $(SOURCES)
.PHONY: fmt-check
fmt-check:
@hash gofumpt > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
@ -86,7 +72,7 @@ release-dirs:
release-build:
@which gox > /dev/null; if [ $$? -ne 0 ]; then \
$(GO) get -u github.com/mitchellh/gox; \
$(GO) install github.com/mitchellh/gox; \
fi
gox -os="$(TARGETS)" -arch="$(ARCHS)" -tags="$(TAGS)" -ldflags="-s -w $(LDFLAGS)" -output="$(DIST)/binaries/$(EXECUTABLE)-$(VERSION)-{{.OS}}-{{.Arch}}"

14
go.mod
View File

@ -1,6 +1,6 @@
module github.com/appleboy/drone-ssh
go 1.14
go 1.18
require (
github.com/appleboy/easyssh-proxy v1.3.7
@ -9,3 +9,15 @@ require (
github.com/urfave/cli v1.22.4
golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de
)
require (
github.com/ScaleFT/sshkeys v0.0.0-20181112160850-82451a803681 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d // indirect
github.com/davecgh/go-spew v1.1.0 // indirect
github.com/dchest/bcrypt_pbkdf v0.0.0-20150205184540-83f37f9c154a // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/russross/blackfriday/v2 v2.0.1 // indirect
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
golang.org/x/sys v0.0.0-20190412213103-97732733099d // indirect
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect
)

View File

@ -9,7 +9,7 @@
steps: [
{
name: 'vet',
image: 'golang:1.17',
image: 'golang:1.18',
pull: 'always',
commands: [
'make vet',
@ -23,7 +23,7 @@
},
{
name: 'lint',
image: 'golang:1.17',
image: 'golang:1.18',
pull: 'always',
commands: [
'make lint',
@ -35,23 +35,9 @@
},
],
},
{
name: 'misspell',
image: 'golang:1.17',
pull: 'always',
commands: [
'make misspell-check',
],
volumes: [
{
name: 'gopath',
path: '/go',
},
],
},
{
name: 'test',
image: 'golang:1.17-alpine',
image: 'golang:1.18-alpine',
pull: 'always',
commands: [
'apk add git make curl perl bash build-base zlib-dev ucl-dev',
@ -93,7 +79,7 @@
steps: [
{
name: 'build-push',
image: 'golang:1.17',
image: 'golang:1.18',
pull: 'always',
environment: {
CGO_ENABLED: '0',
@ -109,7 +95,7 @@
},
{
name: 'build-tag',
image: 'golang:1.17',
image: 'golang:1.18',
pull: 'always',
environment: {
CGO_ENABLED: '0',
@ -123,7 +109,7 @@
},
{
name: 'executable',
image: 'golang:1.17',
image: 'golang:1.18',
pull: 'always',
commands: [
'./release/' + os + '/' + arch + '/' + name + ' --help',
@ -188,7 +174,7 @@
steps: [
{
name: 'build-all-binary',
image: 'golang:1.17',
image: 'golang:1.18',
pull: 'always',
commands: [
'make release'