Renew Scripts
- Add Support For Both Ubuntu Focal and Bionic Runners - Update README - Added branding Signed-off-by: rokibhasansagar <rokibhasansagar2014@outlook.com>
This commit is contained in:
parent
4da5305d64
commit
fd0023c401
3 changed files with 90 additions and 177 deletions
74
README.md
74
README.md
|
@ -1,7 +1,8 @@
|
||||||
# *rokibhasansagar/slimhub_actions@main*
|
# *rokibhasansagar/slimhub_actions@main*
|
||||||
![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/rokibhasansagar/slimhub_actions?label=Latest%20Tag&?cacheSeconds=600)
|
|
||||||
|
|
||||||
### *GitHub Actions Cleaner*
|
![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/rokibhasansagar/slimhub_actions?label=Latest%20Tag&?cacheSeconds=300)
|
||||||
|
|
||||||
|
## *GitHub Actions Cleaner*
|
||||||
|
|
||||||
A simple composite run steps action to clean the GitHub Actions environment to bare minimum.
|
A simple composite run steps action to clean the GitHub Actions environment to bare minimum.
|
||||||
When you don't really need any extra software rather than core functions of Ubuntu itself, you would want to use this.
|
When you don't really need any extra software rather than core functions of Ubuntu itself, you would want to use this.
|
||||||
|
@ -12,63 +13,30 @@ That gives you only 22GB playground.
|
||||||
But with this action, you can gain up to 78GB! That means around 56GB can be freed!
|
But with this action, you can gain up to 78GB! That means around 56GB can be freed!
|
||||||
>More space can be gained. Work is undergoing to achieve that.
|
>More space can be gained. Work is undergoing to achieve that.
|
||||||
|
|
||||||
## *Requirement*
|
|
||||||
|
|
||||||
Nothing really, just your Actions Runner needs to be run on **ubuntu-20.04**.
|
|
||||||
```yaml
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-20.04
|
|
||||||
```
|
|
||||||
Bionic support will be added later.
|
|
||||||
|
|
||||||
## *How To Use*
|
## *How To Use*
|
||||||
|
|
||||||
|
Your Workflow must run on Ubuntu Runners, bionic or focal.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
# ...
|
||||||
# ...
|
jobs:
|
||||||
# You might want to Checkout your repo first, but not necessary.
|
slim_build:
|
||||||
# Cleanup The Actions Workspace Using Custom Composite Run Actions
|
runs-on: ubuntu-latest
|
||||||
- uses: rokibhasansagar/slimhub_actions@main
|
# You can use either of the ubuntu-18.04 or ubuntu-20.04 runner
|
||||||
# That's it! Now use your normal steps
|
steps:
|
||||||
# ...
|
# You might want to Checkout your repo first, but not mandatory
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
# Cleanup The Actions Workspace Using Custom Composite Run Actions
|
||||||
|
- uses: rokibhasansagar/slimhub_actions@main
|
||||||
|
# That's it! Now use your normal steps
|
||||||
|
# ...
|
||||||
```
|
```
|
||||||
|
|
||||||
## *Things Removed*
|
### *What Are Removed*
|
||||||
|
|
||||||
The main programs removed by this action are -
|
See the [script](cleanup.sh) itself to know what exactly are stripped.
|
||||||
```text
|
|
||||||
- adoptopenjdk-11 & adoptopenjdk-8
|
Don't cry if any further steps using other Actions or scripts fail due to *command not found*. You have to manually install every prerequisite programs which would seem to be unavailable to run your particular script(s).
|
||||||
- android-sdk and ndk
|
|
||||||
- ant, apache-maven, gradle, hhvm, julia, lein
|
|
||||||
- swift, miniconda
|
|
||||||
- azure-cli, aws-cli, vim
|
|
||||||
- buildah, ghc
|
|
||||||
- cabal*
|
|
||||||
- clang-9,clang-8, llvm-8 & lld-8
|
|
||||||
- Docker Image Caches
|
|
||||||
- dotnet, graalvm, powershell
|
|
||||||
- erlang, php*, ruby, rake, rust & swig
|
|
||||||
- gcc-7, g++-7, cpp-7
|
|
||||||
- gcc-8, g++-8, cpp-8
|
|
||||||
- groff-base
|
|
||||||
- firefox
|
|
||||||
- google*
|
|
||||||
- Homebrew
|
|
||||||
- hostedtoolcache preconfigured packages
|
|
||||||
- heroku
|
|
||||||
- imagemagick*
|
|
||||||
- libreoffice*
|
|
||||||
- man-db & manpages
|
|
||||||
- mongodb, mysql & postgresql
|
|
||||||
- mono*
|
|
||||||
- mercurial, subversion
|
|
||||||
- node_modules
|
|
||||||
- phantomjs, chrome_driver, gecko_driver, xvfb
|
|
||||||
- python2 & pip local packages
|
|
||||||
- podman
|
|
||||||
```
|
|
||||||
*Yet, More To Remove In The Future*
|
|
||||||
|
|
||||||
## *Inspired By*
|
## *Inspired By*
|
||||||
|
|
||||||
|
|
|
@ -7,4 +7,6 @@ runs:
|
||||||
- run: $GITHUB_ACTION_PATH/cleanup.sh
|
- run: $GITHUB_ACTION_PATH/cleanup.sh
|
||||||
name: 'Cleanup'
|
name: 'Cleanup'
|
||||||
shell: bash
|
shell: bash
|
||||||
|
branding:
|
||||||
|
icon: 'layers'
|
||||||
|
color: 'blue'
|
||||||
|
|
189
cleanup.sh
189
cleanup.sh
|
@ -10,9 +10,9 @@ export DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
# Prepare
|
# Prepare
|
||||||
while ((${SECONDS_LEFT:=5} > 0)); do
|
while ((${SECONDS_LEFT:=5} > 0)); do
|
||||||
printf "Please wait %ss ...\n" "${SECONDS_LEFT}"
|
printf "Please wait %ss ...\n" "${SECONDS_LEFT}"
|
||||||
sleep 1
|
sleep 1
|
||||||
SECONDS_LEFT=$((${SECONDS_LEFT} - 1))
|
SECONDS_LEFT=$((SECONDS_LEFT - 1))
|
||||||
done
|
done
|
||||||
unset SECONDS_LEFT
|
unset SECONDS_LEFT
|
||||||
|
|
||||||
|
@ -25,101 +25,39 @@ docker rmi -f $(docker images -q) &>/dev/null
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
|
|
||||||
echo "::group::Uninstalling Unnecessary Applications"
|
echo "::group::Uninstalling Unnecessary Applications"
|
||||||
sudo -E apt-get -qq -y update &>/dev/null
|
sudo -EH apt-get -qq -y update &>/dev/null
|
||||||
sudo -E apt-get -qq -y purge \
|
REL=$(grep "UBUNTU_CODENAME" /etc/os-release | cut -d'=' -f2)
|
||||||
adoptopenjdk-* \
|
if [[ ${REL} == "focal" ]]; then
|
||||||
adwaita-icon-theme \
|
APT_Pac4Purge="alsa-topology-conf alsa-ucm-conf python2 python2-minimal libpython-dev clang-9 clang-format-9"
|
||||||
aisleriot \
|
elif [[ ${REL} == "bionic" ]]; then
|
||||||
alsa-* \
|
APT_Pac4Purge="clang-6.0 clang-format-6.0 llvm-6.0-dev lld-6.0"
|
||||||
ant* \
|
fi
|
||||||
ansible \
|
unset REL
|
||||||
apache2* \
|
sudo -EH apt-get -qq -y purge \
|
||||||
apport* \
|
${APT_Pac4Purge} \
|
||||||
aspnetcore-* \
|
adoptopenjdk-* openjdk* ant* sbt \
|
||||||
azure-cli \
|
*-icon-theme plymouth *-theme* fonts-* gsfonts gtk-update-icon-cache \
|
||||||
|
ansible google-cloud-sdk heroku \
|
||||||
|
apache2* nginx msodbcsql* mssql-tools mysql* libmysqlclient* unixodbc-dev postgresql* libpq-dev odbcinst* mongodb-* sphinxsearch \
|
||||||
|
apport* popularity-contest \
|
||||||
|
aspnetcore-* dotnet* \
|
||||||
|
azure-cli session-manager-plugin \
|
||||||
bazel* \
|
bazel* \
|
||||||
brltty \
|
brltty byobu htop \
|
||||||
buildah \
|
buildah hhvm kubectl packagekit* podman podman-plugins skopeo \
|
||||||
byobu \
|
chromium-browser firebird* firefox google-chrome* xvfb \
|
||||||
cabal-* \
|
clang-8 clang-format-8 cpp-7 cpp-8 lld-8 llvm-8* \
|
||||||
chromium-browser \
|
esl-erlang ghc-* groff-base rake r-base* r-cran-* r-recommended ruby* swig* \
|
||||||
clang-8 clang-format-8 \
|
g++-7* gcc-7* g++-8* gcc-8* gfortran* \
|
||||||
clang-9 clang-format-9 \
|
gh subversion mercurial mercurial-common \
|
||||||
cpp-7 cpp-8 \
|
info install-info landscape-common \
|
||||||
dotnet* \
|
libpython2* imagemagick* vim vim-* \
|
||||||
duplicity \
|
|
||||||
empathy \
|
|
||||||
empathy-common \
|
|
||||||
erlang* esl-erlang \
|
|
||||||
example-content \
|
|
||||||
firebird* firefox \
|
|
||||||
fontconfig* fonts-* \
|
|
||||||
g++-7* gcc-7* \
|
|
||||||
g++-8* gcc-8* \
|
|
||||||
gfortran* \
|
|
||||||
gh \
|
|
||||||
ghc* \
|
|
||||||
gnome-accessibility-themes \
|
|
||||||
google-chrome* google-cloud-sdk \
|
|
||||||
groff-base \
|
|
||||||
gsfonts \
|
|
||||||
gtk-update-icon-cache \
|
|
||||||
heroku \
|
|
||||||
hhvm \
|
|
||||||
hicolor-icon-theme \
|
|
||||||
htop \
|
|
||||||
humanity-icon-theme \
|
|
||||||
imagemagick* \
|
|
||||||
info \
|
|
||||||
install-info \
|
|
||||||
irqbalance \
|
|
||||||
kubectl \
|
|
||||||
landscape-common \
|
|
||||||
libclang1-8 libclang-common-8-dev \
|
|
||||||
libmono-* \
|
|
||||||
libpython2* \
|
|
||||||
libreoffice-* \
|
|
||||||
libsane libsane-common \
|
|
||||||
lld-8 llvm-8* \
|
|
||||||
man-db manpages \
|
man-db manpages \
|
||||||
mercurial mercurial-common \
|
mono-* mono* libmono-* \
|
||||||
mongodb-* \
|
nuget packages-microsoft-prod snapd yarn \
|
||||||
mono-* mono* \
|
|
||||||
msodbcsql* mssql-tools mysql* libmysqlclient* unixodbc-dev \
|
|
||||||
nginx \
|
|
||||||
nuget \
|
|
||||||
odbcinst* \
|
|
||||||
openjdk* \
|
|
||||||
packagekit* \
|
|
||||||
packages-microsoft-prod \
|
|
||||||
php-* php5* php7* php8* snmp \
|
php-* php5* php7* php8* snmp \
|
||||||
plymouth plymouth-theme-ubuntu-text \
|
&>/dev/null
|
||||||
podman podman-plugins \
|
sudo -EH apt-get -qq -y autoremove &>/dev/null
|
||||||
poppler-data \
|
|
||||||
popularity-contest \
|
|
||||||
postgresql* libpq-dev \
|
|
||||||
printer-driver-* \
|
|
||||||
python2 python2-minimal \
|
|
||||||
rake r-base* r-cran-* r-recommended ruby* \
|
|
||||||
rhythmbox rhythmbox-plugin* \
|
|
||||||
sane-utils \
|
|
||||||
sbt \
|
|
||||||
session-manager-plugin \
|
|
||||||
shotwell* \
|
|
||||||
skopeo \
|
|
||||||
snapd \
|
|
||||||
sphinxsearch \
|
|
||||||
sound-theme-freedesktop \
|
|
||||||
subversion \
|
|
||||||
swig* \
|
|
||||||
telepathy-* \
|
|
||||||
totem* \
|
|
||||||
ubuntu-mono \
|
|
||||||
vim vim-* \
|
|
||||||
xvfb \
|
|
||||||
yarn \
|
|
||||||
zulu* &>/dev/null
|
|
||||||
sudo -E apt-get -qq -y autoremove &>/dev/null
|
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
|
|
||||||
echo "::group::Removing Homebrew Completely"
|
echo "::group::Removing Homebrew Completely"
|
||||||
|
@ -130,16 +68,16 @@ echo "::endgroup::"
|
||||||
|
|
||||||
echo "::group::Removing NodeJS, NPM & NPX"
|
echo "::group::Removing NodeJS, NPM & NPX"
|
||||||
{
|
{
|
||||||
sudo npm list -g --depth=0. 2>/dev/null | awk -F ' ' '{print $2}' | awk -F '@[0-9]' '{print $1}' | sudo xargs npm remove -g
|
sudo npm list -g --depth=0. 2>/dev/null | awk -F ' ' '{print $2}' | awk -F '@[0-9]' '{print $1}' | grep -v "^n$" | sudo xargs npm remove -g
|
||||||
yes | sudo n uninstall
|
yes | sudo n uninstall
|
||||||
sudo rm -rf -- /usr/local/lib/node_modules /usr/local/n \
|
sudo rm -rf -- /usr/local/lib/node_modules /usr/local/n /usr/local/bin/n \
|
||||||
/usr/local/bin/vercel /usr/local/bin/now
|
/usr/local/bin/vercel /usr/local/bin/now
|
||||||
} 2>/dev/null
|
} 2>/dev/null
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
|
|
||||||
echo "::group::Purging PIPX & PIP packages"
|
echo "::group::Purging PIPX & PIP packages"
|
||||||
{
|
{
|
||||||
pipx uninstall-all && sudo pip uninstall -q -y pipx
|
pipx uninstall-all && sudo pip3 uninstall -q -y pipx
|
||||||
find /usr/share /usr/lib ~/.local/lib -depth -type d -name __pycache__ \
|
find /usr/share /usr/lib ~/.local/lib -depth -type d -name __pycache__ \
|
||||||
-exec rm -rf '{}' + 2>/dev/null;
|
-exec rm -rf '{}' + 2>/dev/null;
|
||||||
} 2>/dev/null
|
} 2>/dev/null
|
||||||
|
@ -148,33 +86,38 @@ echo "::endgroup::"
|
||||||
echo "::group::Removing Lots of Cached Programs & Unneeded Folders"
|
echo "::group::Removing Lots of Cached Programs & Unneeded Folders"
|
||||||
{
|
{
|
||||||
printf "Removing Runner Tool Cache...\n"
|
printf "Removing Runner Tool Cache...\n"
|
||||||
sudo rm -rf -- /opt/hostedtoolcache/*
|
sudo rm -rf -- /opt/hostedtoolcache
|
||||||
printf "Removing Android SDK, NDK, Platform Tools, Gradle, Maven...\n"
|
printf "Removing Android SDK, NDK, Platform Tools, Gradle, Maven...\n"
|
||||||
sudo rm -rf -- /usr/local/lib/android
|
sudo rm -rf -- /usr/local/lib/android \
|
||||||
sudo rm -rf -- /usr/share/gradle* /usr/bin/gradle /usr/share/apache-maven* /usr/bin/mvn
|
/usr/share/gradle* /usr/bin/gradle /usr/share/apache-maven* /usr/bin/mvn
|
||||||
printf "Removing Microsoft vcpkg, Miniconda, Leiningen, Pulumi...\n"
|
printf "Removing Microsoft vcpkg, Miniconda, Leiningen, Pulumi...\n"
|
||||||
sudo rm -rf -- /usr/local/share/vcpkg /usr/local/bin/vcpkg
|
sudo rm -rf -- /usr/local/share/vcpkg /usr/local/bin/vcpkg \
|
||||||
sudo rm -rf -- /usr/share/miniconda /usr/bin/conda
|
/usr/share/miniconda /usr/bin/conda \
|
||||||
sudo rm -rf -- /usr/local/lib/lein /usr/local/bin/lein /usr/local/bin/pulumi*
|
/usr/local/lib/lein /usr/local/bin/lein /usr/local/bin/pulumi*
|
||||||
printf "Removing Browser-based Webdrivers...\n"
|
printf "Removing Browser-based Webdrivers...\n"
|
||||||
sudo rm -rf -- /usr/share/java/selenium-server-standalone.jar \
|
sudo rm -rf -- /usr/share/java/selenium-server-standalone.jar \
|
||||||
/usr/local/share/phantomjs* /usr/local/bin/phantomjs \
|
/usr/local/share/phantomjs* /usr/local/bin/phantomjs \
|
||||||
/usr/local/share/chrome_driver /usr/bin/chromedriver \
|
/usr/local/share/chrome_driver /usr/bin/chromedriver \
|
||||||
/usr/local/share/gecko_driver /usr/bin/geckodriver
|
/usr/local/share/gecko_driver /usr/bin/geckodriver
|
||||||
printf "Removing PHP, Composer, Database Management Program Remains...\n"
|
printf "Removing PHP, Composer, Database Management Program Remains...\n"
|
||||||
sudo rm -rf -- /etc/php /usr/bin/composer /usr/local/bin/phpunit
|
sudo rm -rf -- /etc/php /usr/bin/composer /usr/local/bin/phpunit \
|
||||||
sudo rm -rf -- /etc/mysql /usr/local/bin/sqlcmd /usr/local/bin/bcp
|
/var/lib/mysql /etc/mysql /usr/local/bin/sqlcmd /usr/local/bin/bcp \
|
||||||
printf "Removing Julia, Rust, Cargo, Swift, Haskell, Erlang...\n"
|
/usr/local/bin/session-manager-plugin
|
||||||
sudo rm -rf -- /usr/local/julia* /usr/bin/julia
|
printf "Removing Julia, Rust, Cargo, Rubugems, Rake, Swift, Haskell, Erlang...\n"
|
||||||
sudo rm -rf -- /usr/share/rust /home/runner/.cargo /home/runner/.rustup
|
sudo rm -rf -- /usr/local/julia* /usr/bin/julia \
|
||||||
sudo rm -rf -- /usr/share/swift /usr/local/bin/swift /usr/local/bin/swiftc
|
/usr/share/rust /home/runner/.cargo /home/runner/.rustup \
|
||||||
sudo rm -rf -- /usr/bin/ghc /usr/bin/cabal /usr/local/bin/stack
|
/usr/local/bin/rake /usr/local/bin/rdoc /usr/local/bin/ri /usr/local/bin/racc /usr/local/bin/rougify \
|
||||||
sudo rm -rf -- /usr/local/bin/rebar3
|
/usr/local/bin/bundle /usr/local/bin/bundler /var/lib/gems \
|
||||||
|
/usr/share/swift /usr/local/bin/swift /usr/local/bin/swiftc \
|
||||||
|
/usr/bin/ghc /usr/local/.ghcup /usr/local/bin/stack \
|
||||||
|
/usr/local/bin/rebar3 \
|
||||||
|
/usr/bin/go /usr/bin/gofmt
|
||||||
printf "Removing Various Cloud CLI Tools...\n"
|
printf "Removing Various Cloud CLI Tools...\n"
|
||||||
sudo rm -rf -- /usr/local/bin/aws /usr/local/bin/aws_completer /usr/local/aws-cli /usr/local/aws
|
sudo rm -rf -- /usr/local/bin/aws /usr/local/bin/aws_completer /usr/local/aws-cli /usr/local/aws \
|
||||||
sudo rm -rf -- /usr/local/bin/aliyun /usr/share/az_* /opt/az /usr/bin/az \
|
/usr/local/bin/aliyun /usr/share/az_* /opt/az /usr/bin/az \
|
||||||
/usr/local/bin/azcopy10 /usr/bin/azcopy /usr/lib/azcopy
|
/usr/local/bin/azcopy10 /usr/bin/azcopy /usr/lib/azcopy \
|
||||||
sudo rm -rf -- /usr/local/bin/oc /usr/local/bin/oras
|
/usr/local/bin/oc /usr/local/bin/oras \
|
||||||
|
/usr/local/bin/README.md
|
||||||
printf "Removing Different Kubernetes & Container Management Programs...\n"
|
printf "Removing Different Kubernetes & Container Management Programs...\n"
|
||||||
sudo rm -rf -- /usr/local/bin/packer /usr/local/bin/terraform \
|
sudo rm -rf -- /usr/local/bin/packer /usr/local/bin/terraform \
|
||||||
/usr/local/bin/helm /usr/local/bin/kubectl /usr/local/bin/kind \
|
/usr/local/bin/helm /usr/local/bin/kubectl /usr/local/bin/kind \
|
||||||
|
@ -186,17 +129,17 @@ echo "::group::Removing Lots of Cached Programs & Unneeded Folders"
|
||||||
sudo rm -rf -- /usr/local/graalvm
|
sudo rm -rf -- /usr/local/graalvm
|
||||||
printf "Removing Manpages...\n"
|
printf "Removing Manpages...\n"
|
||||||
sudo rm -rf -- /usr/share/man
|
sudo rm -rf -- /usr/share/man
|
||||||
|
printf "Clearing Remains of Apt Packages...\n"
|
||||||
|
sudo rm -rf -- /var/lib/apt/lists/* /var/cache/apt/archives/* /etc/apt/sources.list.d/*
|
||||||
} 2>/dev/null
|
} 2>/dev/null
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
|
|
||||||
echo "::group::Clearing Remains of Apt Packages"
|
echo "::group::Clearing Unwanted Environment Variables"
|
||||||
{
|
{
|
||||||
sudo -E apt-get -qq -y clean && sudo -E apt-get -qq -y autoremove
|
sudo sed -i -e '/^PATH=/d;/hostedtoolcache/d;/^AZURE/d;/^SWIFT/d;/^DOTNET/d;/DRIVER/d;/^CHROME/d;/HASKELL/d;/^JAVA/d;/^SELENIUM/d;/^GRAALVM/d;/^ANT/d;/^GRADLE/d;/^LEIN/d;/^CONDA/d;/^VCPKG/d;/^ANDROID/d;/^PIPX/d;/^HOMEBREW/d;' /etc/environment
|
||||||
sudo rm -rf -- /var/lib/apt/lists/* /var/cache/apt/archives/* /etc/apt/sources.list.d/*
|
sudo sed -i '1i PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' /etc/environment
|
||||||
export PATH="/snap/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
sed -i '/HOME\/\.local\/bin/d' /home/runner/.bashrc
|
||||||
sed -i '/.dotnet/d' ~/.bashrc 2>/dev/null
|
source /home/runner/.bashrc
|
||||||
sed -i '/.config\/composer/d' ~/.bashrc 2>/dev/null
|
|
||||||
. ~/.bashrc 2>/dev/null
|
|
||||||
} 2>/dev/null
|
} 2>/dev/null
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue