forked from xordataexchange/crypt
-
Notifications
You must be signed in to change notification settings - Fork 27
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 #29 from bketelsen/goreleaser
Goreleaser
- Loading branch information
Showing
216 changed files
with
13,829 additions
and
4,107 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,83 @@ | ||
name: build and release | ||
|
||
on: | ||
push: | ||
tags: | ||
- v* | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
unit-tests: | ||
strategy: | ||
matrix: | ||
go-version: [ 1.16 ] | ||
os: [ ubuntu-latest, macos-latest, windows-latest ] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- | ||
name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
- | ||
name: Cache Go modules | ||
uses: actions/cache@v1 | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- | ||
name: Setup | ||
run: make setup | ||
- | ||
name: Make Unit Tests | ||
run: make test | ||
- | ||
name: Diff | ||
run: git diff | ||
goreleaser: | ||
strategy: | ||
matrix: | ||
go-version: [ 1.16 ] | ||
runs-on: ubuntu-latest | ||
if: startsWith(github.ref, 'refs/tags/') | ||
needs: | ||
- unit-tests | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
- name: Cache Go modules | ||
uses: actions/cache@v1 | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- name: Setup | ||
run: make setup | ||
- name: Make build | ||
run: make build | ||
|
||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v2 | ||
if: success() | ||
with: | ||
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 |
---|---|---|
|
@@ -29,3 +29,9 @@ _testmain.go | |
# Ignore JetBrains IDE Project Files | ||
.idea | ||
/crypt | ||
|
||
# goreleaser | ||
dist/ | ||
|
||
# coverage | ||
coverage.txt |
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,40 @@ | ||
project_name: crypt | ||
|
||
before: | ||
hooks: | ||
- go mod tidy | ||
|
||
builds: | ||
- id: crypt | ||
main: ./bin/crypt | ||
binary: crypt | ||
# Default is `-s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}} -X main.builtBy=goreleaser`. | ||
ldflags: | ||
- -s -w -X main.version={{ .Version }} -X main.commit={{ .Commit }} -X main.date={{ .CommitDate }} -X main.builtBy=goreleaser | ||
goos: | ||
- linux | ||
- darwin | ||
- windows | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
env: | ||
- GO111MODULE=on | ||
- MACOSX_DEPLOYMENT_TARGET=10.11 | ||
changelog: | ||
filters: | ||
exclude: | ||
- Merge | ||
archives: | ||
- replacements: | ||
darwin: Darwin | ||
linux: Linux | ||
windows: Windows | ||
386: i386 | ||
amd64: x86_64 | ||
format_overrides: | ||
- goos: windows | ||
format: zip | ||
files: | ||
- README.md | ||
- LICENSE |
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,61 @@ | ||
.PHONY: fmt | ||
SOURCE_FILES?=./... | ||
TEST_PATTERN?=. | ||
TEST_OPTIONS?= | ||
TEST_TIMEOUT?=15m | ||
TEST_PARALLEL?=2 | ||
DOCKER_BUILDKIT?=1 | ||
export DOCKER_BUILDKIT | ||
|
||
export GO111MODULE := on | ||
|
||
# Install all the build and lint dependencies | ||
setup: | ||
go mod tidy | ||
git config core.hooksPath .githooks | ||
.PHONY: setup | ||
|
||
test: | ||
go test $(TEST_OPTIONS) -p $(TEST_PARALLEL) -v -failfast -race -coverpkg=./... -covermode=atomic -coverprofile=coverage.txt $(SOURCE_FILES) -run $(TEST_PATTERN) -timeout=$(TEST_TIMEOUT) | ||
.PHONY: test | ||
|
||
cover: test | ||
go tool cover -html=coverage.txt | ||
.PHONY: cover | ||
|
||
fmt: | ||
gofmt -l -w `find . -type f -name '*.go' -not -path "./vendor/*"` | ||
goimports -l -w `find . -type f -name '*.go' -not -path "./vendor/*"` | ||
gofumpt -w backend | ||
gofumpt -w bin/crypt | ||
gofumpt -w config | ||
gofumpt -w encoding | ||
.PHONY: fmt | ||
|
||
|
||
ci: test | ||
.PHONY: ci | ||
|
||
build: | ||
go build -o crypt ./bin/crypt | ||
.PHONY: build | ||
|
||
install: | ||
go install ./bin/crypt | ||
|
||
deps: | ||
go get -u github.com/bketelsen/crypt/bin/crypt | ||
go mod tidy | ||
go mod verify | ||
go mod vendor | ||
.PHONY: deps | ||
|
||
todo: | ||
@grep \ | ||
--exclude-dir=vendor \ | ||
--exclude-dir=node_modules \ | ||
--exclude-dir=bin \ | ||
--exclude=Makefile \ | ||
--text \ | ||
--color \ | ||
-nRo -E ' TODO:.*|SkipNow' . | ||
.PHONY: todo | ||
|
||
.DEFAULT_GOAL := build |
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
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
Oops, something went wrong.