-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
106 lines (93 loc) · 2.72 KB
/
Taskfile.yml
File metadata and controls
106 lines (93 loc) · 2.72 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
# https://taskfile.dev/
version: '3'
env:
OPSLEVEL_GO_PKG: "github.com/opslevel/opslevel-go/v2024"
SRC_DIR: "{{.TASKFILE_DIR}}/src"
tasks:
ci:
desc: Workflow to run in CI
cmds:
- task: workspace
- task: lint
- task: test
lint:
desc: Formatting and linting
dir: "{{.SRC_DIR}}"
cmds:
- test -z "$(go tool gofumpt -d -e . | tee /dev/stderr)"
- go vet ./...
- go tool golangci-lint run
fix:
desc: Fix formatting and linting
dir: "{{.SRC_DIR}}"
cmds:
- task: update-opslevel-go
- go tool gofumpt -w .
- go mod tidy
- go tool golangci-lint run --fix
setup:
desc: Setup workspace for local development
cmds:
- task: workspace
test:
desc: Run tests
dir: "{{.SRC_DIR}}"
cmds:
- go test -race -coverprofile=coverage.txt -covermode=atomic -v ./... {{ .CLI_ARGS }}
silent: true
update-opslevel-go:
desc: Update opslevel-go version to latest release
dir: "{{.SRC_DIR}}"
cmds:
- go get -u {{.OPSLEVEL_GO_PKG}}
- go mod tidy
workspace:
desc: Setup workspace for cli & opslevel-go development
dir: "{{.SRC_DIR}}"
cmds:
- cmd: echo "Setting up opslevel-go workspace..."
silent: true
- go work init || exit 0
- go work use . submodules/opslevel-go
- cmd: echo "opslevel-go workspace ready!"
silent: true
start-faktory:
desc: Start Faktory and opslevel-runner in faktory mode
dir: "{{.SRC_DIR}}"
deps:
- install-faktory
cmds:
- go tool goreman start
# internal (not directly called) tasks
install-redis:
desc: install "redis-server"
internal: true
status:
- test -n "command -v redis-server"
cmds:
- brew install redis
install-faktory:
desc: install "faktory"
internal: true
deps:
- install-redis
status:
- test -n "command -v faktory"
vars:
GOARCH:
sh: go env GOARCH
EXPECTED_SHA256:
sh: |
case $(go env GOARCH) in
amd64) echo "c20fbf67cd54f2313a4180b0506ac96fbb66bfc8b9a39917f27246b41087f300" ;;
arm64) echo "edfaaa5242ec7702ad0eb14c6f388b25a77d1fb01d9ec9845332df50bead64f4" ;;
*) echo "unsupported arch: $(go env GOARCH)" >&2; exit 1 ;;
esac
cmds:
- mkdir -p ./faktory
- curl -sL https://github.com/contribsys/faktory/releases/download/v1.8.0/faktory-ent_1.8.0.macos.{{.GOARCH}}.tbz -o ./faktory/faktory-ent.osx.tbz
- echo "{{.EXPECTED_SHA256}} ./faktory/faktory-ent.osx.tbz" | shasum -a 256 -c -
- tar xjf ./faktory/faktory-ent.osx.tbz -C ./faktory
- mv ./faktory/faktory /usr/local/bin
- chmod +x /usr/local/bin/faktory
- rm -rf ./faktory