-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.drone.star
53 lines (42 loc) · 1.27 KB
/
.drone.star
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
# workaround to render locally since you cant pass repo.branch to the cli
def repo_branch(ctx):
return getattr(ctx.repo, "branch", "main")
def new_pipeline(name, arch, **kwargs):
pipeline = {
"kind": "pipeline",
"name": name,
"platform": {
"arch": arch,
},
"steps": [],
}
pipeline.update(kwargs)
return pipeline
def pipeline_test(ctx):
cache_volume = {"name": "cache", "temp": {}}
cache_mount = {"name": "cache", "path": "/go"}
# licensed-go image only supports amd64
p = new_pipeline(
name="test",
arch="amd64",
trigger={"branch": repo_branch(ctx)},
volumes=[cache_volume],
workspace={"path": "/go/src/github.com/{}".format(ctx.repo.slug)},
steps=[
{
"commands": ["make test"],
"image": "golangci/golangci-lint",
"name": "test",
"volumes": [cache_mount],
},
{
"commands": ["licensed cache", "licensed status"],
"image": "public.ecr.aws/kanopy/licensed-go",
"name": "license-check",
},
],
)
return p
def main(ctx):
pipelines = [pipeline_test(ctx)]
return pipelines