0.21.0 #68
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@v4 | |
- name: Install Rust | |
shell: bash | |
run: | | |
installer=$(mktemp -d)/install-rustup | |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > $installer | |
bash $installer --default-toolchain $(cat rust-toolchain) -y | |
- name: Test (dev) | |
shell: bash | |
env: | |
FMT: 'true' | |
LINT: 'true' | |
DOC: 'true' | |
BUILD: 'true' | |
TEST: 'true' | |
BUILD_FLAGS: '--locked' | |
TEST_FLAGS: '' | |
run: ./test.sh | |
- name: Test (release) | |
shell: bash | |
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@v4 | |
- name: Install Rust | |
shell: bash | |
run: | | |
installer=$(mktemp -d)/install-rustup | |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > $installer | |
bash $installer --default-toolchain $(cat rust-toolchain) -y | |
- name: Install compilation target | |
run: rustup target add ${{ matrix.target }} | |
- 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@v4 | |
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@v4 | |
- name: Install Rust | |
shell: bash | |
run: | | |
installer=$(mktemp -d)/install-rustup | |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > $installer | |
bash $installer --default-toolchain $(cat rust-toolchain) -y | |
- name: Install compilation target | |
run: rustup target add ${{ matrix.target }} | |
- 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@v4 | |
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@v4 | |
- name: Install Rust | |
shell: bash | |
run: | | |
installer=$(mktemp -d)/install-rustup | |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > $installer | |
bash $installer --default-toolchain $(cat rust-toolchain) -y | |
- name: Install compilation target | |
run: rustup target add ${{ matrix.target }} | |
- name: Build | |
run: cargo build --target ${{ matrix.target }} --release --all-features | |
- name: Upload build artifact | |
uses: actions/upload-artifact@v4 | |
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@v4 | |
- 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@v4 | |
- 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@v4 | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
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@v4 | |
- name: Download all artifacts | |
uses: actions/download-artifact@v4 | |
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@v4 | |
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_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@v4 | |
- name: Install Rust | |
shell: bash | |
run: | | |
installer=$(mktemp -d)/install-rustup | |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > $installer | |
bash $installer --default-toolchain $(cat rust-toolchain) -y | |
- 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_cargo_crate | |
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: 2 | |
continue-on-error: true | |
if: matrix.os != 'macos-latest' # Cache causes errors on macOS | |
with: | |
path: | | |
~/.cargo | |
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') }}- | |
- name: Install Rust | |
shell: bash | |
run: | | |
installer=$(mktemp -d)/install-rustup | |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > $installer | |
bash $installer --default-toolchain $(cat rust-toolchain) -y | |
- name: Build pdu | |
run: | | |
cargo build --release | |
echo "$(pwd)/target/release" >> "$GITHUB_PATH" | |
- name: Install dust | |
env: | |
REPO: https://github.com/bootandy/dust | |
VERSION: '1.2.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.30.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.31.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.19.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: 2 | |
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@v4.1.0 | |
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 | |
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 |