forked from aquaproj/aqua-registry
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcmdx.yaml
158 lines (134 loc) · 3.57 KB
/
cmdx.yaml
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
---
# the configuration file of cmdx - task runner
# https://github.com/suzuki-shunsuke/cmdx
tasks:
- name: scaffold
short: s
usage: Scaffold the configuration for a given package
description: |
Scaffold the configuration for a given package
e.g.
$ cmdx s cli/cli
After scaffolding, tests are run.
flags:
- name: recreate
short: r
type: bool
usage: Recreate the container
- name: cmd
type: string
usage: A list of commands joined with commas ','
- name: limit
type: string
usage: The maximum number of versions
shell:
- "bash"
- "-c"
script: |
if [ "{{.recreate}}" = true ]; then
cmdx rm
fi
bash scripts/scaffold.sh "{{.package}}" "{{.cmd}}" "{{.limit}}"
args:
- name: package
usage: a package name. e.g. `cli/cli`
required: true
- name: test
short: t
usage: Test a given package in the container
description: |
Test a given package in the container.
$ cmdx t [-r] <package name>
Tests are run on all platforms with AQUA_GOOS and AQUA_GOARCH same with CI in a container.
If the test fails, bash is attached to the container for debugging.
If you want to exit from the container, please run exit.
flags:
- name: recreate
short: r
type: bool
usage: Recreate the container
args:
- name: package
usage: a package name. e.g. `cli/cli`
required: true
shell:
- "bash"
- "-c"
script: |
set -euxo pipefail
if [ "{{.recreate}}" = true ]; then
cmdx rm
fi
bash scripts/test.sh "{{.package}}"
- name: connect
short: con
usage: Connect to the container
description: |
Connect to the container
$ cmdx connect <os> <arch>
e.g.
$ cmdx connect linux amd64
You need to specify os and arch.
These arguments are set to AQUA_GOOS and AQUA_GOARCH.
args:
- name: os
required: true
- name: arch
required: true
shell:
- "bash"
- "-c"
script: |
set -euxo pipefail
docker exec -ti aqua-registry env AQUA_GOOS="{{.os}}" AQUA_GOARCH="{{.arch}}" bash
- name: generate-registry
short: gr
usage: Update registry.yaml
description: |
Update registry.yaml
$ cmdx gr
shell:
- "bash"
- "-c"
script: aqua-registry gr
- name: new
usage: Create a branch, a commit, and a pull request to add a given package
description: |
Create a branch, a commit, and a pull request to add a given package.
$ cmdx new <package name>
e.g.
$ cmdx new cli/cli
script: aqua-registry create-pr-new-pkg "{{.package}}"
args:
- name: package
required: true
usage: a package name. e.g. cli/cli
- name: stop
usage: Stop the container
description: |
Stop the container.
$ cmdx stop
script: |
docker stop -t 1 aqua-registry
- name: remove
short: rm
usage: Remove the container
description: |
Remove the container.
$ cmdx rm
script: |
set -euxo pipefail
docker stop -t 1 aqua-registry
docker rm aqua-registry
- name: release
short: r
description: Release the new version
usage: Release the new version
script: |
git tag -m "chore: release {{.version}}" "{{.version}}"
git push origin "{{.version}}"
args:
- name: version
required: true
validate:
- regexp: "^v\\d+\\.\\d+.\\d+(-\\d+)?$"