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

View File

@ -38,24 +38,10 @@ vet:
lint: lint:
@hash revive > /dev/null 2>&1; if [ $$? -ne 0 ]; then \ @hash revive > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
$(GO) get -u github.com/mgechev/revive; \ $(GO) install github.com/mgechev/revive; \
fi fi
revive -config .revive.toml ./... || exit 1 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 .PHONY: fmt-check
fmt-check: fmt-check:
@hash gofumpt > /dev/null 2>&1; if [ $$? -ne 0 ]; then \ @hash gofumpt > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
@ -86,7 +72,7 @@ release-dirs:
release-build: release-build:
@which gox > /dev/null; if [ $$? -ne 0 ]; then \ @which gox > /dev/null; if [ $$? -ne 0 ]; then \
$(GO) get -u github.com/mitchellh/gox; \ $(GO) install github.com/mitchellh/gox; \
fi fi
gox -os="$(TARGETS)" -arch="$(ARCHS)" -tags="$(TAGS)" -ldflags="-s -w $(LDFLAGS)" -output="$(DIST)/binaries/$(EXECUTABLE)-$(VERSION)-{{.OS}}-{{.Arch}}" 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 module github.com/appleboy/drone-ssh
go 1.14 go 1.18
require ( require (
github.com/appleboy/easyssh-proxy v1.3.7 github.com/appleboy/easyssh-proxy v1.3.7
@ -9,3 +9,15 @@ require (
github.com/urfave/cli v1.22.4 github.com/urfave/cli v1.22.4
golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de 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: [ steps: [
{ {
name: 'vet', name: 'vet',
image: 'golang:1.17', image: 'golang:1.18',
pull: 'always', pull: 'always',
commands: [ commands: [
'make vet', 'make vet',
@ -23,7 +23,7 @@
}, },
{ {
name: 'lint', name: 'lint',
image: 'golang:1.17', image: 'golang:1.18',
pull: 'always', pull: 'always',
commands: [ commands: [
'make lint', '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', name: 'test',
image: 'golang:1.17-alpine', image: 'golang:1.18-alpine',
pull: 'always', pull: 'always',
commands: [ commands: [
'apk add git make curl perl bash build-base zlib-dev ucl-dev', 'apk add git make curl perl bash build-base zlib-dev ucl-dev',
@ -93,7 +79,7 @@
steps: [ steps: [
{ {
name: 'build-push', name: 'build-push',
image: 'golang:1.17', image: 'golang:1.18',
pull: 'always', pull: 'always',
environment: { environment: {
CGO_ENABLED: '0', CGO_ENABLED: '0',
@ -109,7 +95,7 @@
}, },
{ {
name: 'build-tag', name: 'build-tag',
image: 'golang:1.17', image: 'golang:1.18',
pull: 'always', pull: 'always',
environment: { environment: {
CGO_ENABLED: '0', CGO_ENABLED: '0',
@ -123,7 +109,7 @@
}, },
{ {
name: 'executable', name: 'executable',
image: 'golang:1.17', image: 'golang:1.18',
pull: 'always', pull: 'always',
commands: [ commands: [
'./release/' + os + '/' + arch + '/' + name + ' --help', './release/' + os + '/' + arch + '/' + name + ' --help',
@ -188,7 +174,7 @@
steps: [ steps: [
{ {
name: 'build-all-binary', name: 'build-all-binary',
image: 'golang:1.17', image: 'golang:1.18',
pull: 'always', pull: 'always',
commands: [ commands: [
'make release' 'make release'