Skip to content

Commit 737727e

Browse files
committed
ci: Move competing_benchmark into deploy.yaml
1 parent fb5aeb0 commit 737727e

File tree

2 files changed

+149
-133
lines changed

2 files changed

+149
-133
lines changed

.github/workflows/competing-benchmark.yaml

Lines changed: 0 additions & 133 deletions
This file was deleted.

.github/workflows/deploy.yaml

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,3 +454,152 @@ jobs:
454454

455455
- name: Publish
456456
run: cargo publish
457+
458+
competing_benchmark:
459+
name: Benchmark
460+
461+
# benchmark need to run in a quiet environment, without other processes to produce noises.
462+
needs:
463+
- test
464+
- build_linux
465+
- build_macos
466+
- build_windows
467+
- create_release
468+
- upload_generated_files
469+
- upload_release_assets
470+
- upload_checksums
471+
- publish_aur_package
472+
- publish_cargo_crate
473+
474+
if: needs.create_release.outputs.is_release == 'true'
475+
476+
runs-on: ubuntu-latest
477+
478+
steps:
479+
- uses: actions/checkout@v2
480+
481+
- name: Cache (rust)
482+
uses: actions/cache@v2.1.5
483+
timeout-minutes: 1
484+
continue-on-error: true
485+
if: matrix.os != 'macos-latest' # Cache causes errors on macOS
486+
with:
487+
path: |
488+
~/.cargo/registry
489+
~/.cargo/git
490+
target
491+
key: ${{ github.job }}-Linux-${{ hashFiles('rust-toolchain') }}-${{ hashFiles('**/Cargo.lock') }}
492+
restore-keys: |
493+
${{ github.job }}-Linux-${{ hashFiles('rust-toolchain') }}-${{ hashFiles('**/Cargo.lock') }}
494+
${{ github.job }}-Linux-${{ hashFiles('rust-toolchain') }}-
495+
496+
- uses: actions-rs/toolchain@v1.0.7
497+
with:
498+
profile: minimal
499+
components: clippy
500+
override: 'true'
501+
default: 'true'
502+
503+
- name: Build pdu
504+
run: |
505+
cargo build --release
506+
echo "$(pwd)/target/release" >> "$GITHUB_PATH"
507+
508+
- name: Install dust
509+
env:
510+
REPO: https://github.com/bootandy/dust
511+
VERSION: '0.5.4'
512+
run: |
513+
mkdir -p DUST.tmp
514+
archive_name="dust-v${VERSION}-x86_64-unknown-linux-gnu"
515+
curl -L "${REPO}/releases/download/v${VERSION}/${archive_name}.tar.gz" > tmp.dust.tar.gz
516+
tar xf tmp.dust.tar.gz --directory=DUST.tmp
517+
chmod +x "DUST.tmp/${archive_name}/dust"
518+
echo "$(pwd)/DUST.tmp/${archive_name}" >> "$GITHUB_PATH"
519+
520+
- name: Install dutree
521+
env:
522+
REPO: https://github.com/nachoparker/dutree
523+
VERSION: '0.2.15'
524+
run: |
525+
mkdir -p DUTREE.tmp
526+
curl -L "${REPO}/releases/download/v${VERSION}/dutree" > DUTREE.tmp/dutree
527+
chmod +x DUTREE.tmp/dutree
528+
echo "$(pwd)/DUTREE.tmp" >> "$GITHUB_PATH"
529+
530+
- name: Install hyperfine
531+
env:
532+
REPO: https://github.com/sharkdp/hyperfine
533+
VERSION: '1.11.0'
534+
run: |
535+
mkdir -p HYPERFINE.tmp
536+
archive_name="hyperfine-v${VERSION}-x86_64-unknown-linux-gnu"
537+
curl -L "${REPO}/releases/download/v${VERSION}/${archive_name}.tar.gz" > tmp.hyperfine.tar.gz
538+
tar xf tmp.hyperfine.tar.gz --directory=HYPERFINE.tmp
539+
chmod +x "HYPERFINE.tmp/${archive_name}/hyperfine"
540+
echo "$(pwd)/HYPERFINE.tmp/${archive_name}" >> "$GITHUB_PATH"
541+
542+
- name: Inspect command locations
543+
run: |
544+
which pdu
545+
which dust
546+
which dutree
547+
which du
548+
which hyperfine
549+
550+
- name: Inspect versions of the other tools
551+
run: |
552+
dust --version
553+
dutree --version
554+
du --version
555+
hyperfine --version
556+
557+
- name: Prepare directory to be measured
558+
run: |
559+
mkdir -p tmp.sample
560+
curl -L https://github.com/torvalds/linux/archive/refs/tags/v5.12.zip > tmp.sample.zip
561+
unzip tmp.sample.zip -d tmp.sample
562+
563+
- name: Install Node.js
564+
uses: actions/setup-node@v2
565+
with:
566+
node-version: '16.1.0'
567+
568+
- name: Cache (pnpm)
569+
uses: actions/cache@v2.1.5
570+
timeout-minutes: 1
571+
continue-on-error: true
572+
with:
573+
path: ~/.pnpm-store/v3
574+
key: pnpm-${{ matrix.vars.id }}-${{ hashFiles('**/pnpm-lock.yaml') }}
575+
restore-keys: |
576+
pnpm-${{ matrix.vars.id }}-${{ hashFiles('**/pnpm-lock.yaml') }}
577+
pnpm-${{ matrix.vars.id }}-
578+
pnpm-
579+
580+
- name: Setup pnpm
581+
uses: pnpm/action-setup@v2.0.1
582+
with:
583+
version: '6.3.0'
584+
run_install: 'true'
585+
586+
- name: Compile TypeScript
587+
run: |
588+
cd ci/github-actions
589+
pnpx tsc
590+
591+
- name: Compare benchmark of pdu against its competitors
592+
run: node ci/github-actions/competing-benchmark.js
593+
594+
- name: Create archive of benchmark reports
595+
run: tar czf tmp.benchmark-reports.tar.gz tmp.benchmark-reports.*
596+
597+
- name: Upload benchmark reports
598+
uses: actions/upload-release-asset@v1.0.2
599+
env:
600+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
601+
with:
602+
upload_url: ${{ needs.create_release.outputs.upload_url }}
603+
asset_path: ./tmp.benchmark-reports.tar.gz
604+
asset_name: benchmark-reports.tar.gz
605+
asset_content_type: application/x-compressed-tar

0 commit comments

Comments
 (0)