Skip to content

Commit b82666d

Browse files
Stop using shared cache directory for examples CI pipeline (#442)
### Motivation We're not properly cleaning up temporary files in our scripts for examples, leading to CI running out of disk space. ### Modifications Delete each example copy, and the scratch/cache space at the end of the script. ### Result Hopefully will recover CI. ### Test Plan N/A, PR CI will show if this fixes things. --------- Co-authored-by: Si Beaumont <[email protected]>
1 parent 14d9b95 commit b82666d

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

scripts/test-examples.sh

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ TMP_DIR=$(/usr/bin/mktemp -d -p "${TMPDIR-/tmp}" "$(basename "$0").XXXXXXXXXX")
2727

2828
PACKAGE_PATH=${PACKAGE_PATH:-${REPO_ROOT}}
2929
EXAMPLES_PACKAGE_PATH="${PACKAGE_PATH}/Examples"
30-
SHARED_SCRATCH_PATH="${TMP_DIR}/scratch"
31-
SHARED_CACHE_PATH="${TMP_DIR}/cache"
3230

3331
for EXAMPLE_PACKAGE_PATH in $(find "${EXAMPLES_PACKAGE_PATH}" -maxdepth 2 -name Package.swift -type f -print0 | xargs -0 dirname); do
3432

@@ -47,31 +45,24 @@ for EXAMPLE_PACKAGE_PATH in $(find "${EXAMPLES_PACKAGE_PATH}" -maxdepth 2 -name
4745
log "Overriding dependency in ${EXAMPLE_PACKAGE_NAME} to use ${PACKAGE_PATH}"
4846
"${SWIFT_BIN}" package \
4947
--package-path "${EXAMPLE_COPY_DIR}" \
50-
--scratch-path "${SHARED_SCRATCH_PATH}" \
51-
--cache-path "${SHARED_CACHE_PATH}" \
5248
edit swift-openapi-generator \
5349
--path "${PACKAGE_PATH}"
5450

5551
log "Building example package: ${EXAMPLE_PACKAGE_NAME}"
5652
"${SWIFT_BIN}" build \
57-
--package-path "${EXAMPLE_COPY_DIR}" \
58-
--scratch-path "${SHARED_SCRATCH_PATH}" \
59-
--cache-path "${SHARED_CACHE_PATH}"
53+
--package-path "${EXAMPLE_COPY_DIR}"
6054
log "✅ Successfully built the example package ${EXAMPLE_PACKAGE_NAME}."
6155

6256
if [ -d "${EXAMPLE_COPY_DIR}/Tests" ]; then
6357
log "Running tests for example package: ${EXAMPLE_PACKAGE_NAME}"
6458
"${SWIFT_BIN}" test \
65-
--package-path "${EXAMPLE_COPY_DIR}" \
66-
--scratch-path "${SHARED_SCRATCH_PATH}" \
67-
--cache-path "${SHARED_CACHE_PATH}"
59+
--package-path "${EXAMPLE_COPY_DIR}"
6860
log "✅ Passed the tests for the example package ${EXAMPLE_PACKAGE_NAME}."
6961
fi
7062

71-
log "Unediting dependency in ${EXAMPLE_PACKAGE_NAME}"
72-
"${SWIFT_BIN}" package \
73-
--package-path "${EXAMPLE_COPY_DIR}" \
74-
--scratch-path "${SHARED_SCRATCH_PATH}" \
75-
--cache-path "${SHARED_CACHE_PATH}" \
76-
unedit swift-openapi-generator
63+
log "Deleting example ${EXAMPLE_PACKAGE_NAME} at ${EXAMPLE_COPY_DIR}"
64+
rm -rf "${EXAMPLE_COPY_DIR}"
7765
done
66+
67+
log "Deleting temporary directory"
68+
rm -rf "${TMP_DIR}"

0 commit comments

Comments
 (0)