Skip to content

Commit 45b1a5a

Browse files
committed
Try to free up disk space before running the actual tox tasks
1 parent 799a5c4 commit 45b1a5a

File tree

3 files changed

+56
-2
lines changed

3 files changed

+56
-2
lines changed

.github/workflows/tox.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ jobs:
4444
~/.cache/pip
4545
.tox
4646
key: ${{runner.os}}-${{github.ref}}-${{hashFiles('requirements.txt', 'setup.py', 'tox.ini')}}
47+
- name: Free disk space
48+
run: sh build_scripts/free_disk_space.sh
4749
- name: Install Tox and Python Packages
4850
run: pip install tox
4951
- name: Run Tox

build_scripts/free_disk_space.sh

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/usr/bin/env bash
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to You under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
18+
#
19+
# The Azure provided machines typically have the following disk allocation:
20+
# Total space: 85GB
21+
# Allocated: 67 GB
22+
# Free: 17 GB
23+
# This script frees up 28 GB of disk space by deleting unneeded packages and
24+
# large directories.
25+
# The Flink end to end tests download and generate more than 17 GB of files,
26+
# causing unpredictable behavior and build failures.
27+
#
28+
echo "=============================================================================="
29+
echo "Freeing up disk space on CI system"
30+
echo "=============================================================================="
31+
32+
echo "Listing 100 largest packages (largest at bottom)"
33+
dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n | tail -n 100
34+
df -h
35+
echo "Removing large packages"
36+
sudo apt-get remove -y '^ghc-8.*'
37+
sudo apt-get remove -y '^dotnet-.*'
38+
sudo apt-get remove -y '^llvm-.*'
39+
sudo apt-get remove -y '^temurin-.*'
40+
sudo apt-get remove -y 'php.*'
41+
sudo apt-get remove -y azure-cli google-cloud-sdk google-cloud-cli hhvm google-chrome-stable firefox powershell mono-devel microsoft-edge-stable google-chrome-stable powershell linux-modules-6.5.0-1025-azure mysql-server-core-8.0 libllvm15 libllvm14
42+
sudo apt-get autoremove -y
43+
sudo apt-get clean
44+
df -h
45+
echo "Removing large directories"
46+
# deleting 15GB
47+
rm -rf /usr/share/dotnet/
48+
df -h

tox.ini

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ isolated_build = True
1313
# this issue is resolved by running pytest-cov within tox development mode, thus not creating an sdist
1414
usedevelop = true
1515
commands =
16+
; Clean up coverage data and run the tests as well as the notebook tests.
17+
; The latter are run only in this environment.
1618
coverage erase
1719
pytest -n 4 --cov --cov-append --cov-report=term-missing tests
1820
pytest -n 4 notebooks
@@ -32,13 +34,15 @@ deps =
3234
-rrequirements_lightgbm.txt
3335
-rrequirements_geoanalytics.txt
3436
-rrequirements_tensorflow.txt
37+
whitelist_externals =
38+
sh
39+
allowlist_externals =
40+
sh
3541

3642
# This environment tests the latest dependencies
3743
[testenv:py_latest_dependencies]
3844
commands =
3945
pytest
40-
; NOTE: notebooks are not executed here again (the build would become very slow) so they are not tested with
41-
; latest dependencies. Hopefully, this is not a problem
4246
deps =
4347
pytest
4448
; NOTE: For some reason including this into setup.py makes things slow locally, fail silently on gitlab

0 commit comments

Comments
 (0)