mirror of
https://github.com/Unstructured-IO/unstructured.git
synced 2025-07-13 20:15:54 +00:00

When running test-ingest test fixtures locally (but not in CI), keep output .json's and other workdir artifacts around for the convenience of debugging. **Test Instructions** Run bash -x ./test_unstructured_ingest/test-ingest-azure.sh and witness output .json's are visible. Yay! Now, to instead clean up output .json's and workdir, run: UNSTRUCTURED_CLEANUP_DEV_FIXTURES=1 bash -x ./test_unstructured_ingest/test-ingest-azure.sh and witness the files have been cleaned up. Yay!
22 lines
595 B
Bash
22 lines
595 B
Bash
#!/usr/bin/env bash
|
|
|
|
|
|
function cleanup_dir() {
|
|
# NOTE(crag): for developers that want to always clean up .json outputs, etc., set
|
|
# UNSTRUCTURED_CLEANUP_DEV_FIXTURES=1
|
|
if [ "$CI" != "true" ] && [ -z "$UNSTRUCTURED_CLEANUP_DEV_FIXTURES" ] ; then
|
|
return 0
|
|
fi
|
|
local dir_to_cleanup="${1}"
|
|
echo "--- Running cleanup of $dir_to_cleanup ---"
|
|
|
|
if [ -d "$dir_to_cleanup" ]; then
|
|
echo "cleaning up directory: $dir_to_cleanup"
|
|
rm -rf "$dir_to_cleanup"
|
|
else
|
|
echo "$dir_to_cleanup does not exist or is not a directory, skipping deletion"
|
|
fi
|
|
|
|
echo "--- Cleanup done ---"
|
|
}
|