-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTaskfile.yml
More file actions
116 lines (104 loc) · 3.15 KB
/
Taskfile.yml
File metadata and controls
116 lines (104 loc) · 3.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
---
version: '3'
vars:
VERSION:
sh: git describe --tags --always --abbrev=8 | sed -E 's/^v//g'
# strip the 'v' prefix to match behaviour of goreleaser
COMMIT:
sh: git rev-parse --short HEAD
DATE:
sh: date --rfc-3339=seconds | sed 's/ /T/' | sed 's/+/Z/'
GOLANG_CODE_PATH: 'cmd/firmware-action'
includes:
containers:
taskfile: ./.dagger-ci/Taskfile.yml
dir: ./.dagger-ci
optional: true
examples:
taskfile: ./tests/Taskfile.yml
optional: true
vars:
VERSION: 'v{{.VERSION}}'
goreleaser:
taskfile: ./cmd/firmware-action/Taskfile.yml
dir: ./cmd/firmware-action/
optional: true
tasks:
build-go-binary:
desc: Template task to build a go binary
dir: '{{.GOLANG_CODE_PATH}}'
cmds:
- go build -ldflags="-s -w -X main.version={{.VERSION}} -X main.commit={{.COMMIT}} -X main.date={{.DATE}}" -o ../../bin/firmware-action-{{OS}}-{{ARCH}}-v{{.VERSION}}
- ln -sf ./firmware-action-{{OS}}-{{ARCH}}-v{{.VERSION}} ../../bin/firmware-action
env:
CGO_ENABLED: 0
sources:
- ./**/*.go
generates:
- ../../bin/firmware-action-{{OS}}-{{ARCH}}-v{{.VERSION}}
lint:
desc: Run the linters
dir: '{{.GOLANG_CODE_PATH}}'
cmds:
- revive ./...
- go vet ./...
- staticcheck -fail "" ./...
- golangci-lint run --issues-exit-code 0 ./...
format:
desc: Run gofumt (fork of gofmt, stricter)
cmds:
- gofumpt -w '{{.GOLANG_CODE_PATH}}'
test:
desc: Run tests
dir: '{{.GOLANG_CODE_PATH}}'
cmds:
- go test {{.CLI_ARGS}} -race -timeout 60m -shuffle=on -covermode=atomic -coverprofile coverage.out ./...
- go tool cover -func=coverage.out
- go tool cover -html=coverage.out -o coverage.html
godocs:
desc: Start godocs http server
dir: '{{.GOLANG_CODE_PATH}}'
cmds:
- godoc -http=:6060
build-mdbook:
desc: Build mdBook
dir: docs
cmds:
- mdbook build
- echo "Visit file://{{.USER_WORKING_DIR}}/docs/public/index.html"
build-mdbook-watch:
desc: Build mdBook with watch
dir: docs
cmds:
- mdbook watch
merge-json-configs:
desc: Merge all json configuration files in tests directory (for Docs purposes)
dir: tests
cmds:
- jq -s 'reduce .[] as $item ({}; . * $item)' example_config__*.json > example_config.json
- prettier -w example_config.json
check-list-supported-containers:
desc: Check that the list of supported containers in README is not missing any containers
deps:
- list-readme
- list-compose
cmds:
- comm -13 .list_readme.txt .list_compose.txt
list-readme:
desc: Update container list from README
internal: true
cmds:
- cat README.md | grep -E '\| (coreboot_|udk2017|edk2-stable2|linux_|uroot_|uboot_)' | sed -E 's/^\| //' | sed -E 's/ .*//g' | sort > .list_readme.txt
sources:
- README.md
generates:
- .list_readme.txt
list-compose:
desc: Update container list from docker compose
internal: true
cmds:
- go-task containers:build:list-available | sort > .list_compose.txt
sources:
- docker/compose.yaml
generates:
- .list_compose.txt