mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-24 10:07:21 +02:00
Enable go vet for ci (#230)
* enable go vet for ci * fix vet issues * move `./.cli.sh` into `make release-cli`
This commit is contained in:
parent
b52ef5f270
commit
d40a4a4b32
23
.cli.sh
23
.cli.sh
@ -1,23 +0,0 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
set -x
|
||||
|
||||
# disable CGO for cross-compiling
|
||||
export CGO_ENABLED=0
|
||||
|
||||
# compile for all architectures
|
||||
GOOS=linux GOARCH=amd64 go build -ldflags "-X main.version=${DRONE_TAG##v}" -o cli/release/linux/amd64/woodpecker github.com/woodpecker-ci/woodpecker/cli/drone
|
||||
GOOS=linux GOARCH=arm64 go build -ldflags "-X main.version=${DRONE_TAG##v}" -o cli/release/linux/arm64/woodpecker github.com/woodpecker-ci/woodpecker/cli/drone
|
||||
GOOS=linux GOARCH=arm go build -ldflags "-X main.version=${DRONE_TAG##v}" -o cli/release/linux/arm/woodpecker github.com/woodpecker-ci/woodpecker/cli/drone
|
||||
GOOS=windows GOARCH=amd64 go build -ldflags "-X main.version=${DRONE_TAG##v}" -o cli/release/windows/amd64/woodpecker github.com/woodpecker-ci/woodpecker/cli/drone
|
||||
GOOS=darwin GOARCH=amd64 go build -ldflags "-X main.version=${DRONE_TAG##v}" -o cli/release/darwin/amd64/woodpecker github.com/woodpecker-ci/woodpecker/cli/drone
|
||||
|
||||
# tar binary files prior to upload
|
||||
tar -cvzf cli/release/woodpecker_linux_amd64.tar.gz -C cli/release/linux/amd64 woodpecker
|
||||
tar -cvzf cli/release/woodpecker_linux_arm64.tar.gz -C cli/release/linux/arm64 woodpecker
|
||||
tar -cvzf cli/release/woodpecker_linux_arm.tar.gz -C cli/release/linux/arm woodpecker
|
||||
tar -cvzf cli/release/woodpecker_windows_amd64.tar.gz -C cli/release/windows/amd64 woodpecker
|
||||
tar -cvzf cli/release/woodpecker_darwin_amd64.tar.gz -C cli/release/darwin/amd64 woodpecker
|
||||
|
||||
# generate shas for tar files
|
||||
sha256sum cli/release/*.tar.gz > cli/release/woodpecker_checksums.txt
|
@ -9,6 +9,7 @@ pipeline:
|
||||
commands:
|
||||
- make deps
|
||||
- make test
|
||||
- make vet
|
||||
- make formatcheck
|
||||
|
||||
test-frontend:
|
||||
@ -64,7 +65,7 @@ pipeline:
|
||||
|
||||
build-cli:
|
||||
image: golang:1.16
|
||||
commands: sh .cli.sh
|
||||
commands: make release-cli
|
||||
|
||||
publish-server:
|
||||
image: plugins/docker
|
||||
|
18
Makefile
18
Makefile
@ -79,6 +79,24 @@ release-agent:
|
||||
release-server:
|
||||
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags '${LDFLAGS}' -o release/drone-server github.com/woodpecker-ci/woodpecker/cmd/drone-server
|
||||
|
||||
release-cli:
|
||||
# disable CGO for cross-compiling
|
||||
export CGO_ENABLED=0
|
||||
# compile for all architectures
|
||||
GOOS=linux GOARCH=amd64 go build -ldflags "-X main.version=${DRONE_TAG##v}" -o cli/release/linux/amd64/woodpecker github.com/woodpecker-ci/woodpecker/cli/drone
|
||||
GOOS=linux GOARCH=arm64 go build -ldflags "-X main.version=${DRONE_TAG##v}" -o cli/release/linux/arm64/woodpecker github.com/woodpecker-ci/woodpecker/cli/drone
|
||||
GOOS=linux GOARCH=arm go build -ldflags "-X main.version=${DRONE_TAG##v}" -o cli/release/linux/arm/woodpecker github.com/woodpecker-ci/woodpecker/cli/drone
|
||||
GOOS=windows GOARCH=amd64 go build -ldflags "-X main.version=${DRONE_TAG##v}" -o cli/release/windows/amd64/woodpecker github.com/woodpecker-ci/woodpecker/cli/drone
|
||||
GOOS=darwin GOARCH=amd64 go build -ldflags "-X main.version=${DRONE_TAG##v}" -o cli/release/darwin/amd64/woodpecker github.com/woodpecker-ci/woodpecker/cli/drone
|
||||
# tar binary files prior to upload
|
||||
tar -cvzf cli/release/woodpecker_linux_amd64.tar.gz -C cli/release/linux/amd64 woodpecker
|
||||
tar -cvzf cli/release/woodpecker_linux_arm64.tar.gz -C cli/release/linux/arm64 woodpecker
|
||||
tar -cvzf cli/release/woodpecker_linux_arm.tar.gz -C cli/release/linux/arm woodpecker
|
||||
tar -cvzf cli/release/woodpecker_windows_amd64.tar.gz -C cli/release/windows/amd64 woodpecker
|
||||
tar -cvzf cli/release/woodpecker_darwin_amd64.tar.gz -C cli/release/darwin/amd64 woodpecker
|
||||
# generate shas for tar files
|
||||
sha256sum cli/release/*.tar.gz > cli/release/woodpecker_checksums.txt
|
||||
|
||||
release: release-agent release-server
|
||||
|
||||
install:
|
||||
|
@ -58,6 +58,4 @@ func (c *healthClient) Check(ctx context.Context) (bool, error) {
|
||||
}
|
||||
<-time.After(backoff)
|
||||
}
|
||||
|
||||
return true, nil
|
||||
}
|
||||
|
@ -145,9 +145,9 @@ func Test_parse(t *testing.T) {
|
||||
|
||||
g.It("Should return a Perm struct from a Gogs Perm", func() {
|
||||
perms := []gogs.Permission{
|
||||
{true, true, true},
|
||||
{true, true, false},
|
||||
{true, false, false},
|
||||
{Admin: true, Pull: true, Push: true},
|
||||
{Admin: true, Pull: true, Push: false},
|
||||
{Admin: true, Push: false, Pull: false},
|
||||
}
|
||||
for _, from := range perms {
|
||||
perm := toPerm(from)
|
||||
|
Loading…
Reference in New Issue
Block a user