Skip to content

[Infra] Create common SPM-focused reusable workflow #14739

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

Merged
merged 24 commits into from
Apr 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 5 additions & 75 deletions .github/workflows/abtesting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ concurrency:
cancel-in-progress: true

jobs:
spm:
uses: ./.github/workflows/common.yml
with:
target: ABTestingUnit

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'
Expand Down Expand Up @@ -55,81 +60,6 @@ jobs:
retry_wait_seconds: 120
command: scripts/pod_lib_lint.rb FirebaseABTesting.podspec --platforms=${{ matrix.target }}

spm-package-resolved:
env:
FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT: 1
runs-on: macos-15
outputs:
cache_key: ${{ steps.generate_cache_key.outputs.cache_key }}
steps:
- uses: actions/checkout@v4
- name: Xcode
run: sudo xcode-select -s /Applications/Xcode_16.2.app/Contents/Developer
- name: Generate Swift Package.resolved
id: swift_package_resolve
run: |
swift package resolve
- name: Generate cache key
id: generate_cache_key
run: |
cache_key="${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}"
echo "cache_key=${cache_key}" >> "$GITHUB_OUTPUT"
- uses: actions/cache/save@v4
id: cache
with:
path: .build
key: ${{ steps.generate_cache_key.outputs.cache_key }}

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'
needs: [spm-package-resolved]
strategy:
matrix:
include:
- os: macos-14
xcode: Xcode_16.2
target: iOS
- os: macos-15
xcode: Xcode_16.2
target: iOS
- os: macos-15
xcode: Xcode_16.2
target: tvOS
- os: macos-15
xcode: Xcode_16.2
target: macOS
- os: macos-15
xcode: Xcode_16.2
target: watchOS
- os: macos-15
xcode: Xcode_16.2
target: catalyst
- os: macos-15
xcode: Xcode_16.2
target: visionOS
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/cache/restore@v4
with:
path: .build
key: ${{needs.spm-package-resolved.outputs.cache_key}}
- name: Xcode
run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer
- name: Install visionOS, if needed.
if: matrix.target == 'visionOS'
run: xcodebuild -downloadPlatform visionOS
- name: Initialize xcodebuild
run: scripts/setup_spm_tests.sh
- uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3
with:
timeout_minutes: 120
max_attempts: 3
retry_on: error
retry_wait_seconds: 120
command: scripts/build.sh ABTestingUnit ${{ matrix.target }} spm

catalyst:
# 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'
Expand Down
54 changes: 6 additions & 48 deletions .github/workflows/appdistribution.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ concurrency:
cancel-in-progress: true

jobs:
spm:
uses: ./.github/workflows/common.yml
with:
target: AppDistributionUnit
platforms: iOS

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'
Expand All @@ -40,54 +46,6 @@ jobs:
scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb FirebaseAppDistribution.podspec \
--platforms=ios

spm-package-resolved:
env:
FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT: 1
runs-on: macos-14
outputs:
cache_key: ${{ steps.generate_cache_key.outputs.cache_key }}
steps:
- uses: actions/checkout@v4
- name: Generate Swift Package.resolved
id: swift_package_resolve
run: |
swift package resolve
- name: Generate cache key
id: generate_cache_key
run: |
cache_key="${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}"
echo "cache_key=${cache_key}" >> "$GITHUB_OUTPUT"
- uses: actions/cache/save@v4
id: cache
with:
path: .build
key: ${{ steps.generate_cache_key.outputs.cache_key }}

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'
needs: [spm-package-resolved]
strategy:
matrix:
include:
- os: macos-14
xcode: Xcode_16.2
- os: macos-15
xcode: Xcode_16.3
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/cache/restore@v4
with:
path: .build
key: ${{needs.spm-package-resolved.outputs.cache_key}}
- name: Xcode
run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer
- name: Initialize xcodebuild
run: scripts/setup_spm_tests.sh
- name: iOS Unit Tests
run: scripts/third_party/travis/retry.sh ./scripts/build.sh AppDistributionUnit iOS spm

catalyst:
# 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'
Expand Down
57 changes: 7 additions & 50 deletions .github/workflows/auth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ concurrency:
cancel-in-progress: true

jobs:
spm:
uses: ./.github/workflows/common.yml
with:
target: AuthUnit
buildonly_platforms: macOS

pod-lib-lint:
# Don't run on private repo unless it is a PR.
Expand Down Expand Up @@ -58,6 +63,8 @@ jobs:
cache_key: ${{ steps.generate_cache_key.outputs.cache_key }}
steps:
- uses: actions/checkout@v4
- name: Xcode
run: sudo xcode-select -s /Applications/Xcode_16.2.app/Contents/Developer
- name: Generate Swift Package.resolved
id: swift_package_resolve
run: |
Expand All @@ -73,56 +80,6 @@ jobs:
path: .build
key: ${{ steps.generate_cache_key.outputs.cache_key }}

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'
needs: [spm-package-resolved]
strategy:
matrix:
include:
- os: macos-14
xcode: Xcode_16.2
target: iOS spm
- os: macos-15
xcode: Xcode_16.3
target: iOS spm
- os: macos-15
xcode: Xcode_16.3
target: tvOS spm
- os: macos-15
xcode: Xcode_16.3
target: macOS spmbuildonly
- os: macos-15
xcode: Xcode_16.3
target: watchOS spm
- os: macos-15
xcode: Xcode_16.3
target: catalyst spm
- os: macos-15
xcode: Xcode_16.3
target: visionOS spm
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/cache/restore@v4
with:
path: .build
key: ${{needs.spm-package-resolved.outputs.cache_key}}
- name: Xcode
run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer
- name: Install visionOS, if needed.
if: matrix.target == 'visionOS spm'
run: xcodebuild -downloadPlatform visionOS
- name: Initialize xcodebuild
run: scripts/setup_spm_tests.sh
- uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3
with:
timeout_minutes: 120
max_attempts: 3
retry_on: error
retry_wait_seconds: 120
command: scripts/third_party/travis/retry.sh ./scripts/build.sh AuthUnit ${{ matrix.target }}

integration-tests:
# 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'
Expand Down
96 changes: 96 additions & 0 deletions .github/workflows/common.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: common

on:
workflow_call:
inputs:
# The target scheme to be tested.
target:
type: string
required: true

# The platforms to build on. Defaults to all.
platforms:
type: string
required: false
default: "iOS, tvOS, macOS, watchOS, catalyst, visionOS"

# By default, all platforms will be tested (see matrix in `spm` job).
# To build instead of test, pass a comma or space separated string of
# platforms.
#
# Platform options: [iOS, tvOS, macOS, watchOS, catalyst, visionOS]
#
# Examples:
# - build only for macOS: `macOS`
# - build only for macOS and tvOS: `macOS, tvOS`
# - build only for all platforms: `all`
buildonly_platforms:
type: string
required: false
default: ""

jobs:
spm-package-resolved:
env:
FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT: 1
runs-on: macos-15
outputs:
cache_key: ${{ steps.generate_cache_key.outputs.cache_key }}
steps:
- uses: actions/checkout@v4
- name: Xcode
run: sudo xcode-select -s /Applications/Xcode_16.2.app/Contents/Developer
- name: Generate Swift Package.resolved
id: swift_package_resolve
run: |
swift package resolve
- name: Generate cache key
id: generate_cache_key
run: |
cache_key="${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}"
echo "cache_key=${cache_key}" >> "$GITHUB_OUTPUT"
- uses: actions/cache/save@v4
id: cache
with:
path: .build
key: ${{ steps.generate_cache_key.outputs.cache_key }}

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'
needs: [spm-package-resolved]
strategy:
matrix:
os: [macos-15]
xcode: [Xcode_16.2]
platform: [iOS, tvOS, macOS, watchOS, catalyst, visionOS]
include:
- os: macos-14
xcode: Xcode_16.2
platform: iOS
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/cache/restore@v4
with:
path: .build
key: ${{needs.spm-package-resolved.outputs.cache_key}}
- name: Xcode
run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer
- name: Install visionOS, if needed.
if: matrix.platform == 'visionOS'
run: xcodebuild -downloadPlatform visionOS
- name: Initialize xcodebuild
run: scripts/setup_spm_tests.sh
- uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3
if: contains(join(inputs.platforms), matrix.platform) || matrix.os == 'macos-14'
with:
timeout_minutes: 120
max_attempts: 3
retry_on: error
retry_wait_seconds: 120
command: |
./scripts/build.sh \
${{ inputs.target }} \
${{ matrix.platform }} \
${{ (contains(inputs.buildonly_platforms, matrix.platform) || contains(inputs.buildonly_platforms, 'all')) && 'spmbuildonly' || 'spm' }}
Loading
Loading