Skip to content

Commit d32b3e8

Browse files
committed
add Taskfile
1 parent 521a4b2 commit d32b3e8

File tree

1 file changed

+107
-0
lines changed

1 file changed

+107
-0
lines changed

Taskfile.yaml

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
version: 3
2+
3+
# vars: # cannot be specified here due to https://github.com/go-task/task/issues/2108
4+
# NESTED_MODULES: api
5+
# API_DIRS: '{{.ROOT_DIR}}/api/v1beta1/...'
6+
# MANIFEST_OUT: '{{.ROOT_DIR}}/api/crds/manifests'
7+
# CODE_DIRS: '{{.ROOT_DIR}}/cmd/... {{.ROOT_DIR}}/internal/... {{.ROOT_DIR}}/test/... {{.ROOT_DIR}}/api/v1beta1/...'
8+
# COMPONENTS: 'control-plane-operator'
9+
# REPO_URL: 'https://github.com/openmcp-project/control-plane-operator'
10+
# GENERATE_DOCS_INDEX: "true"
11+
12+
includes:
13+
shared:
14+
taskfile: hack/common/Taskfile_controller.yaml
15+
flatten: true
16+
excludes:
17+
- test
18+
- test-envtest-dep
19+
- build:bin:val:test
20+
- build-raw
21+
- build:bin:build-raw
22+
# put task names in here which are overwritten in this file
23+
vars:
24+
NESTED_MODULES: api
25+
API_DIRS: '{{.ROOT_DIR}}/api/v1beta1/...'
26+
MANIFEST_OUT: '{{.ROOT_DIR}}/api/crds/manifests'
27+
CODE_DIRS: '{{.ROOT_DIR}}/cmd/... {{.ROOT_DIR}}/internal/... {{.ROOT_DIR}}/test/... {{.ROOT_DIR}}/api/v1beta1/...'
28+
COMPONENTS: 'control-plane-operator'
29+
REPO_URL: 'https://github.com/openmcp-project/control-plane-operator'
30+
GENERATE_DOCS_INDEX: "true"
31+
ENVTEST_REQUIRED: "true"
32+
ENVTEST_K8S_VERSION: "1.30.0"
33+
common: # imported a second time so that overwriting task definitions can call the overwritten task with a 'c:' prefix
34+
taskfile: hack/common/Taskfile_controller.yaml
35+
internal: true
36+
aliases:
37+
- c
38+
vars:
39+
NESTED_MODULES: api
40+
API_DIRS: '{{.ROOT_DIR}}/api/v1beta1/...'
41+
MANIFEST_OUT: '{{.ROOT_DIR}}/api/crds/manifests'
42+
CODE_DIRS: '{{.ROOT_DIR}}/cmd/... {{.ROOT_DIR}}/internal/... {{.ROOT_DIR}}/test/... {{.ROOT_DIR}}/api/v1beta1/...'
43+
COMPONENTS: 'control-plane-operator'
44+
REPO_URL: 'https://github.com/openmcp-project/control-plane-operator'
45+
GENERATE_DOCS_INDEX: "true"
46+
ENVTEST_REQUIRED: "true"
47+
ENVTEST_K8S_VERSION: "1.30.0"
48+
49+
50+
# tasks:
51+
# build:bin:val:test:
52+
# desc: " Run all tests."
53+
# env:
54+
# ENVTEST_K8S_VERSION: "1.30.0"
55+
56+
# run: once
57+
# # requires:
58+
# # vars:
59+
# # - CODE_DIRS
60+
# deps:
61+
# - test-envtest-dep
62+
# cmds:
63+
# - 'PROJECT_ROOT="{{.ROOT_DIR2}}" NESTED_MODULES="{{.NESTED_MODULES}}" {{.TASKFILE_DIR2}}/run-tests.sh {{.CODE_DIRS}}'
64+
65+
tasks:
66+
test:
67+
desc: " Run all tests."
68+
run: once
69+
aliases:
70+
- build:bin:val:test
71+
vars:
72+
NESTED_MODULES: api
73+
API_DIRS: '{{.ROOT_DIR}}/api/v1beta1/...'
74+
MANIFEST_OUT: '{{.ROOT_DIR}}/api/crds/manifests'
75+
CODE_DIRS: '{{.ROOT_DIR}}/cmd/... {{.ROOT_DIR}}/internal/... {{.ROOT_DIR}}/test/... {{.ROOT_DIR}}/api/v1beta1/...'
76+
COMPONENTS: 'control-plane-operator'
77+
REPO_URL: 'https://github.com/openmcp-project/control-plane-operator'
78+
GENERATE_DOCS_INDEX: "true"
79+
ENVTEST_REQUIRED: "true"
80+
ENVTEST_K8S_VERSION: "1.30.0"
81+
deps:
82+
- test-envtest-dep
83+
cmds:
84+
- 'PROJECT_ROOT="{{.ROOT_DIR2}}" NESTED_MODULES="{{.NESTED_MODULES}}" ENVTEST_K8S_VERSION="{{.ENVTEST_K8S_VERSION}}" {{.TASKFILE_DIR2}}/run-tests.sh {{.CODE_DIRS}}'
85+
86+
test-envtest-dep:
87+
desc: " Install the envtest dependency, if marked as required."
88+
run: once
89+
status:
90+
- '[ "{{.ENVTEST_REQUIRED | default "false"}}" != "true" ]'
91+
cmds:
92+
- task: tools:envtest
93+
internal: true
94+
95+
build-raw:
96+
desc: " Build the binary. Opposed to the regular build, this one just builds and skips code generation/validation tasks."
97+
summary: |
98+
This task builds the binary for the current operating system and architecture.
99+
To overwrite this, set the 'OS' and 'ARCH' environment variables.
100+
The binary is saved in the 'bin' folder, as $COMPONENT.$OS-$ARCH.
101+
aliases:
102+
- build:bin:build-raw
103+
cmds:
104+
- for:
105+
var: COMPONENTS
106+
as: COMPONENT
107+
cmd: 'CGO_ENABLED=0 GOOS={{.OS}} GOARCH={{.ARCH}} go build -a -o {{.ROOT_DIR2}}/bin/{{.COMPONENT}}.{{.OS}}-{{.ARCH}} {{.ROOT_DIR2}}/cmd/main.go'

0 commit comments

Comments
 (0)