-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add github actions workflows (#3)
feat: add github actions workflows
- Loading branch information
Showing
12 changed files
with
425 additions
and
0 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,30 @@ | ||
{{ range .Versions }} | ||
<a name="{{ .Tag.Name }}"></a> | ||
## {{ if .Tag.Previous }}[{{ .Tag.Name }}]({{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}){{ else }}{{ .Tag.Name }}{{ end }} ({{ datetime "2006-01-02" .Tag.Date }}) | ||
|
||
{{ range .CommitGroups -}} | ||
### {{ .Title }} | ||
|
||
{{ range .Commits -}} | ||
* {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }} | ||
{{ end }} | ||
{{ end -}} | ||
|
||
{{- if .RevertCommits -}} | ||
### Reverts | ||
|
||
{{ range .RevertCommits -}} | ||
* {{ .Revert.Header }} | ||
{{ end }} | ||
{{ end -}} | ||
|
||
{{- if .NoteGroups -}} | ||
{{ range .NoteGroups -}} | ||
### {{ .Title }} | ||
|
||
{{ range .Notes }} | ||
{{ .Body }} | ||
{{ end }} | ||
{{ end -}} | ||
{{ end -}} | ||
{{ end -}} |
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,28 @@ | ||
style: github | ||
template: CHANGELOG.tpl.md | ||
info: | ||
title: CHANGELOG | ||
repository_url: https://github.com/go-vela/secret-vault | ||
options: | ||
commits: | ||
# filters: | ||
# Type: | ||
# - feat | ||
# - fix | ||
# - perf | ||
# - refactor | ||
commit_groups: | ||
# title_maps: | ||
# feat: Features | ||
# fix: Bug Fixes | ||
# perf: Performance Improvements | ||
# refactor: Code Refactoring | ||
header: | ||
pattern: "^(\\w*)(?:\\(([\\w\\$\\.\\-\\*\\s]*)\\))?\\:\\s(.*)$" | ||
pattern_maps: | ||
- Type | ||
- Scope | ||
- Subject | ||
notes: | ||
keywords: | ||
- BREAKING CHANGE |
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,21 @@ | ||
# name of the action | ||
name: build | ||
|
||
# trigger on pull_request or push events | ||
on: | ||
pull_request: | ||
push: | ||
|
||
# pipeline to execute | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: golang:latest | ||
steps: | ||
- name: clone | ||
uses: actions/checkout@v1 | ||
|
||
- name: build | ||
run: | | ||
make 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# name of the action | ||
name: prerelease | ||
|
||
# trigger on push events with `v*` in tag | ||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
# pipeline to execute | ||
jobs: | ||
prerelease: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: golang:latest | ||
steps: | ||
- name: clone | ||
uses: actions/checkout@v1 | ||
|
||
- name: build | ||
env: | ||
GOOS: linux | ||
CGO_ENABLED: '0' | ||
run: | | ||
go build -a \ | ||
-ldflags '-s -w -extldflags "-static"' \ | ||
-o release/secret-vault \ | ||
github.com/go-vela/secret-vault/cmd/secret-vault | ||
- name: publish | ||
uses: elgohr/Publish-Docker-Github-Action@master | ||
with: | ||
name: target/secret-vault | ||
cache: true | ||
tag_names: true | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} |
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 @@ | ||
# name of the action | ||
name: publish | ||
|
||
# trigger on push events with branch master | ||
on: | ||
push: | ||
branches: [ master ] | ||
|
||
# pipeline to execute | ||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: golang:latest | ||
steps: | ||
- name: clone | ||
uses: actions/checkout@v1 | ||
|
||
- name: build | ||
env: | ||
GOOS: linux | ||
CGO_ENABLED: '0' | ||
run: | | ||
go build -a \ | ||
-ldflags '-s -w -extldflags "-static"' \ | ||
-o release/secret-vault \ | ||
github.com/go-vela/secret-vault/cmd/secret-vault | ||
- name: publish | ||
uses: elgohr/Publish-Docker-Github-Action@master | ||
with: | ||
name: target/secret-vault | ||
cache: true | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} |
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,53 @@ | ||
# name of the action | ||
name: release | ||
|
||
# trigger on push events with `v*` in tag | ||
# ignore push events with `v*-rc*` in tag | ||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
- '!v*-rc*' | ||
|
||
# pipeline to execute | ||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: golang:latest | ||
steps: | ||
- name: clone | ||
uses: actions/checkout@v1 | ||
|
||
- name: tags | ||
run: | | ||
git fetch --tags | ||
- name: version | ||
id: version | ||
run: | | ||
echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/} | ||
- name: install | ||
run: | | ||
go get github.com/git-chglog/git-chglog/cmd/git-chglog | ||
go get github.com/github-release/github-release | ||
- name: changelog | ||
run: | | ||
# https://github.com/git-chglog/git-chglog#git-chglog | ||
$(go env GOPATH)/bin/git-chglog \ | ||
-o $GITHUB_WORKSPACE/CHANGELOG.md \ | ||
${{ steps.version.outputs.VERSION }} | ||
- name: release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
# https://github.com/github-release/github-release#how-to-use | ||
$(go env GOPATH)/bin/github-release edit \ | ||
--user go-vela \ | ||
--repo secret-vault \ | ||
--tag ${{ steps.version.outputs.VERSION }} \ | ||
--name ${{ steps.version.outputs.VERSION }} \ | ||
--description "$(cat $GITHUB_WORKSPACE/CHANGELOG.md)" |
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,41 @@ | ||
# name of the action | ||
name: reviewdog | ||
|
||
# trigger on pull_request events | ||
on: | ||
pull_request: | ||
|
||
# pipeline to execute | ||
jobs: | ||
diff-review: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: golang:latest | ||
steps: | ||
- name: clone | ||
uses: actions/checkout@v1 | ||
|
||
- name: golangci-lint | ||
uses: reviewdog/action-golangci-lint@v1 | ||
with: | ||
github_token: ${{ secrets.github_token }} | ||
golangci_lint_flags: "--config=.golangci.yml" | ||
fail_on_error: true | ||
filter_mode: diff_context | ||
reporter: github-pr-review | ||
|
||
full-review: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: golang:latest | ||
steps: | ||
- name: clone | ||
uses: actions/checkout@v1 | ||
|
||
- name: golangci-lint | ||
uses: reviewdog/action-golangci-lint@v1 | ||
with: | ||
github_token: ${{ secrets.github_token }} | ||
golangci_lint_flags: "--config=.golangci.yml" | ||
fail_on_error: false | ||
filter_mode: nofilter |
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,27 @@ | ||
# name of the action | ||
name: test | ||
|
||
# trigger on pull_request or push events | ||
on: | ||
pull_request: | ||
push: | ||
|
||
# pipeline to execute | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: golang:latest | ||
steps: | ||
- name: clone | ||
uses: actions/checkout@v1 | ||
|
||
- name: test | ||
run: | | ||
go test -race -covermode=atomic -coverprofile=coverage.out ./... | ||
- name: coverage | ||
uses: codecov/codecov-action@v1 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
file: coverage.out |
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,26 @@ | ||
# name of the action | ||
name: validate | ||
|
||
# trigger on pull_request or push events | ||
on: | ||
pull_request: | ||
push: | ||
|
||
# pipeline to execute | ||
jobs: | ||
validate: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: golang:latest | ||
steps: | ||
- name: clone | ||
uses: actions/checkout@v1 | ||
|
||
- name: validate | ||
run: | | ||
# Check that go mod tidy produces a zero diff; clean up any changes afterwards. | ||
go mod tidy && git diff --exit-code; code=$?; git checkout -- .; (exit $code) | ||
# Check that go vet ./... produces a zero diff; clean up any changes afterwards. | ||
go vet ./... && git diff --exit-code; code=$?; git checkout -- .; (exit $code) | ||
# Check that go fmt ./... produces a zero diff; clean up any changes afterwards. | ||
go fmt ./... && git diff --exit-code; code=$?; git checkout -- .; (exit $code) |
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,73 @@ | ||
# This is a manually created golangci.com yaml configuration with | ||
# some defaults explicitly provided. There is a large number of | ||
# linters we've enabled that are usually disabled by default. | ||
# | ||
# https://github.com/golangci/golangci-lint#config-file | ||
|
||
# This section provides the configuration for how golangci | ||
# outputs it results from the linters it executes. | ||
output: | ||
format: colored-line-number | ||
print-issued-lines: true | ||
print-linter-name: true | ||
|
||
# This section provides the configuration for which linters | ||
# golangci will execute. Several of them were disabled by | ||
# default but we've opted to enable them. | ||
linters: | ||
# disable all linters as new linters might be added to golangci | ||
disable-all: true | ||
enable: | ||
# linters enabled by default | ||
- deadcode | ||
- errcheck | ||
- govet | ||
- gosimple # a.k.a. megacheck | ||
- ineffassign | ||
- staticcheck | ||
- structcheck | ||
- typecheck | ||
- unused | ||
- varcheck | ||
|
||
# linters disabled by default | ||
- bodyclose | ||
- gocognit | ||
- goconst | ||
- gocyclo | ||
- goimports | ||
- gosec | ||
- funlen | ||
- maligned | ||
- misspell | ||
- stylecheck | ||
- unparam | ||
- whitespace | ||
- wsl | ||
|
||
# static list of linters we know golangci can run but we've | ||
# chosen to leave disabled for now | ||
# | ||
# disable: | ||
# - depguard | ||
# - dogsled | ||
# - dupl | ||
# - gocritic | ||
# - gochecknoinits | ||
# - gochecknoglobals | ||
# - godox | ||
# - gofmt | ||
# - golint | ||
# - gomnd | ||
# - interfacer | ||
# - lll | ||
# - nakedret | ||
# - scopelint | ||
# - unconvert | ||
|
||
# This section provides the configuration for each linter | ||
# we've instructed golangci to execute. | ||
linters-settings: | ||
funlen: | ||
lines: 100 | ||
statements: 60 |
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.