-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
68 lines (58 loc) · 2.33 KB
/
Taskfile.yml
File metadata and controls
68 lines (58 loc) · 2.33 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
# Install `task` from https://taskfile.dev
# Run `task --list` to start.
version: "3"
# Keep in sync with the values in .github/workflows
vars:
GOLANGCI_VERSION: v2.8.0
GOTESTSUM_VERSION: v1.13.0
tasks:
install:deps:
desc: Install tool dependencies.
cmds:
- go install github.com/golangci/golangci-lint/cmd/golangci-lint@{{.GOLANGCI_VERSION}}
- go install gotest.tools/gotestsum@{{.GOTESTSUM_VERSION}}
lint:
desc: Lint the code.
cmds:
- golangci-lint run ./...
build:
desc: Run go build
cmds:
- go build ./...
test:env:
desc: |
Run what is passed on the command-line with a shell environment containing the secrets needed for the integration tests.
Example: task test:env -- go test -count=1 -run 'TestFooIntegration' ./github"
cmds:
- '{{ .CLI_ARGS }}'
env: &test-env
GOKIT_TEST_COMMIT_SHA: '{{default "751affd155db7a00d936ee6e9f483deee69c5922" .GOKIT_TEST_COMMIT_SHA}}'
GOKIT_TEST_OAUTH_TOKEN:
sh: 'echo {{default "$(gopass show gokit/test_oauth_token)" .GOKIT_TEST_OAUTH_TOKEN}}'
GOKIT_TEST_REPO_NAME: '{{default "go-kit-test-read-write" .GOKIT_TEST_REPO_NAME}}'
GOKIT_TEST_REPO_OWNER: '{{default "pix4d" .GOKIT_TEST_REPO_OWNER}}'
GOKIT_TEST_GH_APP_CLIENT_ID: '{{default "Iv23lir9pyQlqmweDPbz" .GOKIT_TEST_GH_APP_CLIENT_ID}}'
GOKIT_TEST_GH_APP_INSTALLATION_ID: '{{default "64650729" .GOKIT_TEST_GH_APP_INSTALLATION_ID}}'
GOKIT_TEST_GH_APP_PRIVATE_KEY:
sh: 'echo "{{default "$(gopass show gokit/test_gh_app_private_key)" .GOKIT_TEST_GH_APP_PRIVATE_KEY}}"'
GOKIT_TEST_GCHAT_WEBHOOK:
sh: 'echo "{{default "$(gopass show gokit/test_gchat_webhook)" .GOKIT_TEST_GCHAT_WEBHOOK}}"'
test:unit:
desc: Run the unit tests.
cmds:
# One day I will understand how to use -coverpkg=./... :-(
- gotestsum -- -coverprofile=coverage.out -count=1 -skip=Integration ./...
test:all:
desc: Run all the tests (unit + integration). Use this target to get total coverage.
cmds:
- gotestsum -- -coverprofile=coverage.out -count=1 ./...
env: *test-env
browser:
desc: "Show code coverage in browser (usage: task test:<subtarget> browser)"
cmds:
- go tool cover -html=coverage.out
clean:
desc: Delete build artifacts
cmds:
- rm -f coverage.out
- rm -r -f bin