-
Notifications
You must be signed in to change notification settings - Fork 0
/
repro.cue
159 lines (131 loc) · 2.21 KB
/
repro.cue
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
package repro
x: {
repository: #Dir & {
steps: [{
do: "local"
dir: "."
include: []
}]
}
build: #Build & {
source: repository
packages: "./cmd"
output: "/usr/local/bin/cmd"
version: *"1.16" | string
source: {
steps: [{
do: "local"
dir: "."
include: []
}]
}
// Packages to build
packages: "./cmd"
// Specify the targeted binary name
output: "/usr/local/bin/cmd"
env: [string]: string
steps: [#Copy & {
from: #Go & {
version: version
"source": source
"env": env
}
src: output
dest: output
}]
}
help: {
steps: [#Load & {
from: build
}]
}
}
#Dir: steps: [...#Op]
// One operation in a script
#Op: #Fetch | #Exec | #Local | #Copy | #Load
#Local: {
do: "local"
dir: string
include: [...string] | *[]
}
#Load: {
do: "load"
from: _
}
#Exec: {
do: "exec"
args: [...string]
env?: [string]: string
always?: true | *false
dir: string | *"/"
mount: [string]: "tmp" | "cache" | {from: _, path: string | *"/"}
}
#Fetch: {
do: "fetch-container"
ref: string
}
#Copy: {
do: "copy"
from: _
src: string | *"/"
dest: string | *"/"
}
#Go: {
// Go version to use
version: *"1.16" | string
// Arguments to the Go binary
args: [...string]
// Source Directory to build
source: #Dir
// Environment variables
env: [string]: string
steps: [
#Fetch & {
ref: "docker.io/golang:\(version)-alpine"
},
#Exec & {
"args": ["go"] + args
"env": env
env: CGO_ENABLED: "0"
dir: "/src"
mount: "/src": from: source
mount: "/root/.cache": "cache"
},
]
}
#Build: {
// Go version to use
version: *#Go.version | string
// Source Directory to build
source: #Dir
// Packages to build
packages: *"." | string
// Specify the targeted binary name
output: string
env: [string]: string
steps: [
#Copy & {
from: #Go & {
"version": version
"source": source
"env": env
args: ["build"]
}
src: output
dest: output
},
]
}
#Test: {
// Go version to use
version: *#Go.version | string
// Source Directory to build
source: #Dir
// Packages to test
packages: *"." | string
#Go & {
"version": version
"source": source
args: ["test", "-v", packages]
}
}