-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ci): add github actions to run CI + minor linter fixes (#287)
- Loading branch information
Showing
10 changed files
with
118 additions
and
31 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,22 @@ | ||
name: Go | ||
on: | ||
push: | ||
tags: | ||
branches: | ||
- master | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Build | ||
run: make build | ||
- name: Test | ||
run: make test | ||
- name: Shellcheck | ||
run: make shell | ||
- name: Lint | ||
run: make lint | ||
|
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 @@ | ||
run: | ||
skip-files: | ||
- ".*_test.go" | ||
|
||
linters: | ||
disable-all: true | ||
enable: | ||
- dupl | ||
- goconst | ||
- gocyclo | ||
- gofmt | ||
- gosec | ||
- ineffassign | ||
- misspell | ||
- nakedret | ||
- prealloc | ||
- revive | ||
- unconvert | ||
- unparam | ||
- unused | ||
- vet | ||
- gosec | ||
|
||
issues: | ||
exclude: | ||
- G404 | ||
- G114 |
This file was deleted.
Oops, something went wrong.
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,62 @@ | ||
.DEFAULT_GOAL := ci | ||
|
||
GOOS ?= linux | ||
GOARCH ?= amd64 | ||
|
||
out := target | ||
package_dir := $(out)/pkg | ||
cache := $(out)/.cache | ||
docker_dir := /home/do-agent | ||
shellscripts := $(shell find -type f -iname '*.sh' ! -path './repos/*' ! -path './vendor/*' ! -path './.git/*') | ||
go_version := $(shell sed -En 's/^go[[:space:]]+([[:digit:].]+)$$/\1/p' go.mod) | ||
print = @printf "\n:::::::::::::::: [$(shell date -u)] $@ ::::::::::::::::\n" | ||
|
||
go = \ | ||
docker run --rm -i \ | ||
-u "$(shell id -u):$(shell id -g)" \ | ||
-e "GOOS=$(GOOS)" \ | ||
-e "GOARCH=$(GOARCH)" \ | ||
-e "GO111MODULE=on" \ | ||
-e "GOFLAGS=-mod=vendor" \ | ||
-e "GOCACHE=$(docker_dir)/target/.cache/go" \ | ||
-v "$(CURDIR):$(docker_dir)" \ | ||
-w "$(docker_dir)" \ | ||
golang:$(go_version) \ | ||
go | ||
|
||
shellcheck = \ | ||
docker run --rm -i \ | ||
-u "$(shell id -u):$(shell id -g)" \ | ||
-v "$(CURDIR):$(docker_dir)" \ | ||
-w "$(docker_dir)" \ | ||
koalaman/shellcheck:v0.6.0 | ||
|
||
linter = \ | ||
docker run --rm -i \ | ||
-w "$(docker_dir)" \ | ||
-e "GO111MODULE=on" \ | ||
-e "GOFLAGS=-mod=vendor" \ | ||
-v "$(CURDIR):$(docker_dir)" \ | ||
golangci/golangci-lint:v1.50.1 | ||
|
||
clean: | ||
$(print) | ||
rm -rf ./target | ||
|
||
test: | ||
$(print) | ||
$(go) test -v ./... | ||
|
||
build: | ||
$(print) | ||
$(go) build -v ./... | ||
|
||
shell: | ||
$(print) | ||
$(shellcheck) $(shellscripts) | ||
|
||
lint: | ||
$(print) | ||
$(linter) golangci-lint run ./... | ||
|
||
ci: clean build test lint shell |
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
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