Skip to content

[Infra] Make mlmodeldownloader.yml use reusable CocoaPods workflow #14904

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 18 commits into from
May 29, 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
28 changes: 28 additions & 0 deletions .github/workflows/common_cocoapods.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,28 @@ permissions:

on:
workflow_call:
# Re-usable workflows do not automatically inherit the caller's secrets.
#
# If the calling workflow uses a secret in the `setup_command` input, then
# it also must pass the secret to the re-usable workflow.
#
# Example:
#
# pod_lib_lint:
# uses: ./.github/workflows/common_cocoapods.yml
# with:
# product: FirebaseFoo
# setup_command: |
# scripts/decrypt_gha_secret.sh \
# /path/to/GoogleService-Info.plist.gpg \
# /path/to/dest/GoogleService-Info.plist "$plist_secret"
# secrets:
# plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
#
secrets:
plist_secret:
required: false

inputs:
# The product to test be tested (e.g. `FirebaseABTesting`).
product:
Expand Down Expand Up @@ -66,6 +88,10 @@ on:
# This is useful for additional set up, like starting an emulator or
# downloading test data.
#
# Note, this step has an env var set to decrypt plists. Use
# "$plist_secret" in the given command. See `secrets` documentation
# at top of this file.
#
# Example: `FirebaseFunctions/Backend/start.sh synchronous`
setup_command:
type: string
Expand Down Expand Up @@ -101,6 +127,8 @@ jobs:
run: sed -i "" "s/s.swift_version[[:space:]]*=[[:space:]]*'5.9'/s.swift_version = '6.0'/" ${{ inputs.product }}.podspec
- name: Run setup command, if needed.
if: inputs.setup_command != ''
env:
plist_secret: ${{ secrets.plist_secret }}
run: ${{ inputs.setup_command }}
- uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3
if: contains(join(inputs.platforms), matrix.platform) || matrix.os == 'macos-14'
Expand Down
40 changes: 13 additions & 27 deletions .github/workflows/mlmodeldownloader.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
name: mlmodeldownloader

permissions:
contents: read

on:
workflow_dispatch:
pull_request:
paths:
- 'FirebaseMLModelDownloader**'
- '.github/workflows/mlmodeldownloader.yml'
- '.github/workflows/common.yml'
- '.github/workflows/common_cocoapods.yml'
- 'Gemfile*'
schedule:
# Run every day at 11pm (PST) - cron uses UTC times
Expand All @@ -27,35 +32,16 @@ jobs:
product: FirebaseMLModelDownloader
target: FirebaseMLModelDownloader-Unit-unit

pod-lib-lint:
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
env:
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
strategy:
matrix:
target: [ios, tvos, macos, watchos]
build-env:
- os: macos-14
xcode: Xcode_16.2
- os: macos-15
xcode: Xcode_16.2
runs-on: ${{ matrix.build-env.os }}
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1
- name: Setup Bundler
run: scripts/setup_bundler.sh
- name: Configure test keychain
run: scripts/configure_test_keychain.sh
- name: Install GoogleService-Info.plist
run: |
pod_lib_lint:
uses: ./.github/workflows/common_cocoapods.yml
with:
product: FirebaseMLModelDownloader
setup_command: |
mkdir FirebaseMLModelDownloader/Tests/Integration/Resources
scripts/decrypt_gha_secret.sh scripts/gha-encrypted/MLModelDownloader/GoogleService-Info.plist.gpg \
FirebaseMLModelDownloader/Tests/Integration/Resources/GoogleService-Info.plist "$plist_secret"
- name: Xcode
run: sudo xcode-select -s /Applications/${{ matrix.build-env.xcode }}.app/Contents/Developer
- name: Build and test
run: ([ -z $plist_secret ] || scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb FirebaseMLModelDownloader.podspec --platforms=${{ matrix.target }})
secrets:
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}

mlmodeldownloader-cron-only:
if: github.event_name == 'schedule' && github.repository == 'Firebase/firebase-ios-sdk'
Expand All @@ -65,7 +51,7 @@ jobs:
strategy:
matrix:
target: [ios, tvos, macos]
needs: pod-lib-lint
needs: pod_lib_lint
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1
Expand Down
Loading