Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
rcannood committed Jun 16, 2023
1 parent eca0a7b commit 8a2a819
Show file tree
Hide file tree
Showing 6 changed files with 627 additions and 149 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/measure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ jobs:
strategy:
fail-fast: false
matrix:
setting: [hosted-tool-cache, go, codeql, powershell, android-sdk, haskell-ghc, swift, dotnet, docker-images, swap]
os: [ubuntu-20.04, ubuntu-22.04]
setting: [hosted-tool-cache, go, python, codeql, powershell, android-sdk, haskell-ghc, swift, dotnet, docker-images, swap]
run: [1, 2, 3, 4, 5]

steps:
Expand All @@ -35,7 +35,6 @@ jobs:
with:
remove-hosted-tool-cache: ${{ matrix.setting == 'hosted-tool-cache' }}
remove-go: ${{ matrix.setting == 'go' }}
remove-python: ${{ matrix.setting == 'python' }}
remove-codeql: ${{ matrix.setting == 'codeql' }}
remove-powershell: ${{ matrix.setting == 'powershell' }}
remove-android-sdk: ${{ matrix.setting == 'android-sdk' }}
Expand Down
83 changes: 58 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The inspiration for this action:

- [easimon/maximize-build-space](https://github.com/easimon/maximize-build-space)
- [ThewApp/free-actions](https://github.com/ThewApp/free-actions)
- [Other GitHub
actions](https://github.com/search?q=%22rm+-rf+%2Fusr%2Fshare%2Fdotnet%22&type=code)
- [This
discussion](https://github.com/actions/runner-images/discussions/3242)

**Caveat:** Removal of unnecessary software is implemented by `rm -rf`
on specific folders, not by using a package manager or anything
Expand All @@ -29,30 +33,49 @@ jobs:
- name: Reclaim the bytes
uses: data-intuitive/reclaim-the-bytes@v1
with:
remove-hosted-tool-cache: true
remove-go: false
remove-codeql: false
remove-powershell: false
remove-android-sdk: true
remove-haskell-ghc: true
remove-swift: true
remove-dotnet: true
remove-android: true
remove-haskell: true
remove-codeql: true
remove-docker-images: true
remove-large-packages: false
remove-swap: true

- name: Checkout
uses: actions/checkout@v3

- name: Build
- name: Report free space
run: |
echo "Free space:"
df -h
```
## Inputs
- `remove-dotnet`: Remove .NET runtime and libraries. Default: `true`.
- `remove-android`: Remove Android SDKs and Tools. Default: `true`.
- `remove-haskell`: Remove GHC (Haskell) artifacts. Default: `true`.
- `remove-codeql`: Remove CodeQL Action Bundles. Default: `true`.
- `remove-docker-images`: Remove cached Docker images. Default: `true`.
- `remove-large-packages`: Remove large packages. Default: `false`.
- `remove-hosted-tool-cache`: Remove the hosted tool cache, including
Go, CodeQL, Powershell. Execution time: 5s. Space freed: 10GB.
Default: `true`.
- `remove-go`: Remove Go libraries. Execution time: 2s. Space freed:
1GB. Default: `false`.
- `remove-codeql`: Remove CodeQL. Execution time: 1s. Space freed: 6GB.
Default: `false`.
- `remove-powershell`: Remove PowerShell. Execution time: 1s. Space
freed: 1GB. Default: `false`.
- `remove-android-sdk`: Remove Android SDK. Execution time: 35s. Space
freed: 12GB. Default: `true`.
- `remove-haskell-ghc`: Remove Haskell GHC. Execution time: 3s. Space
freed: 5GB. Default: `true`.
- `remove-swift`: Remove Swift. Execution time: 1s. Space freed: 2GB.
Default: `true`.
- `remove-dotnet`: Remove .NET libraries. Execution time: 5s. Space
freed: 2GB. Default: `true`.
- `remove-docker-images`: Remove cached Docker images. Execution time:
18s. Space freed: 5GB. Default: `true`.
- `remove-swap`: Remove swap. Execution time: 1s. Space freed: 5GB on
/mnt. Default: `true`.

## Measurements

Expand All @@ -61,19 +84,29 @@ account whether the software is needed or not, but also how long it
takes to remove vs. the amount of disk space removing it frees up. Here
is a visualisation of that information.

| Software | OS | Duration (s) | Space freed (GB) |
|:---------------|:-------------|-------------:|-----------------:|
| android | ubuntu-20.04 | 34.8 | 12 |
| android | ubuntu-22.04 | 37.2 | 13 |
| codeql | ubuntu-20.04 | 1.0 | 6 |
| codeql | ubuntu-22.04 | 1.4 | 6 |
| docker-images | ubuntu-20.04 | 19.8 | 5 |
| docker-images | ubuntu-22.04 | 11.4 | 4 |
| dotnet | ubuntu-20.04 | 8.6 | 3 |
| dotnet | ubuntu-22.04 | 2.4 | 2 |
| haskell | ubuntu-20.04 | 0.4 | 0 |
| haskell | ubuntu-22.04 | 0.4 | 0 |
| large-packages | ubuntu-20.04 | 174.2 | 6 |
| large-packages | ubuntu-22.04 | 117.2 | 5 |
| Software | OS | Duration (s) | Space freed (GB) |
|:------------------|:-------------|-------------:|-----------------:|
| android-sdk | ubuntu-20.04 | 26.8 | 12 |
| android-sdk | ubuntu-22.04 | 37.0 | 13 |
| codeql | ubuntu-20.04 | 1.0 | 6 |
| codeql | ubuntu-22.04 | 1.0 | 6 |
| docker-images | ubuntu-20.04 | 18.4 | 5 |
| docker-images | ubuntu-22.04 | 17.0 | 4 |
| dotnet | ubuntu-20.04 | 5.6 | 3 |
| dotnet | ubuntu-22.04 | 2.2 | 2 |
| go | ubuntu-20.04 | 2.2 | 1 |
| go | ubuntu-22.04 | 1.2 | 2 |
| haskell-ghc | ubuntu-20.04 | 2.8 | 5 |
| haskell-ghc | ubuntu-22.04 | 3.4 | 5 |
| hosted-tool-cache | ubuntu-20.04 | 5.0 | 10 |
| hosted-tool-cache | ubuntu-22.04 | 3.4 | 9 |
| powershell | ubuntu-20.04 | 0.8 | 1 |
| powershell | ubuntu-22.04 | 0.6 | 2 |
| python | ubuntu-20.04 | 0.0 | 0 |
| python | ubuntu-22.04 | 0.4 | 0 |
| swap | ubuntu-20.04 | 0.0 | 0 |
| swap | ubuntu-22.04 | 0.0 | 0 |
| swift | ubuntu-20.04 | 0.6 | 2 |
| swift | ubuntu-22.04 | 0.4 | 2 |

![](resources/README_files/measurements-plot-1.png)
24 changes: 15 additions & 9 deletions README.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,21 @@ The inspiration for this action:

- [easimon/maximize-build-space](https://github.com/easimon/maximize-build-space)
- [ThewApp/free-actions](https://github.com/ThewApp/free-actions)
- [Other GitHub actions](https://github.com/search?q=%22rm+-rf+%2Fusr%2Fshare%2Fdotnet%22&type=code)
- [This discussion](https://github.com/actions/runner-images/discussions/3242)

**Caveat:** Removal of unnecessary software is implemented by `rm -rf` on specific folders, not by using a package manager or anything sophisticated. While this is quick and easy, it might delete dependencies that are required by your job and so break your build (e.g. because your build job uses a .NET based tool and you removed the required runtime). Please verify which software may or may not be removed for your specific use case.

## Usage

```yaml
```{r}
#| echo: false
entries <- map_chr(names(action$inputs), function(name) {
input <- action$inputs[[name]]
glue::glue(" {name}: {input$default}")
})
str <- glue::glue("```yaml
name: My build action requiring more space
on: push
Expand All @@ -36,20 +45,17 @@ jobs:
- name: Reclaim the bytes
uses: data-intuitive/reclaim-the-bytes@v1
with:
remove-dotnet: true
remove-android: true
remove-haskell: true
remove-codeql: true
remove-docker-images: true
remove-large-packages: false
{paste(entries, collapse = \"\n\")}
- name: Checkout
uses: actions/checkout@v3
- name: Build
- name: Report free space
run: |
echo "Free space:"
echo \"Free space:\"
df -h
```")
knitr::asis_output(str)
```

## Inputs
Expand Down
30 changes: 10 additions & 20 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,47 +5,43 @@ branding:
color: 'orange'
inputs:
remove-hosted-tool-cache:
description: 'Remove the hosted tool cache, including Go, Python, CodeQL, Powershell. Default: `true`.'
description: 'Remove the hosted tool cache, including Go, CodeQL, Powershell. Execution time: 5s. Space freed: 10GB. Default: `true`.'
required: false
default: 'true'
remove-go:
description: 'Remove Go libraries. Default: `false`.'
required: false
default: 'false'
remove-python:
description: 'Remove Python libraries. Default: `false`.'
description: 'Remove Go libraries. Execution time: 2s. Space freed: 1GB. Default: `false`.'
required: false
default: 'false'
remove-codeql:
description: 'Remove CodeQL. Default: `false`.'
description: 'Remove CodeQL. Execution time: 1s. Space freed: 6GB. Default: `false`.'
required: false
default: 'false'
remove-powershell:
description: 'Remove PowerShell. Default: `false`.'
description: 'Remove PowerShell. Execution time: 1s. Space freed: 1GB. Default: `false`.'
required: false
default: 'false'
remove-android-sdk:
description: 'Remove Android SDK. Default: `true`.'
description: 'Remove Android SDK. Execution time: 35s. Space freed: 12GB. Default: `true`.'
required: false
default: 'true'
remove-haskell-ghc:
description: 'Remove Haskell GHC. Default: `true`.'
description: 'Remove Haskell GHC. Execution time: 3s. Space freed: 5GB. Default: `true`.'
required: false
default: 'true'
remove-swift:
description: 'Remove Swift. Default: `true`.'
description: 'Remove Swift. Execution time: 1s. Space freed: 2GB. Default: `true`.'
required: false
default: 'true'
remove-dotnet:
description: 'Remove .NET. Default: `true`.'
description: 'Remove .NET libraries. Execution time: 5s. Space freed: 2GB. Default: `true`.'
required: false
default: 'true'
remove-docker-images:
description: 'Remove cached Docker images. Default: `true`.'
description: 'Remove cached Docker images. Execution time: 18s. Space freed: 5GB. Default: `true`.'
required: false
default: 'true'
remove-swap:
description: 'Remove swap. Default: `true`.'
description: 'Remove swap. Execution time: 1s. Space freed: 5GB on /mnt. Default: `true`.'
required: false
default: 'true'
runs:
Expand All @@ -67,12 +63,6 @@ runs:
run: |
sudo rm -rf /opt/hostedtoolcache/go
- name: Remove Python
shell: bash
if: inputs.remove-python == 'true'
run: |
sudo rm -rf /opt/hostedtoolcache/python
- name: Remove CodeQL
shell: bash
if: inputs.remove-codeql == 'true'
Expand Down
Binary file modified resources/README_files/measurements-plot-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 8a2a819

Please sign in to comment.