-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathTaskfile.yml
88 lines (72 loc) · 2.02 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
version: 3
vars:
VERSION: { sh: "git describe --tags --dirty --always" }
LDFLAGS: -ldflags "-X main.version={{.VERSION}}"
GITHUB_TOKEN: { sh: "echo $GITHUB_TOKEN" }
PATH: { sh: "pwd" }
tasks:
# Default task should clean up and build a static version of sampctl
default:
deps: ["clean", "static"]
# Build static version of sampctl
static:
cmds:
- CGO_ENABLED=0 GOOS=linux go build -a {{.LDFLAGS}} -o sampctl .
# Build a fast non static version
fast:
cmds:
- go build {{.LDFLAGS}} -o sampctl
# Install sampctl into the go bin folder
install:
cmds:
- go install {{.LDFLAGS}}
# Remove sampctl binary
clean:
cmds:
- rm -f ./sampctl
# Run go test against source code
test:
cmds:
- go test --race -v ./...
# Releasing sampctl via goreleaser
# for osx tar fix
# https://github.com/goreleaser/goreleaser/issues/409
release:
cmds:
- <<
PATH="/usr/local/opt/gnu-tar/libexec/gnubin:{{.PATH}}"
GITHUB_TOKEN={{.GITHUB_TOKEN}}
goreleaser
--snapshot
--rm-dist
# Generating documentation via docgen
docs:
deps: ["fast"]
cmds:
- ./docgen.sh
# Building the sampctl docker image
docker:build:
cmds:
- docker build -t southclaws/sampctl:{{.VERSION}} .
# Building and pushing the sampctl docker image
docker:push:
deps: ["docker:build"]
cmds:
- docker push southclaws/sampctl:{{.VERSION}}
# Creates a docker enviornment with ubuntu to test sampctl functionality
env:ubuntu:
cmds:
- docker run -it -v{{.PATH}}:/sampctl ubuntu
# Creates a docker enviornment with centos to test sampctl functionality
env:centos:
cmds:
- docker run -it -v{{.PATH}}:/sampctl centos
earthly:test:
cmds:
- earthly --secret FULL_ACCESS_GITHUB_TOKEN +test
earthly:release:
cmds:
- earthly --secret GITHUB_TOKEN=$FULL_ACCESS_GITHUB_TOKEN +release
earthly:release-push:
cmds:
- earthly --secret GITHUB_TOKEN=$FULL_ACCESS_GITHUB_TOKEN +release-push