-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from Songmu/versioning
add version.go
- Loading branch information
Showing
8 changed files
with
98 additions
and
18 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,20 @@ | ||
name: release | ||
on: | ||
push: | ||
tags: | ||
- "v[0-9]+.[0-9]+.[0-9]+" | ||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: setup go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.x | ||
- name: checkout | ||
uses: actions/checkout@v2 | ||
- name: release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.github_token }} | ||
run: | | ||
make crossbuild upload |
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,13 @@ | ||
name: reviewdog | ||
on: [pull_request] | ||
jobs: | ||
staticcheck: | ||
name: staticcheck | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: reviewdog/action-staticcheck@v1 | ||
with: | ||
github_token: ${{ secrets.github_token }} | ||
reporter: github-pr-review | ||
fail_on_error: true |
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,32 @@ | ||
name: test | ||
on: | ||
push: | ||
branches: | ||
- "**" | ||
pull_request: {} | ||
jobs: | ||
test: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
- ubuntu-latest | ||
- macOS-latest | ||
- windows-latest | ||
steps: | ||
- name: setup go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.x | ||
- name: Set git to use LF | ||
run: | | ||
git config --global core.autocrlf false | ||
git config --global core.eol lf | ||
if: "matrix.os == 'windows-latest'" | ||
- name: checkout | ||
uses: actions/checkout@v2 | ||
- name: test | ||
run: go test -coverprofile coverage.out -covermode atomic ./... | ||
- name: Send coverage | ||
uses: codecov/codecov-action@v1 |
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,4 +1,5 @@ | ||
.* | ||
!.gitignore | ||
!.github | ||
bin/ | ||
secret.yaml |
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,34 +1,42 @@ | ||
VERSION = $(shell godzil show-version) | ||
CURRENT_REVISION = $(shell git rev-parse --short HEAD) | ||
BUILD_LDFLAGS = "-s -w -X github.com/Songmu/deglacer.revision=$(CURRENT_REVISION)" | ||
u := $(if $(update),-u) | ||
|
||
export GO111MODULE=on | ||
|
||
.PHONY: build | ||
build: deps | ||
go build -ldflags=$(BUILD_LDFLAGS) -o bin/deglacer ./cmd/deglacer | ||
|
||
.PHONY: deps | ||
deps: | ||
go get ${u} -d | ||
go mod tidy | ||
|
||
.PHONY: devel-deps | ||
devel-deps: | ||
sh -c '\ | ||
tmpdir=$$(mktemp -d); \ | ||
cd $$tmpdir; \ | ||
go get ${u} \ | ||
golang.org/x/lint/golint \ | ||
github.com/Songmu/godzil/cmd/godzil; \ | ||
rm -rf $$tmpdir' | ||
go install github.com/Songmu/godzil/cmd/godzil@latest | ||
go install github.com/tcnksm/ghr@latest | ||
|
||
.PHONY: test | ||
test: | ||
go test -race | ||
go test | ||
|
||
.PHONY: build | ||
build: | ||
go build -ldflags=$(BUILD_LDFLAGS) -o bin/deglacer ./cmd/deglacer | ||
|
||
.PHONY: lint | ||
lint: devel-deps | ||
golint -set_exit_status | ||
.PHONY: install | ||
install: | ||
go install -ldflags=$(BUILD_LDFLAGS) ./cmd/deglacer | ||
|
||
.PHONY: release | ||
release: devel-deps | ||
godzil release | ||
|
||
CREDITS: go.sum deps devel-deps | ||
godzil credits -w | ||
|
||
.PHONY: crossbuild | ||
crossbuild: CREDITS | ||
godzil crossbuild -pv=v$(VERSION) -build-ldflags=$(BUILD_LDFLAGS) \ | ||
-os=linux,darwin -d=./dist/v$(VERSION) ./cmd/* | ||
|
||
.PHONY: upload | ||
upload: | ||
ghr -body="$$(godzil changelog --latest -F markdown)" v$(VERSION) dist/v$(VERSION) |
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 @@ | ||
comment: false |
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
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,5 @@ | ||
package deglacer | ||
|
||
const version = "0.0.0" | ||
|
||
var revision = "HEAD" |