Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Yuvraj <evalsocket@users.noreply.github.com>
- Loading branch information
Yuvraj
committed
Jan 9, 2023
1 parent
a87ef1a
commit 0087a92
Showing
4 changed files
with
110 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Publish | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*" | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: '>=1.18.1' | ||
cache: true | ||
|
||
- name: Check quality | ||
run: make quality | ||
|
||
- name: Run tests | ||
run: make test | ||
|
||
- name: Release Binaries | ||
uses: goreleaser/goreleaser-action@v3 | ||
with: | ||
distribution: goreleaser | ||
version: latest | ||
args: release --rm-dist | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
before: | ||
hooks: | ||
- go mod tidy | ||
builds: | ||
- binary: rollback-buildkite-plugin | ||
env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- linux | ||
- darwin | ||
goarch: | ||
- "386" | ||
- amd64 | ||
- arm | ||
- arm64 | ||
- ppc64le | ||
|
||
checksum: | ||
name_template: 'checksums.txt' | ||
|
||
archives: | ||
- format: 'binary' | ||
name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}" | ||
files: | ||
- completions/* | ||
|
||
snapshot: | ||
name_template: "{{ incpatch .Version }}-next" | ||
|
||
changelog: | ||
sort: asc | ||
filters: | ||
exclude: | ||
- '^docs:' | ||
- '^test:' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,43 @@ | ||
all: test | ||
NAME=rollback-buildkite-plugin | ||
|
||
test: | ||
go test -timeout=3s -v ./... | ||
HAS_DOCKER=$(shell command -v docker;) | ||
HAS_GORELEASER=$(shell command -v goreleaser;) | ||
|
||
build: | ||
go build main.go | ||
.PHONY: all | ||
all: quality test | ||
|
||
.PHONY: test-go | ||
test-go: | ||
go test -race -coverprofile=coverage.out -covermode=atomic | ||
|
||
.PHONY: build-docker-test | ||
build-docker-test: | ||
ifneq (${HAS_DOCKER},) | ||
docker-compose build plugin_test | ||
endif | ||
|
||
.PHONY: test-docker | ||
test-docker: build-docker-test | ||
ifneq (${HAS_DOCKER},) | ||
docker-compose run --rm plugin_test | ||
endif | ||
|
||
.PHONY: all build test | ||
.PHONY: test | ||
test: test-go test-docker | ||
|
||
.PHONY: quality | ||
quality: | ||
go vet | ||
go fmt | ||
go mod tidy | ||
ifneq (${HAS_DOCKER},) | ||
docker-compose run --rm plugin_lint | ||
endif | ||
|
||
.PHONY: build | ||
build: | ||
ifneq (${HAS_GORELEASER},) | ||
goreleaser build --rm-dist --skip-validate | ||
else | ||
$(error goreleaser binary is missing, please install goreleaser) | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters