-
-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathmise.toml
More file actions
276 lines (236 loc) · 7.5 KB
/
Copy pathmise.toml
File metadata and controls
276 lines (236 loc) · 7.5 KB
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
# Enviroment
# ====================
# [env]
# mise.file = "env"
# Tasks(Install)
# ====================
[tasks.full_install]
depends = ["cli_install", "plugin_install"]
description = "Install hwatch and its plugins"
[tasks.cli_install]
run = """
cargo install -f --path ./
"""
description = "Install hwatch cli binary"
[tasks.plugin_install]
depends = ["plugin_build"]
run = """
case "$(uname -s)" in
Darwin) plugin_ext="dylib" ;;
Linux) plugin_ext="so" ;;
*)
echo "unsupported platform for plugin_install: $(uname -s)" >&2
exit 1
;;
esac
mkdir -p ~/.config/hwatch/plugins
cp "./plugins/numeric-diff/target/release/libhwatch_plugin_numeric_diff.${plugin_ext}" ~/.config/hwatch/plugins/
cp "./plugins/numeric-inline-diff/target/release/libhwatch_plugin_numeric_inline_diff.${plugin_ext}" ~/.config/hwatch/plugins/
"""
description = "Install hwatch plugin binaries"
# Tasks(Binary)
# ====================
[tasks.full_build]
depends = ["cli_build", "plugin_build"]
description = "Build all binaries"
[tasks.cli_build]
run = """
cargo build --release
"""
description = "Build cli binary"
[tasks.plugin_build]
run = """
cargo build --manifest-path plugins/numeric-diff/Cargo.toml --release
cargo build --manifest-path plugins/numeric-inline-diff/Cargo.toml --release
"""
description = "Build plugin binaries"
# Tasks(Test)
# ====================
[tasks.test]
run = """
cargo test
"""
description = "Run tests"
# Tasks(image)
# ====================
[tasks.generate-gif]
run = """
# デモ用のディレクトリ・ファイルを生成
mkdir -p _demo
touch _demo/demo.{00..99}.txt
# デモ用のファイルをランダムに変更させるプロセスを走らせる(20秒後に停止させる)
for i in {1..10}; do
sleep 2
echo "demo file $i" > _demo/demo.$((RANDOM % 100)).txt
done &
# デモGIFの作成
vhs img/demo.tape -o img/hwatch.gif
# デモ用のプロセスを停止
# デモ用のファイルを削除
rm -rf _demo
vhs img/watch_diff.tape -o img/watch_diff.gif
vhs img/line_diff.tape -o img/line_diff.gif
vhs img/word_diff.tape -o img/word_diff.gif
vhs img/plugin.tape -o img/plugin.gif
"""
description = "Generate demo GIFs"
#
# Tasks(Debian packaging)
# ====================
[tasks.debian_image_build]
run = """
docker build -f package/debian/Dockerfile -t "${DEBIAN_PACKAGING_IMAGE:-hwatch-debian-upload}" .
"""
description = "Build the Debian packaging container image"
[tasks.debian_source]
depends = ["debian_image_build"]
run = """
docker run --rm \
-v "$PWD":/work \
"${DEBIAN_PACKAGING_IMAGE:-hwatch-debian-upload}" \
hwatch-debian-build /work build-source
"""
description = "Build the Debian source package in Docker"
[tasks.debian_lintian]
depends = ["debian_source"]
run = """
docker run --rm \
-v "$PWD":/work \
"${DEBIAN_PACKAGING_IMAGE:-hwatch-debian-upload}" \
hwatch-debian-build /work lintian
"""
description = "Run lintian -EvIL +pedantic for the Debian source package in Docker"
[tasks.debian_test]
depends = ["debian_lintian"]
run = """
printf '%s\n' "Debian packaging checks completed."
"""
description = "Build the Debian source package and run lintian checks in Docker"
[tasks.debian_sign]
depends = ["debian_source"]
run = """
: "${DEBSIGN_FINGERPRINT:?set DEBSIGN_FINGERPRINT to your GPG fingerprint}"
keytmp="$(mktemp -d)"
trap 'rm -rf "$keytmp"' EXIT
gpg --armor --export "$DEBSIGN_FINGERPRINT" > "$keytmp/public.asc"
gpg --armor --export-secret-keys "$DEBSIGN_FINGERPRINT" > "$keytmp/secret.asc"
docker run --rm -it \
-v "$PWD":/work \
-v "$keytmp/public.asc:/tmp/public.asc:ro" \
-v "$keytmp/secret.asc:/tmp/secret.asc:ro" \
-v "$HOME/.devscripts:/root/.devscripts:ro" \
-e GNUPGHOME=/root/.gnupg \
-w /work \
"${DEBIAN_PACKAGING_IMAGE:-hwatch-debian-upload}" \
bash -lc '
mkdir -p /root/.gnupg &&
chmod 700 /root/.gnupg &&
gpgconf --kill gpg-agent || true &&
gpgconf --launch gpg-agent &&
gpg --import /tmp/public.asc &&
gpg --import /tmp/secret.asc &&
debsign tmp/debian-source/hwatch_*_source.changes
'
"""
description = "Sign the Debian source package in Docker using a temporary exported key"
[tasks.debian_upload]
run = """
: "${DEBSIGN_FINGERPRINT:?set DEBSIGN_FINGERPRINT to your GPG fingerprint}"
keytmp="$(mktemp -d)"
trap 'rm -rf "$keytmp"' EXIT
gpg --armor --export "$DEBSIGN_FINGERPRINT" > "$keytmp/public.asc"
set -- \
--rm \
-v "$PWD":/work \
-v "$keytmp/public.asc:/tmp/public.asc:ro" \
-e "DPUT_TARGET=${DPUT_TARGET:-mentors}" \
-w /work
if [ -f "$HOME/.dput.cf" ]; then
set -- "$@" -v "$HOME/.dput.cf:/root/.dput.cf:ro"
fi
docker run "$@" \
"${DEBIAN_PACKAGING_IMAGE:-hwatch-debian-upload}" \
bash -lc '
mkdir -p /root/.gnupg &&
chmod 700 /root/.gnupg &&
gpgconf --kill gpg-agent || true &&
gpgconf --launch gpg-agent &&
gpg --import /tmp/public.asc &&
dput "$DPUT_TARGET" tmp/debian-source/hwatch_*_source.changes
'
"""
description = "Upload the signed Debian source package with dput"
# Tasks(Fedora packaging)
# ====================
[tasks.fedora_source_tarball]
run = """
version="$(sed -n 's/^Version:[[:space:]]*//p' package/fedora/hwatch.spec | head -n1)"
if [ -z "$version" ]; then
echo "failed to read Version from package/fedora/hwatch.spec" >&2
exit 1
fi
ref="HEAD"
if git rev-parse --verify "refs/tags/${version}" >/dev/null 2>&1; then
ref="refs/tags/${version}"
fi
mkdir -p out/fedora
git archive \
--format=tar.gz \
--prefix="hwatch-${version}/" \
-o "out/fedora/hwatch-${version}.tar.gz" \
"$ref"
echo "Created out/fedora/hwatch-${version}.tar.gz from $ref"
"""
description = "Create the fixed Fedora source tarball from the matching git tag"
[tasks.fedora_image_build]
run = """
set --
if [ -n "${FEDORA_PACKAGING_PLATFORM:-}" ]; then
set -- "$@" --platform "$FEDORA_PACKAGING_PLATFORM"
fi
docker build "$@" \
--build-arg "FEDORA_VERSION=${FEDORA_PACKAGING_RELEASE:-42}" \
-f package/fedora/Dockerfile \
-t "${FEDORA_PACKAGING_IMAGE:-hwatch-fedora-packaging}" \
.
"""
description = "Build the Fedora packaging container image"
[tasks.fedora_srpm]
depends = ["fedora_source_tarball", "fedora_image_build"]
run = """
set -- --rm
if [ -n "${FEDORA_PACKAGING_PLATFORM:-}" ]; then
set -- "$@" --platform "$FEDORA_PACKAGING_PLATFORM"
fi
docker run "$@" \
-v "$PWD":/work \
"${FEDORA_PACKAGING_IMAGE:-hwatch-fedora-packaging}" \
hwatch-fedora-build-srpm /work
"""
description = "Build the Fedora SRPM in Docker"
[tasks.fedora_test]
depends = ["fedora_source_tarball", "fedora_image_build"]
run = """
set -- --rm
if [ -n "${FEDORA_PACKAGING_PLATFORM:-}" ]; then
set -- "$@" --platform "$FEDORA_PACKAGING_PLATFORM"
fi
docker run "$@" \
-v "$PWD":/work \
"${FEDORA_PACKAGING_IMAGE:-hwatch-fedora-packaging}" \
hwatch-fedora-build-srpm /work rpm-test
"""
description = "Build the Fedora package in Docker using generated BuildRequires"
[tasks.fedora_mock_test]
depends = ["fedora_source_tarball", "fedora_image_build"]
run = """
set -- --rm --privileged
if [ -n "${FEDORA_PACKAGING_PLATFORM:-}" ]; then
set -- "$@" --platform "$FEDORA_PACKAGING_PLATFORM"
fi
docker run "$@" \
-v "$PWD":/work \
"${FEDORA_PACKAGING_IMAGE:-hwatch-fedora-packaging}" \
hwatch-fedora-build-with-mock /work "${FEDORA_MOCK_CHROOT:-fedora-rawhide-x86_64}"
"""
description = "Rebuild the Fedora SRPM in mock using a Fedora chroot close to Copr"