Skip to content

Commit

Permalink
feat(tasks): implement task for packer (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
luismayta committed Dec 30, 2024
1 parent 1741079 commit ab0164b
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 4 deletions.
1 change: 1 addition & 0 deletions provision/task/docker.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
version: "3"

tasks:
Expand Down
33 changes: 31 additions & 2 deletions provision/task/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
66 changes: 66 additions & 0 deletions provision/task/packer.yml
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
4 changes: 2 additions & 2 deletions provision/task/python.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
version: "3"

tasks:
Expand Down Expand Up @@ -50,8 +51,7 @@ tasks:
desc: run pytest.
run: once
cmds:
- cmd: >-
poetry run pytest
- cmd: poetry run pytest -s

environment:
desc: Generate environment python.
Expand Down

0 comments on commit ab0164b

Please sign in to comment.