Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Xcode 15 CI for Storage #11983

Merged
merged 14 commits into from
Oct 31, 2023
72 changes: 64 additions & 8 deletions .github/workflows/storage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,17 @@ jobs:
storage:
# Don't run on private repo unless it is a PR.
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
strategy:
matrix:
include:
# Only one os to avoid contention in the integration tests.
# - os: macos-12
# xcode: Xcode_14.2
- os: macos-13
xcode: xcode_15.0.1
env:
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
runs-on: macos-12
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: mikehardy/buildcache-action@c87cea0ccd718971d6cc39e672c4f26815b6c126
Expand All @@ -43,35 +51,56 @@ jobs:
run: |
scripts/decrypt_gha_secret.sh scripts/gha-encrypted/Storage/Credentials.swift.gpg \
FirebaseStorage/Tests/Integration/Credentials.swift "$plist_secret"
- name: Xcode
run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer
- name: BuildAndTest # can be replaced with pod lib lint with CocoaPods 1.10
run: ([ -z $plist_secret ] || scripts/third_party/travis/retry.sh scripts/build.sh Storage all)

spm:
# Don't run on private repo unless it is a PR.
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
runs-on: macos-12
strategy:
matrix:
include:
- os: macos-12
xcode: Xcode_14.2
- os: macos-13
xcode: xcode_15.0.1
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: mikehardy/buildcache-action@c87cea0ccd718971d6cc39e672c4f26815b6c126
with:
cache_key: ${{ matrix.os }}
- name: Xcode
run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer
- name: Initialize xcodebuild
run: scripts/setup_spm_tests.sh
- name: Swift Unit Tests
run: scripts/third_party/travis/retry.sh ./scripts/build.sh FirebaseStorageUnit iOS spm

spm-cron:
# Don't run on private repo.
if: github.event_name == 'schedule' && github.repository == 'Firebase/firebase-ios-sdk'
runs-on: macos-12
# if: github.event_name == 'schedule' && github.repository == 'Firebase/firebase-ios-sdk'
strategy:
matrix:
target: [tvOS, macOS, catalyst, watchOS]
os: [macos-12, macos-13]
include:
- os: macos-12
xcode: Xcode_14.2
- os: macos-13
xcode: xcode_15.0.1
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: mikehardy/buildcache-action@c87cea0ccd718971d6cc39e672c4f26815b6c126
with:
cache_key: ${{ matrix.os }}
- name: Xcodes
run: ls -l /Applications/Xcode*
- name: Xcode
run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer
- name: Initialize xcodebuild
run: scripts/setup_spm_tests.sh
- name: Unit Tests
Expand All @@ -80,11 +109,18 @@ jobs:
quickstart:
# Don't run on private repo unless it is a PR.
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
strategy:
matrix:
include:
- os: macos-12
xcode: Xcode_14.2
- os: macos-13
xcode: xcode_15.0.1
env:
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
signin_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
LEGACY: true
runs-on: macos-12
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
Expand All @@ -93,6 +129,8 @@ jobs:
- name: Install Secret GoogleService-Info.plist
run: scripts/decrypt_gha_secret.sh scripts/gha-encrypted/qs-storage.plist.gpg \
quickstart-ios/storage/GoogleService-Info.plist "$plist_secret"
- name: Xcode
run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer
- name: Test objc quickstart
run: ([ -z $plist_secret ] || scripts/third_party/travis/retry.sh scripts/test_quickstart.sh Storage true)
- name: Test swift quickstart
Expand Down Expand Up @@ -128,31 +166,49 @@ jobs:
pod-lib-lint:
# Don't run on private repo unless it is a PR.
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
runs-on: macos-12
strategy:
matrix:
target: [ios, tvos, macos, watchos]
os: [macos-12, macos-13]
include:
- os: macos-12
xcode: Xcode_14.2
- os: macos-13
xcode: xcode_15.0.1
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
- name: Setup Bundler
run: scripts/setup_bundler.sh
- name: Xcodes
run: ls -l /Applications/Xcode*
- name: Xcode
run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer
- name: Build and test
run: |
scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb FirebaseStorage.podspec --test-specs=unit --platforms=${{ matrix.target }}

storage-cron-only:
# Don't run on private repo.
if: github.event_name == 'schedule' && github.repository == 'Firebase/firebase-ios-sdk'
runs-on: macos-12
# if: github.event_name == 'schedule' && github.repository == 'Firebase/firebase-ios-sdk'
strategy:
matrix:
target: [ios, tvos, macos, watchos]
os: [macos-12, macos-13]
include:
- os: macos-12
xcode: Xcode_14.2
- os: macos-13
xcode: xcode_15.0.1
runs-on: ${{ matrix.os }}
needs: pod-lib-lint
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
- name: Setup Bundler
run: scripts/setup_bundler.sh
- name: Xcode
run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer
- name: PodLibLint Storage Cron
run: scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb FirebaseStorage.podspec --platforms=${{ matrix.target }} --use-static-frameworks --skip-tests
2 changes: 1 addition & 1 deletion CocoapodsIntegrationTest/scripts/build_with_environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function runXcodebuild() {
-workspace 'CocoapodsIntegrationTest.xcworkspace'
-scheme 'CocoapodsIntegrationTest'
-sdk 'iphonesimulator'
-destination 'platform=iOS Simulator,name=iPhone 11'
-destination 'platform=iOS Simulator,name=iPhone 14'
CODE_SIGNING_REQUIRED=NO
clean
build
Expand Down
6 changes: 3 additions & 3 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,15 @@ function ExportLogs() {
python "${scripts_dir}/xcresult_logs.py" "$@"
}

if [[ "$xcode_major" -lt 11 ]]; then
if [[ "$xcode_major" -lt 15 ]]; then
ios_flags=(
-sdk 'iphonesimulator'
-destination 'platform=iOS Simulator,name=iPhone 7'
-destination 'platform=iOS Simulator,name=iPhone 14'
)
else
ios_flags=(
-sdk 'iphonesimulator'
-destination 'platform=iOS Simulator,name=iPhone 11'
-destination 'platform=iOS Simulator,name=iPhone 15'
)
fi

Expand Down
44 changes: 12 additions & 32 deletions scripts/xcresult_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,27 +54,19 @@ def main():
scheme = flags['-scheme']
xcresult_path = find_xcresult_path(project, scheme)

version = find_xcode_major_version()
if version <= 10:
files = find_legacy_log_files(xcresult_path)
cat_files(files, sys.stdout)

log_id = find_log_id(xcresult_path)
log = export_log(xcresult_path, log_id)

# Avoid a potential UnicodeEncodeError raised by sys.stdout.write() by
# doing a relaxed encoding ourselves.
if hasattr(sys.stdout, 'buffer'):
log_encoded = log.encode('utf8', errors='backslashreplace')
sys.stdout.flush()
sys.stdout.buffer.write(log_encoded)
else:
# Xcode 11 and up ship xcresult tool which standardizes the xcresult format
# but also makes it harder to deal with.
log_id = find_log_id(xcresult_path)
log = export_log(xcresult_path, log_id)

# Avoid a potential UnicodeEncodeError raised by sys.stdout.write() by
# doing a relaxed encoding ourselves.
if hasattr(sys.stdout, 'buffer'):
log_encoded = log.encode('utf8', errors='backslashreplace')
sys.stdout.flush()
sys.stdout.buffer.write(log_encoded)
else:
log_encoded = log.encode('ascii', errors='backslashreplace')
log_decoded = log_encoded.decode('ascii', errors='strict')
sys.stdout.write(log_decoded)
log_encoded = log.encode('ascii', errors='backslashreplace')
log_decoded = log_encoded.decode('ascii', errors='strict')
sys.stdout.write(log_decoded)


# Most flags on the xcodebuild command-line are uninteresting, so only pull
Expand Down Expand Up @@ -277,18 +269,6 @@ def collect_log_output(activity_log, result):
collect_log_output(subsection, result)


def find_xcode_major_version():
"""Determines the major version number of Xcode."""
cmd = ['xcodebuild', '-version']
command_trace.log(cmd)

result = str(subprocess.check_output(cmd))
version = result.split('\n', 1)[0]
version = re.sub(r'Xcode ', '', version)
version = re.sub(r'\..*', '', version)
return int(version)


def xcresulttool(*args):
"""Runs xcresulttool and returns its output as a string."""
cmd = ['xcrun', 'xcresulttool']
Expand Down
2 changes: 1 addition & 1 deletion scripts/zip_quickstart_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ fi
xcodebuild \
-project ${SAMPLE}Example.xcodeproj \
-scheme ${SAMPLE}Example${SWIFT_SUFFIX} \
-destination 'platform=iOS Simulator,name=iPhone 11 Pro' "SWIFT_VERSION=5.3" "OTHER_LDFLAGS=\$(OTHER_LDFLAGS) -ObjC" "FRAMEWORK_SEARCH_PATHS= \$(PROJECT_DIR)/Firebase/" HEADER_SEARCH_PATHS='$(PROJECT_DIR)/Firebase' \
-destination 'platform=iOS Simulator,name=iPhone 15' "SWIFT_VERSION=5.3" "OTHER_LDFLAGS=\$(OTHER_LDFLAGS) -ObjC" "FRAMEWORK_SEARCH_PATHS= \$(PROJECT_DIR)/Firebase/" HEADER_SEARCH_PATHS='$(PROJECT_DIR)/Firebase' \
build \
test \
) || EXIT_STATUS=$?
Expand Down