generated from hadenlabs/base-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tasks): implement task for packer (#2)
- Loading branch information
Showing
4 changed files
with
100 additions
and
4 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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
--- | ||
version: "3" | ||
|
||
tasks: | ||
|
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 |
---|---|---|
|
@@ -21,6 +21,12 @@ tasks: | |
- sh: command -v go | ||
msg: "Please Install Go" | ||
|
||
check:module: | ||
desc: Has Module | ||
preconditions: | ||
- sh: '[ -n "{{.MODULE}}" ]' | ||
msg: "Please add var environment module MODULE" | ||
|
||
check:gofmt: | ||
desc: Exist gofmt | ||
run: once | ||
|
@@ -91,13 +97,36 @@ tasks: | |
deps: | ||
- task: check:go | ||
|
||
mockery: | ||
desc: Refreshes the mock implementations in ./mocks. | ||
preconditions: | ||
- sh: which mockery | ||
msg: mockery is not installed. Please install it using the following command. | ||
|
||
$ go install github.com/vektra/mockery/[email protected] | ||
cmds: | ||
- mockery --config .ci/config/mockery.yaml | ||
|
||
generate: | ||
desc: "Generate code with Wire" | ||
cmds: | ||
- go get github.com/google/wire/cmd/wire | ||
- wire ./... | ||
|
||
test: | ||
desc: Run go test against code. | ||
run: once | ||
deps: | ||
- task: check:go | ||
cmds: | ||
- go test -v ./... -coverprofile cover.out -timeout 60m | ||
- go test -race -v ./... -coverprofile cover.out -timeout 60m | ||
|
||
test:module: | ||
desc: Run go test to module against code. | ||
deps: | ||
- task: check:go | ||
- task: check:module | ||
cmds: | ||
- go test -race -v ./modules/{{ .MODULE }}/... -coverprofile cover.out -timeout 60m | ||
|
||
build: | ||
desc: Build go packages. | ||
|
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,66 @@ | ||
version: "3" | ||
|
||
tasks: | ||
check: | ||
desc: Exist packer and dependences | ||
run: once | ||
deps: | ||
- task: check:packer | ||
|
||
check:packer: | ||
desc: Exist packer | ||
run: once | ||
preconditions: | ||
- sh: command -v packer | ||
msg: "Please Install packer" | ||
|
||
command: | ||
desc: make command packer | ||
run: once | ||
deps: | ||
- task: check | ||
cmds: | ||
- cmd: packer {{.PACKER_COMMAND}} {{.PACKER_DIR}}/{{.REGION}}/arch/{{.ARCH}}/{{.IMAGE}} | ||
vars: | ||
REGION: us-east-1 | ||
ARCH: amd64 | ||
|
||
init: | ||
desc: make packer init | ||
run: once | ||
deps: | ||
- task: check | ||
cmds: | ||
- task: command | ||
vars: | ||
PACKER_COMMAND: init | ||
|
||
build: | ||
desc: make packer build | ||
run: once | ||
deps: | ||
- task: check | ||
cmds: | ||
- task: command | ||
vars: | ||
PACKER_COMMAND: build | ||
|
||
validate: | ||
desc: make packer validate | ||
run: once | ||
deps: | ||
- task: check | ||
cmds: | ||
- task: command | ||
vars: | ||
PACKER_COMMAND: validate | ||
|
||
fmt: | ||
desc: packer fmt | ||
run: once | ||
deps: | ||
- task: check | ||
cmds: | ||
- task: command | ||
vars: | ||
PACKER_COMMAND: fmt |
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