@@ -46,25 +46,48 @@ runs:
4646 PLATFORMS=$(echo '${{ inputs.platforms }}' | tr -d '[]' | sed 's/, /,/g')
4747 CONFIGURATIONS=$(echo '${{ inputs.configurations }}' | tr -d '[]' | sed 's/, /,/g')
4848 DERIVED_DATA_PATH=${{ github.workspace }}/${{ inputs.derived_data_path }}
49-
50- function run_build() {
51- preternatural build \
52- --derived-data-path "$DERIVED_DATA_PATH" \
53- --platforms "$PLATFORMS" \
54- --configurations "$CONFIGURATIONS"
49+
50+ function check_derived_data() {
51+ echo "Checking DerivedData folder at: $DERIVED_DATA_PATH"
52+ if [ -d "$DERIVED_DATA_PATH" ]; then
53+ echo "DerivedData folder exists. Contents:"
54+ ls -la "$DERIVED_DATA_PATH"
55+ echo "Total size of DerivedData:"
56+ du -sh "$DERIVED_DATA_PATH"
57+ else
58+ echo "DerivedData folder does not exist"
59+ fi
5560 }
61+
62+ # Construct the command as a string
63+ PRETERNATURAL_CMD="preternatural build --derived-data-path \"$DERIVED_DATA_PATH\" --platforms $PLATFORMS --configurations $CONFIGURATIONS"
64+
65+ echo "Constructed preternatural build command:"
66+ echo "${PRETERNATURAL_CMD}"
67+
68+ check_derived_data
5669
5770 # First attempt
58- if ! run_build; then
59- echo "First build attempt failed. Cleaning derived data and retrying..."
71+ set +e # Don't exit on error
72+ eval ${PRETERNATURAL_CMD} 2>&1
73+ BUILD_STATUS=$?
74+ set -e # Return to exit on error
75+
76+ if [ $BUILD_STATUS -ne 0 ]; then
77+ echo "First build attempt failed (status: $BUILD_STATUS). Cleaning derived data and retrying..."
6078 rm -rf "$DERIVED_DATA_PATH"
79+ check_derived_data
6180
6281 # Second attempt
63- if ! run_build; then
64- echo "Second build attempt failed after cleaning derived data. Failing the workflow."
82+ eval ${PRETERNATURAL_CMD} 2>&1
83+ RETRY_STATUS=$?
84+
85+ if [ $RETRY_STATUS -ne 0 ]; then
86+ echo "Second build attempt failed (status: $RETRY_STATUS) after cleaning derived data. Failing the workflow."
6587 exit 1
6688 fi
6789 fi
90+
6891 echo "build_succeeded=true" >> $GITHUB_OUTPUT
6992
7093 - name : Save DerivedData Cache
0 commit comments