Skip to content

Commit

Permalink
dbg: Benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
KSXGitHub committed Oct 29, 2024
1 parent c1ed367 commit 88153cd
Showing 1 changed file with 180 additions and 0 deletions.
180 changes: 180 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,183 @@ jobs:
BUILD_FLAGS: '--locked'
TEST_FLAGS: '--no-fail-fast'
run: ./test.sh --release

competing_benchmark:
name: Benchmark (Debug)

if: needs.create_release.outputs.is_release == 'true'

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Cache (rust)
uses: actions/cache@v4
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/[email protected]
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.8.1'
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.18'
run: |
mkdir -p DUTREE.tmp
flags=(
--force
--root DUTREE.tmp
--version "$VERSION"
--profile release
--locked
)
cargo install "${flags[@]}" dutree
echo "$(pwd)/DUTREE.tmp/bin" >> "$GITHUB_PATH"
- name: Install dua
env:
REPO: https://github.com/Byron/dua-cli
VERSION: '2.19.2'
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.15.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@v4
with:
node-version: '16.1.0'

- name: Cache (pnpm)
uses: actions/cache@v4
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/[email protected]
with:
version: '7.9.0'
run_install: 'true'

- name: Compile TypeScript
run: |
cd ci/github-actions
pnpm exec 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
if: false
uses: actions/[email protected]
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

0 comments on commit 88153cd

Please sign in to comment.