This repository has been archived by the owner on Jan 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Orderfile.yml
85 lines (75 loc) · 2.57 KB
/
Orderfile.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
version: "0.1.0"
orders:
build:
description: "build order binary into ./bin/ directory"
script:
- "go build -o ./bin/order ."
setup-dev:
description: "setup development tools"
script:
# install dependencies
- "go get -v -t -d ./..."
# setup golangci-lint
- "curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh"
# get goimports
- "go get golang.org/x/tools/cmd/goimports"
precommit:
description: |-
run all necessary precommit checks:
- goimports (fix-in-place)
- gofmt (fix-in-place)
- golangci-lint (with .golangci.yml config)
- go mod tidy & verify
- run unit tests
script:
- "goimports -e -w ."
- "gofmt -w -e -l -s ."
- "./bin/golangci-lint run"
- "go test ./... --cover"
- "go mod tidy -v"
- "go mod verify"
test:
description: "run go test with coverage report"
script:
- "go test -coverprofile=coverage.out ./..."
- "go tool cover -func=coverage.out"
- "rm coverage.out"
test-html:
description: "run go test with HTML coverage report"
script:
- "go test -coverprofile=coverage.out ./..."
- "go tool cover -html=coverage.out"
- "rm coverage.out"
setup-doc:
description: |-
setup documentation tools:
- hugo (into ./bin/ directory)
- hugo-theme-learn (git submodule)
script:
# Download hugo binary into ./bin/ directory
- |-
curl -Ls https://github.com/gohugoio/hugo/releases/latest/ \
| grep "hugo_.*_Linux-64bit.tar.gz" \
| grep "\".*hugo/releases/download/.*/hugo_extended_[^a-z]*_Linux-64bit.tar.gz\"" -o \
| xargs -I % curl -sSfL https://github.com% -o /tmp/hugo.tar.gz \
&& tar -C ./bin/ -zxvf /tmp/hugo.tar.gz hugo > /dev/null \
|| rm /tmp/hugo.tar.gz
# Update hugo-theme-learn git submodule
- "git submodule update --init --recursive"
build-docs:
description: "build project documentation"
script:
- "./bin/hugo --source=docs/source --destination=.."
serve-docs:
description: "serve project documentation locally"
script:
- "xdg-open http://localhost:1313/order >/dev/null"
- "./bin/hugo serve -s docs/source"
add-autocompletion:
script:
- "mkdir -p ~/.bash_completion.d"
- "cp scripts/autocompletion/order.bash ~/.bash_completion.d/order.bash"
- 'echo "source ~/.bash_completion.d/order.bash" >> ~/.bashrc'
rm-autocompletion:
script:
- "rm ~/.bash_completion.d/order.bash"