Skip to content
This repository was archived by the owner on Jan 23, 2024. It is now read-only.

Commit 8dcaf94

Browse files
authored
chore: Add extra tess cleanup to build scripts (#82)
This addresses an issue where first running `./build_and_test.sh` followed by `build-dist.sh` could see some test failures while running the second script. One concrete scenario was when the local python version was 3.10.9 while version 3.10.10 was used during `build-dist.sh`.
1 parent ec24144 commit 8dcaf94

File tree

3 files changed

+30
-4
lines changed

3 files changed

+30
-4
lines changed

build_and_test.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#!/bin/bash -e
22

3+
# Clean up any previous generated test files.
4+
rm -rf tests/py/__pycache__
5+
36
cd src
47
./build.sh
58
cd ..
@@ -10,3 +13,6 @@ pip3 install -r requirements_dev.txt
1013
pip3 install src/dist/* --force-reinstall
1114
python3 -m pytest tests/py
1215
deactivate
16+
17+
# Clean up any generated test files.
18+
rm -rf tests/py/__pycache__

src/build-wheels.sh

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,14 @@ ROOT=$(cd $(dirname "${BASH_SOURCE[0]}") >/dev/null; /bin/pwd -P)
1010
# Parallelize the build over N threads where N is the number of cores * 1.5.
1111
PARALLEL_BUILD_OPTION="-j $(($(nproc 2> /dev/null || echo 4)*3/2))"
1212

13-
# Clean up any previous build files.
14-
rm -rf ${ROOT}/build ${ROOT}/dist ${ROOT}/setup.cfg
13+
# Clean up any previous build/test files.
14+
rm -rf \
15+
${ROOT}/build \
16+
${ROOT}/dist \
17+
${ROOT}/setup.cfg \
18+
${ROOT}/google_python_cloud_debugger.egg-info \
19+
/io/dist \
20+
/io/tests/py/__pycache__
1521

1622
# Create directory for third-party libraries.
1723
mkdir -p ${ROOT}/build/third_party
@@ -78,6 +84,11 @@ done
7884
popd
7985

8086
# Clean up temporary directories.
81-
rm -rf ${ROOT}/build ${ROOT}/setup.cfg
87+
rm -rf \
88+
${ROOT}/build \
89+
${ROOT}/setup.cfg \
90+
${ROOT}/google_python_cloud_debugger.egg-info \
91+
/io/tests/py/__pycache__
92+
8293
echo "Build artifacts are in the dist directory"
8394

src/build.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,11 @@ ROOT=$(cd $(dirname "${BASH_SOURCE[0]}") >/dev/null; /bin/pwd -P)
4242
PARALLEL_BUILD_OPTION="-j $(($(nproc 2> /dev/null || echo 4)*3/2))"
4343

4444
# Clean up any previous build files.
45-
rm -rf ${ROOT}/build ${ROOT}/dist ${ROOT}/setup.cfg
45+
rm -rf \
46+
${ROOT}/build \
47+
${ROOT}/dist \
48+
${ROOT}/setup.cfg \
49+
${ROOT}/google_python_cloud_debugger.egg-info
4650

4751
# Create directory for third-party libraries.
4852
mkdir -p ${ROOT}/build/third_party
@@ -91,3 +95,8 @@ pushd ${ROOT}
9195
"${PYTHON:-python3}" -m pip wheel . --no-deps -w dist
9296
popd
9397

98+
# Clean up temporary directories.
99+
rm -rf \
100+
${ROOT}/build \
101+
${ROOT}/setup.cfg \
102+
${ROOT}/google_python_cloud_debugger.egg-info

0 commit comments

Comments
 (0)