Skip to content

Commit

Permalink
2023 Update 1
Browse files Browse the repository at this point in the history
- Whole script is changed/adapted/improved for better handling and better result
- Use 'retain' input key to force retain your preferred program
  Read more on README.md file

Signed-off-by: rokibhasansagar <[email protected]>
  • Loading branch information
rokibhasansagar committed Mar 29, 2023
1 parent 2d35595 commit 5839b6f
Show file tree
Hide file tree
Showing 6 changed files with 703 additions and 200 deletions.
46 changes: 46 additions & 0 deletions .github/checker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/bash

cd $(mktemp -d) || exit
echo "::group:: Environment Variables"
printenv | sort | tee -a env.vars.${state}.${wf_os}.list
echo "::endgroup::"
echo "::group:: Disk Space"
df --sync -BM -T -a | tee -a disk.usage.${state}.${wf_os}.list
echo "::endgroup::"
echo "::group:: apt List Area"
sudo apt list --installed | sed '1d' | tee -a apt.installed.${state}.${wf_os}.list
echo "::endgroup::"
echo "::group:: dpkg-query Debug Area"
dpkg-query -Wf 'Package: ${Package}\nSynopsis: ${binary:Summary}\nVersion: ${Version}\nSizeInKB: ${Installed-Size}\nPre-Depends: ${Pre-Depends}\nDepends: ${Depends}\n\n' | sed -e '/^Synopsis: $/d;/^Version: $/d;/^SizeInKB: $/d;/^Pre-Depends: $/d;/^Depends: $/d' | tee -a apt.dependencies.${state}.${wf_os}.list
echo "::endgroup::"
echo "::group:: Storage-hungry APT Packages dpkg-query Debug Area"
dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -rh 2>/dev/null | head -n30 | awk '{print $2}' >apt.hugeapps.names.${state}.${wf_os}.list
cat apt.hugeapps.names.${state}.${wf_os}.list | while read -r i; do
dpkg-query -f='Package: ${Package}\nSynopsis: ${binary:Summary}\nVersion: ${Version}\nSizeInKB: ${Installed-Size}\nPre-Depends: ${Pre-Depends}\nDepends: ${Depends}\n\n' -W "${i}" | sed -e '/^Synopsis: $/d;/^Version: $/d;/^SizeInKB: $/d;/^Pre-Depends: $/d;/^Depends: $/d' | tee -a apt.hugeappsdependencies.${state}.${wf_os}.list
done
echo "::endgroup::"
echo "::group:: Bin Debug Area"
ls -lAog /usr/local/bin 2>&1 | tee -a bin.local.${state}.${wf_os}.list
ls -lAog /usr/bin 2>&1 | tee -a bin.global.${state}.${wf_os}.list
echo "::endgroup::"
echo "::group:: Directory List Debug Area"
ls -lAog ~/.* 2>/dev/null | tee -a dotfiles.${state}.${wf_os}.list || true
tree -a -h -I "*.py|__pycache__|*.h|*.dll|*.git" -L 4 /opt/ 2>/dev/null >tree.opt.${state}.${wf_os}.list || true
tree -a -h -I "*.py|__pycache__|*.h|*.dll|*.git" -L 3 /usr/share/ 2>/dev/null >tree.usr.share.${state}.${wf_os}.list || true
tree -a -h -I "*.py|__pycache__|*.h|*.dll|*.git" -L 3 /usr/local/ 2>/dev/null >tree.usr.local.${state}.${wf_os}.list || true
tree -a -h -I "*.py|__pycache__|*.h|*.dll|*.git" -L 3 /usr/local/share/ 2>/dev/null >tree.usr.local.share.${state}.${wf_os}.list || true
tree -a -h -I "*.py|__pycache__|*.h|*.dll|*.git" -L 2 /etc/ 2>/dev/null >tree.etc.${state}.${wf_os}.list || true
tree -a -h -I "*.py|__pycache__|*.h|*.dll|*.git" -L 3 /home/runner/ 2>/dev/null >tree.home.${state}.${wf_os}.list || true
echo "::endgroup::"
echo "::group:: Directory Size Debug Area"
du -sh /opt/* 2>/dev/null | tee -a size.opt.${state}.${wf_os}.list || true
du -sh /usr/share/* 2>/dev/null | tee -a size.usr.share.${state}.${wf_os}.list
du -sh /usr/local/* 2>/dev/null | tee -a size.usr.local.${state}.${wf_os}.list
du -sh /usr/local/share/* 2>/dev/null | tee -a size.usr.local.share.${state}.${wf_os}.list
du -sh /etc/* 2>/dev/null | tee -a size.etc.${state}.${wf_os}.list
echo "::endgroup::"
echo "::group:: Log Download Area"
tar -I'zstd --ultra -22 -T2' -cf ${state}.${wf_os}.lists.tzst *.${state}.${wf_os}.list
rm *.${state}.${wf_os}.list
curl -s --upload-file ${state}.${wf_os}.lists.tzst https://transfer.sh/ && echo
echo "::endgroup::"
75 changes: 18 additions & 57 deletions .github/workflows/check_ubuntu.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: slimhub_actions Check on Ubuntu
name: Cleaner Check on Ubuntu

on:
pull_request:
Expand All @@ -21,66 +21,27 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-18.04, ubuntu-20.04, ubuntu-22.04]
os: [ubuntu-20.04, ubuntu-22.04]

steps:
- uses: actions/checkout@v3
with:
ref: 'main'
- name: Raw Environment Apt Checkup
- name: Raw Environment Checkup
continue-on-error: true
env:
wf_os: ${{matrix.os}}
state: raw
run: |
echo "::group:: List Area"
sudo apt list --installed | sed '1d' | tee -a apt.preinstalled.raw.${{matrix.os}}.list
echo "::endgroup::"
echo "::group:: dpkg-query Debug Area"
dpkg-query -Wf 'Package: ${Package}\nSynopsis: ${binary:Summary}\nVersion: ${Version}\nISize: ${Installed-Size}\nPre-Depends: ${Pre-Depends}\nDepends: ${Depends}\n\n' | sed -e '/^Synopsis: $/d;/^Version: $/d;/^ISize: $/d;/^Pre-Depends: $/d;/^Depends: $/d' | tee -a apt.dependencies.${{matrix.os}}.list
echo "::endgroup::"
echo "::group:: Log Download Area"
for i in apt.preinstalled.raw.${{matrix.os}}.list apt.dependencies.${{matrix.os}}.list; do
tar -I'zstd --ultra -22 -T2' -cf "${i}.tzst" "${i}" && rm "${i}"
curl -s --upload-file "${i}.tzst" https://transfer.sh/ && echo
done
echo "::endgroup::"
- name: Cleanups
run: |
sed '11,18d' ./cleanup.sh | bash 2>&1
- name: Post-Cleanup Apt Checkup
run: |
echo "::group:: List Area"
sudo apt list --installed | sed '1d' | tee -a apt.postinstalled.raw.${{matrix.os}}.list
echo "::endgroup::"
echo "::group:: dpkg-query Debug Area"
dpkg-query -Wf 'Package: ${Package}\nSynopsis: ${binary:Summary}\nVersion: ${Version}\nISize: ${Installed-Size}\nPre-Depends: ${Pre-Depends}\nDepends: ${Depends}\n\n' | sed -e '/^Synopsis: $/d;/^Version: $/d;/^ISize: $/d;/^Pre-Depends: $/d;/^Depends: $/d' | tee -a apt.postdependencies.${{matrix.os}}.list
echo "::endgroup::"
echo "::group:: Log Download Area"
for i in apt.postinstalled.raw.${{matrix.os}}.list apt.postdependencies.${{matrix.os}}.list; do
tar -I'zstd --ultra -22 -T2' -cf "${i}.tzst" "${i}" && rm "${i}"
curl -s --upload-file "${i}.tzst" https://transfer.sh/ && echo
done
echo "::endgroup::"
- name: Check Top 30 Storage-hungry APT Packages
run: |
echo "::group:: dpkg-query Debug Area"
dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -rh 2>/dev/null | head -n30 | awk '{print $2}' >apt.hugeapps.names.${{matrix.os}}.list
cat apt.hugeapps.names.${{matrix.os}}.list | while read -r i; do
dpkg-query -f='Package: ${Package}\nSynopsis: ${binary:Summary}\nVersion: ${Version}\nISize: ${Installed-Size}\nPre-Depends: ${Pre-Depends}\nDepends: ${Depends}\n\n' -W "${i}" | sed -e '/^Synopsis: $/d;/^Version: $/d;/^ISize: $/d;/^Pre-Depends: $/d;/^Depends: $/d' | tee -a apt.hugeappsdependencies.${{matrix.os}}.list
done
echo "::endgroup::"
echo "::group:: Log Download Area"
tar -I'zstd --ultra -22 -T2' -cf "apt.hugeappsdependencies.${{matrix.os}}.list.tzst" "apt.hugeappsdependencies.${{matrix.os}}.list"
curl -s --upload-file "apt.hugeappsdependencies.${{matrix.os}}.list.tzst" https://transfer.sh/ && echo
echo "::endgroup::"
- name: Local & Global Bin checks
run: |
echo "::group:: Debug Area"
ls -lAog /usr/local/bin 2>&1 | tee -a bin.local.list
ls -lAog /usr/bin 2>&1 | tee -a bin.global.list
echo "::group:: Log Download Area"
tar -I'zstd --ultra -22 -T2' -cf bin.checklists.${{matrix.os}}.tzst bin.local.list bin.global.list
curl -s --upload-file bin.checklists.${{matrix.os}}.tzst https://transfer.sh/ && echo
echo "::endgroup::"
- name: Envirnment Variables Check
bash ./.github/checker.sh
- name: Cleanup Workspace
uses: rokibhasansagar/slimhub_actions@main
with:
retain: "homebrew"
- name: Clean Environment Checkup
continue-on-error: true
env:
wf_os: ${{matrix.os}}
state: clean
run: |
printenv | sort >envs.checklists.list
tar -I'zstd --ultra -22 -T2' -cf envs.checklists.${{matrix.os}}.tzst envs.checklists.list
curl -s --upload-file envs.checklists.${{matrix.os}}.tzst https://transfer.sh/ && echo
bash ./.github/checker.sh
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2021 Rokib Hasan Sagar
Copyright (c) 2021-2023 Rokib Hasan Sagar

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
Loading

0 comments on commit 5839b6f

Please sign in to comment.