-
-
Notifications
You must be signed in to change notification settings - Fork 10
640 lines (528 loc) · 17.8 KB
/
deploy.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
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
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
name: Deployment
on:
push:
tags:
- '*.*.*'
jobs:
test:
name: Test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
components: clippy, rustfmt
override: 'true'
default: 'true'
- name: Test (dev)
env:
FMT: 'true'
LINT: 'true'
DOC: 'true'
BUILD: 'true'
TEST: 'true'
BUILD_FLAGS: '--locked'
TEST_FLAGS: ''
run: ./test.sh
- name: Test (release)
env:
FMT: 'true'
LINT: 'true'
DOC: 'true'
BUILD: 'true'
TEST: 'true'
BUILD_FLAGS: '--locked'
TEST_FLAGS: ''
run: ./test.sh --release
build_linux:
name: Build
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
target:
- x86_64-unknown-linux-gnu
- x86_64-unknown-linux-musl
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1.0.7
with:
profile: minimal
target: ${{ matrix.target }}
override: 'true'
default: 'true'
- name: Build
run: cargo build --target ${{ matrix.target }} --release --all-features
- name: Strip all debug symbols
run: strip --strip-all target/${{ matrix.target }}/release/pdu
- name: Upload build artifact
uses: actions/upload-artifact@v2
with:
name: pdu-${{ matrix.target }}
path: target/${{ matrix.target }}/release/pdu
build_macos:
name: Build
runs-on: macos-latest
strategy:
fail-fast: true
matrix:
target:
- x86_64-apple-darwin
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1.0.7
with:
profile: minimal
target: ${{ matrix.target }}
override: 'true'
default: 'true'
- name: Build
run: cargo build --target ${{ matrix.target }} --release --all-features
- name: Strip all debug symbols
run: strip target/${{ matrix.target }}/release/pdu
- name: Upload build artifact
uses: actions/upload-artifact@v2
with:
name: pdu-${{ matrix.target }}
path: target/${{ matrix.target }}/release/pdu
build_windows:
name: Build
runs-on: windows-latest
strategy:
fail-fast: true
matrix:
target:
- x86_64-pc-windows-gnu
- x86_64-pc-windows-msvc
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1.0.7
with:
profile: minimal
target: ${{ matrix.target }}
override: 'true'
default: 'true'
- name: Build
run: cargo build --target ${{ matrix.target }} --release --all-features
- name: Upload build artifact
uses: actions/upload-artifact@v2
with:
name: pdu-${{ matrix.target }}
path: target/${{ matrix.target }}/release/pdu.exe
create_release:
name: Create Release
needs:
- test
- build_linux
- build_macos
- build_windows
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
release_type: ${{ steps.release_type.outputs.release_type }}
is_release: ${{ steps.release_type.outputs.is_release }}
is_prerelease: ${{ steps.release_type.outputs.is_prerelease }}
release_tag: ${{ steps.release_type.outputs.release_tag }}
steps:
- uses: actions/checkout@v2
- name: Install APT packages
run: sudo apt install -y python3 python3-toml
- name: Determine release type
id: release_type
run: ./ci/github-actions/release-type.py3
env:
RELEASE_TAG: ${{ github.ref }}
- name: Create Release
id: create_release
if: steps.release_type.outputs.is_release == 'true'
uses: actions/create-release@v1.1.4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.release_type.outputs.release_tag }}
release_name: ${{ steps.release_type.outputs.release_tag }}
draft: 'false'
prerelease: ${{ steps.release_type.outputs.is_prerelease }}
upload_generated_files:
name: Upload Generated Files
needs:
- create_release
- test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Upload Tab-Completion file for Bash
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ./exports/completion.bash
asset_name: completion.bash
asset_content_type: text/plain
- name: Upload Tab-Completion file for Fish
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ./exports/completion.fish
asset_name: completion.fish
asset_content_type: text/plain
- name: Upload Tab-Completion file for Zsh
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ./exports/completion.zsh
asset_name: completion.zsh
asset_content_type: text/plain
- name: Upload Tab-Completion file for PowerShell
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ./exports/completion.ps1
asset_name: completion.ps1
asset_content_type: text/plain
- name: Upload Tab-Completion file for Elvish
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ./exports/completion.elv
asset_name: completion.elv
asset_content_type: text/plain
upload_release_assets:
name: Upload Release Assets
needs:
- create_release
- test
- build_linux
- build_macos
- build_windows
runs-on: ubuntu-latest
if: needs.create_release.outputs.is_release == 'true'
strategy:
fail-fast: true
matrix:
target:
- x86_64-unknown-linux-gnu
- x86_64-unknown-linux-musl
- x86_64-pc-windows-gnu
- x86_64-pc-windows-msvc
- x86_64-apple-darwin
steps:
- uses: actions/checkout@v2
- name: Download artifact
uses: actions/download-artifact@v2.0.9
with:
name: pdu-${{ matrix.target }}
- name: Release executable (UNIX)
if: "!contains(matrix.target, 'windows')"
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ./pdu
asset_name: pdu-${{ matrix.target }}
asset_content_type: application/x-pie-executable
- name: Release executable (Windows)
if: contains(matrix.target, 'windows')
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ./pdu.exe
asset_name: pdu-${{ matrix.target }}.exe
asset_content_type: application/x-dosexec
upload_checksums:
name: Upload Checksums
needs:
- create_release
- test
- build_linux
- build_macos
- build_windows
if: needs.create_release.outputs.is_release == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Download all artifacts
uses: actions/download-artifact@v2.0.9
with:
path: ./downloads
- name: Flatten directory
run: ./ci/github-actions/expose-release-artifacts.sh
- name: Create checksums
run: ./ci/github-actions/create-checksums.sh
- name: Upload as artifacts
uses: actions/upload-artifact@v2
with:
name: checksums
path: sha*sum.txt
- name: Release sha1sum
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ./sha1sum.txt
asset_name: sha1sum.txt
asset_content_type: text/plain
- name: Release sha256sum
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ./sha256sum.txt
asset_name: sha256sum.txt
asset_content_type: text/plain
- name: Release sha512sum
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ./sha512sum.txt
asset_name: sha512sum.txt
asset_content_type: text/plain
publish_aur_package:
name: Publish AUR package
needs:
- create_release
- test
- build_linux
- upload_release_assets
if: needs.create_release.outputs.release_type == 'official'
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
target:
- x86_64-unknown-linux-gnu
steps:
- uses: actions/checkout@v2
- name: Download checksums
uses: actions/download-artifact@v2.0.9
with:
name: checksums
path: ./checksums
- name: Generate PKGBUILD
env:
TARGET: ${{ matrix.target }}
RELEASE_TAG: ${{ needs.create_release.outputs.release_tag }}
run: ./ci/github-actions/generate-pkgbuild.py3
- name: Publish parallel-disk-usage to the AUR
uses: KSXGitHub/github-actions-deploy-aur@v2.2.5
with:
pkgname: parallel-disk-usage
pkgbuild: ./pkgbuild/parallel-disk-usage/PKGBUILD
commit_username: ${{ secrets.AUR_USERNAME }}
commit_email: ${{ secrets.AUR_EMAIL }}
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
commit_message: ${{ needs.create_release.outputs.release_tag }}
force_push: 'true'
- name: Publish parallel-disk-usage-bin to the AUR
uses: KSXGitHub/github-actions-deploy-aur@v2.2.5
with:
pkgname: parallel-disk-usage-bin
pkgbuild: ./pkgbuild/parallel-disk-usage-bin/PKGBUILD
commit_username: ${{ secrets.AUR_USERNAME }}
commit_email: ${{ secrets.AUR_EMAIL }}
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
commit_message: ${{ needs.create_release.outputs.release_tag }}
force_push: 'true'
publish_cargo_crate:
name: Publish Cargo crate
needs:
- create_release
- test
if: needs.create_release.outputs.release_type == 'official'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1.0.7
with:
profile: minimal
override: 'true'
default: 'true'
- name: Login
run: cargo login ${{ secrets.CRATE_AUTH_TOKEN }}
- name: Publish
run: cargo publish
competing_benchmark:
name: Benchmark
# benchmark need to run in a quiet environment, without other processes to produce noises.
needs:
- test
- build_linux
- build_macos
- build_windows
- create_release
- upload_generated_files
- upload_release_assets
- upload_checksums
- publish_aur_package
- publish_cargo_crate
if: needs.create_release.outputs.is_release == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Cache (rust)
uses: actions/cache@v2.1.6
timeout-minutes: 1
continue-on-error: true
if: matrix.os != 'macos-latest' # Cache causes errors on macOS
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ github.job }}-Linux-${{ hashFiles('rust-toolchain') }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ github.job }}-Linux-${{ hashFiles('rust-toolchain') }}-${{ hashFiles('**/Cargo.lock') }}
${{ github.job }}-Linux-${{ hashFiles('rust-toolchain') }}-
- uses: actions-rs/toolchain@v1.0.7
with:
profile: minimal
components: clippy
override: 'true'
default: 'true'
- name: Build pdu
run: |
cargo build --release
echo "$(pwd)/target/release" >> "$GITHUB_PATH"
- name: Install dust
env:
REPO: https://github.com/bootandy/dust
VERSION: '0.5.4'
run: |
mkdir -p DUST.tmp
archive_name="dust-v${VERSION}-x86_64-unknown-linux-gnu"
curl -L "${REPO}/releases/download/v${VERSION}/${archive_name}.tar.gz" > tmp.dust.tar.gz
tar xf tmp.dust.tar.gz --directory=DUST.tmp
chmod +x "DUST.tmp/${archive_name}/dust"
echo "$(pwd)/DUST.tmp/${archive_name}" >> "$GITHUB_PATH"
- name: Install dutree
env:
REPO: https://github.com/nachoparker/dutree
VERSION: '0.2.15'
run: |
mkdir -p DUTREE.tmp
curl -L "${REPO}/releases/download/v${VERSION}/dutree" > DUTREE.tmp/dutree
chmod +x DUTREE.tmp/dutree
echo "$(pwd)/DUTREE.tmp" >> "$GITHUB_PATH"
- name: Install dua
env:
REPO: https://github.com/Byron/dua-cli
VERSION: '2.12.1'
run: |
mkdir -p DUA.tmp
archive_name="dua-v${VERSION}-x86_64-unknown-linux-musl"
curl -L "${REPO}/releases/download/v${VERSION}/${archive_name}.tar.gz" > tmp.dua.tar.gz
tar xf tmp.dua.tar.gz --directory=DUA.tmp
chmod +x "DUA.tmp/${archive_name}/dua"
echo "$(pwd)/DUA.tmp/${archive_name}" >> "$GITHUB_PATH"
- name: Install ncdu
run: sudo apt install -y ncdu
- name: Install gdu
env:
REPO: https://github.com/dundee/gdu
VERSION: '5.0.0'
run: |
mkdir -p GDU.tmp
curl -L "${REPO}/releases/download/v${VERSION}/gdu_linux_amd64.tgz" > tmp.gdu.tar.gz
tar xf tmp.gdu.tar.gz --directory=GDU.tmp
mkdir -p GDU.tmp/bin
chmod +x GDU.tmp/gdu_linux_amd64
ln -s "$(pwd)/GDU.tmp/gdu_linux_amd64" GDU.tmp/bin/gdu
echo "$(pwd)/GDU.tmp/bin" >> "$GITHUB_PATH"
- name: Install hyperfine
env:
REPO: https://github.com/sharkdp/hyperfine
VERSION: '1.11.0'
run: |
mkdir -p HYPERFINE.tmp
archive_name="hyperfine-v${VERSION}-x86_64-unknown-linux-gnu"
curl -L "${REPO}/releases/download/v${VERSION}/${archive_name}.tar.gz" > tmp.hyperfine.tar.gz
tar xf tmp.hyperfine.tar.gz --directory=HYPERFINE.tmp
chmod +x "HYPERFINE.tmp/${archive_name}/hyperfine"
echo "$(pwd)/HYPERFINE.tmp/${archive_name}" >> "$GITHUB_PATH"
- name: Inspect command locations
run: |
which pdu
which dust
which dutree
which dua
which ncdu
which gdu
which du
which hyperfine
- name: Inspect versions of the other tools
run: |
dust --version
dutree --version
dua --version
ncdu --version
gdu --version
du --version
hyperfine --version
- name: Prepare directory to be measured
run: |
mkdir -p tmp.sample
curl -L https://github.com/torvalds/linux/archive/refs/tags/v5.12.zip > tmp.sample.zip
unzip tmp.sample.zip -d tmp.sample
- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version: '16.1.0'
- name: Cache (pnpm)
uses: actions/cache@v2.1.6
timeout-minutes: 1
continue-on-error: true
with:
path: ~/.pnpm-store/v3
key: pnpm-${{ matrix.vars.id }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
pnpm-${{ matrix.vars.id }}-${{ hashFiles('**/pnpm-lock.yaml') }}
pnpm-${{ matrix.vars.id }}-
pnpm-
- name: Setup pnpm
uses: pnpm/action-setup@v2.0.1
with:
version: '6.3.0'
run_install: 'true'
- name: Compile TypeScript
run: |
cd ci/github-actions
pnpx tsc
- name: Compare benchmark of pdu against its competitors
run: node ci/github-actions/competing-benchmark.js
- name: Create chart for benchmark reports
run: node ci/github-actions/illustrate-benchmark-reports.js
- name: Create archive of benchmark reports
run: tar czf tmp.benchmark-reports.tar.gz tmp.benchmark-report.*
- name: Upload benchmark reports
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ./tmp.benchmark-reports.tar.gz
asset_name: benchmark-reports.tar.gz
asset_content_type: application/x-compressed-tar