From 0c904305e9f585ff716245e17d45341e8a1057e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Lumbroso?= Date: Wed, 22 Jun 2022 04:24:46 -0400 Subject: [PATCH] Adding continuous integration testing --- .github/workflows/test.yml | 10 ++++++++++ action.yml | 18 +++++++++--------- 2 files changed, 19 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..61c04d1 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,10 @@ +name: Free Disk Space (Ubuntu) +on: push + +jobs: + free-disk-space: + runs-on: ubuntu-latest + steps: + # If there is a problem with this GitHub Actions, this step will fail + - name: Free Disk Space + uses: jlumbroso/free-disk-space@main diff --git a/action.yml b/action.yml index 2401588..32ddfed 100644 --- a/action.yml +++ b/action.yml @@ -34,20 +34,20 @@ runs: # macro to print a line of equals # REF: https://stackoverflow.com/a/5799353/408734 printSeparationLine() { - str=${1:'*'} + str=${1:=} num=${2:-80} - v=$(printf "%-${num}s" "$str") - echo "${v// /*}" + v=$(printf "%0.s${str}" {1..$num}) + echo "${v}" } # macro to compute available space # REF: https://unix.stackexchange.com/a/42049/60849 # REF: https://stackoverflow.com/a/450821/408734 - getAvailableSpace() { echo $(df -a | awk 'NR > 1 {avail+=$4} END {print avail}') } + getAvailableSpace() { echo $(df -a | awk 'NR > 1 {avail+=$4} END {print avail}'); } # macro to make bytecounts human readable # REF: https://unix.stackexchange.com/a/44087/60849 - formatByteCount() { echo $(numfmt --to=iec-i --suffix=B --padding=7 $1) } + formatByteCount() { echo $(numfmt --to=iec-i --suffix=B --padding=7 $1); } # macro to output saved space printSavedSpace() { @@ -69,13 +69,13 @@ runs: printDH() { caption=${1:-} - repeatedLine '=' 80 + printSeparationLine '=' 80 echo "${caption}" echo "" echo "$ dh -h /" echo "" df -h / - repeatedLine '=' 80 + printSeparationLine '=' 80 } # ====== @@ -123,7 +123,7 @@ runs: AFTER=$(getAvailableSpace) SAVED=$((AFTER-BEFORE)) - printSavedSpace $SAVED ".NET runtime" + printSavedSpace $SAVED "Haskell runtime" fi # Option: Remove Swap storage @@ -137,7 +137,7 @@ runs: AFTER=$(getAvailableSpace) SAVED=$((AFTER-BEFORE)) - printSavedSpace $SAVED ".NET runtime" + printSavedSpace $SAVED "Swap storage" fi