-
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.
chore(taskfile): add Taskfiles for project
- Loading branch information
Showing
4 changed files
with
167 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,20 @@ | ||
version: '3' | ||
|
||
vars: | ||
BUILD_TIME: | ||
sh: date -u +"%Y-%m-%dT%H:%M:%SZ" | ||
GIT_COMMIT: | ||
sh: git rev-parse --short HEAD || echo "unknown" | ||
GIT_TAG: | ||
sh: (git describe --abbrev=0 || echo "unknown") | sed "s/v//" | ||
|
||
includes: | ||
build: | ||
taskfile: ./tasks/build.yaml | ||
dir: ./src | ||
test: | ||
taskfile: ./tasks/test.yaml | ||
dir: ./src | ||
dist: | ||
taskfile: ./tasks/dist.yaml | ||
dir: ./dist |
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,101 @@ | ||
version: '3' | ||
|
||
vars: | ||
flag_buildTime: -X 'github.com/Icikowski/GoosyMock/meta.BuildTime={{ .BUILD_TIME }}' | ||
flag_version: -X 'github.com/Icikowski/GoosyMock/meta.Version={{ .GIT_TAG }}' | ||
flag_commit: -X 'github.com/Icikowski/GoosyMock/meta.GitCommit={{ .GIT_COMMIT }}' | ||
flag_buildType_dynamic: -X 'github.com/Icikowski/GoosyMock/meta.BinaryType=dynamic' | ||
flag_buildType_static: -X 'github.com/Icikowski/GoosyMock/meta.BinaryType=static' -w -extldflags '-static' | ||
flags_base: "{{ .flag_version }} {{ .flag_commit }} {{ .flag_buildTime }}" | ||
|
||
tasks: | ||
_parametrized_build: | ||
label: "{{ .goos | default OS }}_{{ .goarch | default ARCH }}" | ||
internal: true | ||
env: | ||
CGO_ENABLED: '{{ .cgo_enabled | default "1" }}' | ||
GOOS: "{{ .goos | default OS }}" | ||
GOARCH: "{{ .goarch | default ARCH }}" | ||
cmds: | ||
- go build -ldflags "{{ .flags_base }} {{ .flags_extra }}" -o ../target/goosymock_${GOOS}_${GOARCH}{{ .extension }} . | ||
sources: | ||
- "**/*.go" | ||
- go.mod | ||
- go.sum | ||
generates: | ||
- ../target/goosymock_{{ .goos | default OS }}_{{ .goarch | default ARCH }}{{ .extension }} | ||
dynamic: | ||
desc: Build a dynamic binary | ||
cmds: | ||
- task: _parametrized_build | ||
vars: | ||
flags_extra: "{{ .flag_buildType_dynamic }}" | ||
static: | ||
desc: Build a static binary | ||
cmds: | ||
- task: _parametrized_build | ||
vars: | ||
flags_extra: "{{ .flag_buildType_static }}" | ||
cgo_enabled: "0" | ||
crossplatform: | ||
desc: Build multiple binaries for different platforms | ||
cmds: | ||
- task: _parametrized_build | ||
vars: | ||
flags_extra: "{{ .flag_buildType_static }}" | ||
cgo_enabled: "0" | ||
goos: linux | ||
goarch: amd64 | ||
- task: _parametrized_build | ||
vars: | ||
flags_extra: "{{ .flag_buildType_static }}" | ||
cgo_enabled: "0" | ||
goos: linux | ||
goarch: "386" | ||
- task: _parametrized_build | ||
vars: | ||
flags_extra: "{{ .flag_buildType_static }}" | ||
cgo_enabled: "0" | ||
goos: linux | ||
goarch: arm | ||
- task: _parametrized_build | ||
vars: | ||
flags_extra: "{{ .flag_buildType_static }}" | ||
cgo_enabled: "0" | ||
goos: linux | ||
goarch: arm64 | ||
- task: _parametrized_build | ||
vars: | ||
flags_extra: "{{ .flag_buildType_static }}" | ||
cgo_enabled: "0" | ||
goos: linux | ||
goarch: ppc64le | ||
- task: _parametrized_build | ||
vars: | ||
flags_extra: "{{ .flag_buildType_static }}" | ||
cgo_enabled: "0" | ||
goos: darwin | ||
goarch: amd64 | ||
- task: _parametrized_build | ||
vars: | ||
flags_extra: "{{ .flag_buildType_static }}" | ||
cgo_enabled: "0" | ||
goos: darwin | ||
goarch: arm64 | ||
- task: _parametrized_build | ||
vars: | ||
flags_extra: "{{ .flag_buildType_static }}" | ||
cgo_enabled: "0" | ||
goos: windows | ||
goarch: amd64 | ||
extension: .exe | ||
- task: _parametrized_build | ||
vars: | ||
flags_extra: "{{ .flag_buildType_static }}" | ||
cgo_enabled: "0" | ||
goos: windows | ||
goarch: "386" | ||
extension: .exe | ||
|
||
|
||
|
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,11 @@ | ||
version: '3' | ||
|
||
vars: | ||
image_tag: ghcr.io/icikowski/goosymock:{{ .GIT_TAG }} | ||
|
||
tasks: | ||
image: | ||
desc: Build a Docker image | ||
dir: container | ||
cmds: | ||
- docker build ../../src --file Containerfile --tag {{ .image_tag }} --build-arg version={{ .GIT_TAG }} --build-arg gitCommit={{ .GIT_COMMIT }} --build-arg buildTime={{ .BUILD_TIME }} --label org.opencontainers.image.version={{ .GIT_TAG }} --label org.opencontainers.image.created={{ .BUILD_TIME }} |
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 @@ | ||
version: '3' | ||
|
||
tasks: | ||
standard: | ||
desc: Run tests with standard output verbosity | ||
aliases: | ||
- "std" | ||
cmds: | ||
- go test ./... -race -p 1 | ||
sources: | ||
- "**/*.go" | ||
- go.mod | ||
- go.sum | ||
full: | ||
desc: Run tests with increased output verbosity | ||
cmds: | ||
- go test ./... -race -p 1 -v | ||
sources: | ||
- "**/*.go" | ||
- go.mod | ||
- go.sum | ||
cover: | ||
desc: Run tests and build coverage report | ||
cmds: | ||
- mkdir -p ../target | ||
- go test ./... -race -p 1 -v -covermode atomic -coverprofile ../target/cover.out | ||
- go tool cover -html ../target/cover.out -o ../target/cover.html | ||
sources: | ||
- "**/*.go" | ||
- go.mod | ||
- go.sum | ||
generates: | ||
- ../target/cover.out | ||
- ../target/cover.html | ||
|