-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
Taskfile.yml
97 lines (87 loc) · 3.13 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
---
version: "3"
includes:
test: .taskfiles/test.yml
deps: .taskfiles/deps/Taskfile.yml
opentelemetry:
taskfile: ci/tests/tracing/Taskfile.yml
dir: ci/tests/tracing/
services:
taskfile: docker/services/Taskfile.yml
dir: docker/services/
coprocess:
taskfile: coprocess/Taskfile.yml
dir: coprocess/
config:
taskfile: config/Taskfile.yml
dir: config/
apidef-oas:
taskfile: apidef/oas/Taskfile.yml
dir: apidef/oas/
tasks:
docker:
desc: "build Tyk gateway internal/tyk-gateway"
cmds:
- docker build --platform "linux/amd64" --rm -t internal/tyk-gateway .
sources:
- go.mod
- go.sum
- "./**/*.go"
test:plugin-compiler:
desc: "Plugin compiler local build/test"
cmds:
- docker build --build-arg GO_VERSION=1.22 --build-arg BASE_IMAGE=tykio/golang-cross:1.22-bullseye --build-arg GITHUB_TAG=v5.1.0-alpha18 --build-arg GITHUB_SHA=$(git rev-parse HEAD) --platform=linux/amd64 --rm -t internal/plugin-compiler -f ci/images/plugin-compiler/Dockerfile .
- docker run -it -e GOARCH=arm64 -e GOOS=linux --rm -v $(readlink -f .)/ci/images/plugin-compiler/data/basic-plugin:/plugin-source internal/plugin-compiler basic-plugin.so
- docker run -it --rm -v $PWD:/go/src/github.com/TykTechnologies/tyk -w /go/src/github.com/TykTechnologies/tyk tykio/golang-cross:1.22-bullseye go build -trimpath -tags=goplugin .
- ./tyk plugin load -f ./ci/images/plugin-compiler/data/basic-plugin/basic-plugin*.so -s MyPluginPre
- docker rmi internal/plugin-compiler
test:goreleaser:
desc: "Test goreleaser locally"
vars:
pluginTemp: /tmp/plugin-compiler.extra_paths
cmds:
- go list ./... | perl -p -e 's/.+tyk\///g' | grep -v github | perl -p -e 's/\/.+//g' | sort | uniq > {{.pluginTemp}}
- echo -e "go.mod\ngo.sum\nmain.go\nci/images/plugin-compiler" >> {{.pluginTemp}}
- |
set -x
replacement=$(cat {{.pluginTemp}} | paste -sd , - | sed -e 's/,/","/g')
yq -i ".dockers[4].extra_files |= [\"$replacement\"]" ci/goreleaser/goreleaser-5.0.yml
yq -i ".dockers[0].extra_files |= [\"$replacement\"]" ci/goreleaser/goreleaser-el7.yml
yq -i ".dockers[4].extra_files |= [\"$replacement\"]" ci/goreleaser/goreleaser.yml
- echo goreleaser release --clean --snapshot -f ci/goreleaser/goreleaser.yml
# Used in CI
lint:
desc: "Tidy the codebase"
cmds:
- task: lint:tidy
- task: lint:all
lint:tidy:
desc: "Run typical code cleanup steps"
aliases: [fmt]
cmds:
- gofmt -w .
- go generate ./...
- go fmt ./...
- go mod tidy
- goimports -local github.com/TykTechnologies,github.com/TykTechnologies/tyk/internal -w .
- go mod tidy
lint:all:
internal: true
deps:
- lint:config
- lint:imports
- lint:x-tyk-gateway
- coprocess:lint
- apidef-oas:lint
lint:imports:
internal: true
cmds:
- go-fsck lint
lint:config:
internal: true
cmds:
- go test -count 1 -v ./cli/linter/...
lint:x-tyk-gateway:
internal: true
cmds:
- go test -count 1 -v -run=TestXTykGateway_Lint ./apidef/oas/