Skip to content
Merged
7 changes: 7 additions & 0 deletions .github/workflows/firebaseai.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,13 @@ jobs:
run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer
- name: Run IntegrationTests
run: scripts/build.sh FirebaseAIIntegration ${{ matrix.target }}
- name: Upload xcodebuild logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: xcodebuild-${{ matrix.target }}-${{ matrix.os }}-${{ matrix.xcode }}.log
path: xcodebuild-*.log
retention-days: 2

pod-lib-lint:
# Don't run on private repo unless it is a PR.
Expand Down
24 changes: 17 additions & 7 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,15 @@ source scripts/check_secrets.sh
# If xcodebuild fails with known error codes, retries once.
function RunXcodebuild() {
echo xcodebuild "$@"
local xcodebuild_args=("$@")
local buildaction="${xcodebuild_args[$# - 1]}" # buildaction is the last arg
local log_filename="xcodebuild-${buildaction}.log"

xcbeautify_cmd=(xcbeautify --renderer github-actions --disable-logging)
local xcbeautify_cmd=(xcbeautify --renderer github-actions --disable-logging)

result=0
xcodebuild "$@" | tee xcodebuild.log | "${xcbeautify_cmd[@]}" \
&& CheckUnexpectedFailures xcodebuild.log \
local result=0
NSUnbufferedIO=YES xcodebuild "$@" 2>&1 | tee "$log_filename" 2>&1 | \
"${xcbeautify_cmd[@]}" && CheckUnexpectedFailures "$log_filename" \
|| result=$?

if [[ $result == 65 ]]; then
Expand All @@ -124,8 +127,8 @@ function RunXcodebuild() {
sleep 5

result=0
xcodebuild "$@" | tee xcodebuild.log | "${xcbeautify_cmd[@]}" \
&& CheckUnexpectedFailures xcodebuild.log \
NSUnbufferedIO=YES xcodebuild "$@" 2>&1 | tee "$log_filename" 2>&1 | \
"${xcbeautify_cmd[@]}" && CheckUnexpectedFailures "$log_filename" \
|| result=$?
fi

Expand Down Expand Up @@ -505,12 +508,19 @@ case "$product-$platform-$method" in
;;

FirebaseAIIntegration-*-*)
# Build
RunXcodebuild \
-project 'FirebaseAI/Tests/TestApp/VertexAITestApp.xcodeproj' \
-scheme "VertexAITestApp-SPM" \
"${xcb_flags[@]}" \
build

# Run tests
RunXcodebuild \
-project 'FirebaseAI/Tests/TestApp/VertexAITestApp.xcodeproj' \
-scheme "VertexAITestApp-SPM" \
"${xcb_flags[@]}" \
-parallel-testing-enabled NO \
build \
test
;;

Expand Down
Loading