-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskfile.yml
105 lines (94 loc) · 3.12 KB
/
Taskfile.yml
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
# SPDX-License-Identifier: MIT
# https://taskfile.dev
version: '3'
includes:
dockle: tasks/DockleTasks.yml
git: tasks/GitTasks.yml
go: tasks/GoTasks.yml
golangcilint: tasks/GolangciLintTasks.yml
goreleaser: tasks/GoreleaserTasks.yml
licensed: tasks/LicensedTasks.yml
markdownlint: tasks/MarkdownlintTasks.yml
misc: tasks/MiscTasks.yml
trivy: tasks/TrivyTasks.yml
yamllint: tasks/YamllintTasks.yml
vars:
PROJECT_NAME: semver
PROJECT_OWNER: ffurrer2
BUILD_VERSION: {sh: bash ./scripts/version}
BUILD_VERSION_SHORT: {sh: bash ./scripts/version --short}
GIT_SHA: {sh: git rev-parse HEAD}
GIT_SHA_SHORT: {sh: git rev-parse --short HEAD}
GIT_TREE_STATE: {sh: 'if [[ -n "$(git status --porcelain)" ]]; then echo "dirty"; else echo "clean"; fi'}
tasks:
default:
cmds:
- task --list
silent: true
clean:
desc: Delete build artifacts
cmds:
- task: go:clean
silent: true
build:
desc: Build project
cmds:
- task: go:build
silent: true
test:
desc: Test project
cmds:
- task: go:test
- task: misc:container-structure-test
silent: true
lint:
desc: Run all linters
cmds:
- task: golangcilint:lint
- task: markdownlint:lint
- task: yamllint:lint
silent: true
scan:
desc: Run image scans
cmds:
- task: dockle:lint
vars:
IMAGE_NAME: 'ghcr.io/ffurrer2/semver:latest'
- task: trivy:image:scan
vars:
IMAGE_NAME: 'ghcr.io/ffurrer2/semver:latest'
- task: trivy:filesystem:scan
silent: true
fmt:
desc: Format code
cmds:
- task: go:mod:fmt
- task: go:gofumpt
- task: go:goimports
silent: true
upgrade:
desc: Upgrade dependencies
cmds:
- task: go:go-mod-upgrade
- task: go:upgrade-major-dependencies
- task: go:upgrade-indirect-dependencies
silent: true
version:
desc: Show versions
cmds:
- |
set -euo pipefail
printf 'container-structure-test: %s\n' "$(container-structure-test version)"
printf 'docker: %s\n' "$(docker version --format json | jq --raw-output '.Client.Version')"
printf 'dockle: %s\n' "$(dockle --version | cut -d ' ' -f 3)"
printf 'git: %s\n' "$(git --version | cut -d ' ' -f 3)"
printf 'go-mod-upgrade: %s\n' "$(go-mod-upgrade --version | tail -n 1 | cut -d ' ' -f 3 | cut -c 2-)"
printf 'go: %s\n' "$(go version | cut -d ' ' -f 3 | cut -c 3-)"
printf 'gofumpt: %s\n' "$(gofumpt --version | cut -c 1-)"
printf 'golangci-lint: %s\n' "$(golangci-lint version --format short)"
printf 'gomajor: %s\n' "$(gomajor version | cut -d ' ' -f 2 | cut -c 2-)"
printf 'goreleaser: %s\n' "$(goreleaser --version | grep 'GitVersion:' | awk '{print $2}')"
printf 'licensed: %s\n' "$(licensed version)"
printf 'task: %s\n' "$(task --version | cut -d ' ' -f 3 | cut -c 2-)"
printf 'trivy: %s\n' "$(trivy version --format json | jq --raw-output '.Version')"
silent: true