diff --git a/.github/workflows/build-ios-test-container-app.yml b/.github/workflows/build-ios-test-container-app.yml index 60db50d92..8a7ca3590 100644 --- a/.github/workflows/build-ios-test-container-app.yml +++ b/.github/workflows/build-ios-test-container-app.yml @@ -86,9 +86,9 @@ jobs: BUILD_HASH_FROM_CACHE=$(curl "$KV_STORE_REDIS_REST_URL/get/${{ env.app_id }}-build-hash-from-pre-build-hash-${{ steps.calculate-pre-build-hash.outputs.pre_build_hash }}" -H "Authorization: Bearer $KV_STORE_REDIS_REST_TOKEN" | jq -r '.result') if [ "$BUILD_HASH_FROM_CACHE" != "null" ]; then + curl -X POST "$KV_STORE_REDIS_REST_URL/EXPIRE/${{ env.app_id }}-build-hash-from-pre-build-hash-${{ steps.calculate-pre-build-hash.outputs.pre_build_hash }}/2592000" -H "Authorization: Bearer $KV_STORE_REDIS_REST_TOKEN" # Reset TTL to 30 days echo "Build hash from cache: $BUILD_HASH_FROM_CACHE" echo "build_hash=$BUILD_HASH_FROM_CACHE" >> $GITHUB_OUTPUT - curl -X POST "$KV_STORE_REDIS_REST_URL/EXPIRE/${{ env.app_id }}-build-hash-from-pre-build-hash-${{ steps.calculate-pre-build-hash.outputs.pre_build_hash }}/2592000" -H "Authorization: Bearer $KV_STORE_REDIS_REST_TOKEN" # Reset TTL to 30 days else echo 'No cached build hash found.' echo "build_hash=null" >> $GITHUB_OUTPUT @@ -168,10 +168,12 @@ jobs: env: cache-name: ${{ env.app_id }}-build with: - key: ${{ runner.os }}-${{ env.cache-name }}-${{ inputs.configuration }}-${{ steps.calculate-build-hash.outputs.build_hash }} - restore-keys: | - ${{ runner.os }}-${{ env.cache-name }}-${{ inputs.configuration }}- - ${{ runner.os }}-${{ env.cache-name }}- + # This cache can be huge, so we share it among all configurations instead of creating a cache for each one. + # key: ${{ runner.os }}-${{ env.cache-name }}-${{ inputs.configuration }}-${{ steps.calculate-build-hash.outputs.build_hash }} + # restore-keys: | + # ${{ runner.os }}-${{ env.cache-name }}-${{ inputs.configuration }}- + # ${{ runner.os }}-${{ env.cache-name }}- + key: ${{ runner.os }}-${{ env.cache-name }} path: | ${{ env.test_container_app_path }}/build @@ -201,6 +203,14 @@ jobs: path: | ${{ env.test_container_app_path }}/xcodebuild.log + - name: Save Build Cache + uses: actions/cache/save@v4 + if: ${{ always() && !steps.pre-check-has-build.outputs.cache-hit && !steps.check-has-build.outputs.cache-hit }} + with: + key: ${{ steps.restore-build-cache.outputs.cache-primary-key }} + path: | + ${{ env.test_container_app_path }}/build + # Not useful since it's hard to find which run that actually built the app. Instead, we re-upload the app to artifacts in subsequent workflows if tests failed. # - name: Upload Built App to Artifacts # if: ${{ !steps.pre-check-has-build.outputs.cache-hit && !steps.check-has-build.outputs.cache-hit }}