Skip to content

Commit 9108a9a

Browse files
authored
fix(ci): Free disk space action (#26318)
The previous github action used did not work. The reason is that it was run inside the (dependency) container where the commands did not run (sudo not found) as well as the files to be deleted were not present. This fix mounts the host path that contains the files to be deleted into the container and we can run custom commands to clean up disk space. ## Description <!---Describe your changes in detail--> ## Motivation and Context <!---Why is this change required? What problem does it solve?--> <!---If it fixes an open issue, please link to the issue here.--> ## Impact <!---Describe any public API or user-facing feature change or any performance impact--> ## Test Plan <!---Please fill in how you tested your change--> ## Contributor checklist - [ ] Please make sure your submission complies with our [contributing guide](https://github.com/prestodb/presto/blob/master/CONTRIBUTING.md), in particular [code style](https://github.com/prestodb/presto/blob/master/CONTRIBUTING.md#code-style) and [commit standards](https://github.com/prestodb/presto/blob/master/CONTRIBUTING.md#commit-standards). - [ ] PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced. - [ ] Documented new properties (with its default value), SQL syntax, functions, or other functionality. - [ ] If release notes are required, they follow the [release notes guidelines](https://github.com/prestodb/presto/wiki/Release-Notes-Guidelines). - [ ] Adequate tests were added if applicable. - [ ] CI passed. - [ ] If adding new dependencies, verified they have an [OpenSSF Scorecard](https://securityscorecards.dev/#the-checks) score of 5.0 or higher (or obtained explicit TSC approval for lower scores). ## Release Notes Please follow [release notes guidelines](https://github.com/prestodb/presto/wiki/Release-Notes-Guidelines) and fill in the release notes below. ``` == NO RELEASE NOTE == ```
1 parent 32eb4fa commit 9108a9a

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

.github/workflows/prestocpp-linux-build.yml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ jobs:
2727
needs: changes
2828
container:
2929
image: prestodb/presto-native-dependency:0.293-20250522140509-484b00e
30+
volumes:
31+
- /usr:/host_usr
32+
- /opt:/host_opt
3033
concurrency:
3134
group: ${{ github.workflow }}-prestocpp-linux-build-${{ github.event.pull_request.number }}
3235
cancel-in-progress: true
@@ -58,11 +61,22 @@ jobs:
5861
ninja -C _build/debug -j 4
5962
6063
steps:
64+
# We cannot use the github action to free disk space from the runner
65+
# because we are in the container and not on the runner anymore.
6166
- name: Free Disk Space
62-
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1
63-
with:
64-
tool-cache: true
65-
swap-storage: false
67+
run: |
68+
# Re-used from free-disk-space github action.
69+
getAvailableSpace() { echo $(df -a $1 | awk 'NR > 1 {avail+=$4} END {print avail}'); }
70+
# Show before
71+
echo "Original available disk space: " $(getAvailableSpace)
72+
# Remove DotNet.
73+
rm -rf /host_usr/share/dotnet || true
74+
# Remove android
75+
rm -rf /host_usr/local/lib/android || true
76+
# Remove CodeQL
77+
rm -rf /host_opt/hostedtoolcache/CodeQL || true
78+
# Show after
79+
echo "New available disk space: " $(getAvailableSpace)
6680
6781
- uses: actions/checkout@v4
6882
if: needs.changes.outputs.codechange == 'true'

0 commit comments

Comments
 (0)