Skip to content

Commit b209d83

Browse files
authored
[Infra] Make mlmodeldownloader.yml use reusable CocoaPods workflow (#14904)
1 parent f7e01b4 commit b209d83

File tree

2 files changed

+41
-27
lines changed

2 files changed

+41
-27
lines changed

.github/workflows/common_cocoapods.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,28 @@ permissions:
55

66
on:
77
workflow_call:
8+
# Re-usable workflows do not automatically inherit the caller's secrets.
9+
#
10+
# If the calling workflow uses a secret in the `setup_command` input, then
11+
# it also must pass the secret to the re-usable workflow.
12+
#
13+
# Example:
14+
#
15+
# pod_lib_lint:
16+
# uses: ./.github/workflows/common_cocoapods.yml
17+
# with:
18+
# product: FirebaseFoo
19+
# setup_command: |
20+
# scripts/decrypt_gha_secret.sh \
21+
# /path/to/GoogleService-Info.plist.gpg \
22+
# /path/to/dest/GoogleService-Info.plist "$plist_secret"
23+
# secrets:
24+
# plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
25+
#
26+
secrets:
27+
plist_secret:
28+
required: false
29+
830
inputs:
931
# The product to test be tested (e.g. `FirebaseABTesting`).
1032
product:
@@ -66,6 +88,10 @@ on:
6688
# This is useful for additional set up, like starting an emulator or
6789
# downloading test data.
6890
#
91+
# Note, this step has an env var set to decrypt plists. Use
92+
# "$plist_secret" in the given command. See `secrets` documentation
93+
# at top of this file.
94+
#
6995
# Example: `FirebaseFunctions/Backend/start.sh synchronous`
7096
setup_command:
7197
type: string
@@ -101,6 +127,8 @@ jobs:
101127
run: sed -i "" "s/s.swift_version[[:space:]]*=[[:space:]]*'5.9'/s.swift_version = '6.0'/" ${{ inputs.product }}.podspec
102128
- name: Run setup command, if needed.
103129
if: inputs.setup_command != ''
130+
env:
131+
plist_secret: ${{ secrets.plist_secret }}
104132
run: ${{ inputs.setup_command }}
105133
- uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3
106134
if: contains(join(inputs.platforms), matrix.platform) || matrix.os == 'macos-14'

.github/workflows/mlmodeldownloader.yml

Lines changed: 13 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
name: mlmodeldownloader
22

3+
permissions:
4+
contents: read
5+
36
on:
47
workflow_dispatch:
58
pull_request:
69
paths:
710
- 'FirebaseMLModelDownloader**'
811
- '.github/workflows/mlmodeldownloader.yml'
12+
- '.github/workflows/common.yml'
13+
- '.github/workflows/common_cocoapods.yml'
914
- 'Gemfile*'
1015
schedule:
1116
# Run every day at 11pm (PST) - cron uses UTC times
@@ -27,35 +32,16 @@ jobs:
2732
product: FirebaseMLModelDownloader
2833
target: FirebaseMLModelDownloader-Unit-unit
2934

30-
pod-lib-lint:
31-
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
32-
env:
33-
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
34-
strategy:
35-
matrix:
36-
target: [ios, tvos, macos, watchos]
37-
build-env:
38-
- os: macos-14
39-
xcode: Xcode_16.2
40-
- os: macos-15
41-
xcode: Xcode_16.2
42-
runs-on: ${{ matrix.build-env.os }}
43-
steps:
44-
- uses: actions/checkout@v4
45-
- uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1
46-
- name: Setup Bundler
47-
run: scripts/setup_bundler.sh
48-
- name: Configure test keychain
49-
run: scripts/configure_test_keychain.sh
50-
- name: Install GoogleService-Info.plist
51-
run: |
35+
pod_lib_lint:
36+
uses: ./.github/workflows/common_cocoapods.yml
37+
with:
38+
product: FirebaseMLModelDownloader
39+
setup_command: |
5240
mkdir FirebaseMLModelDownloader/Tests/Integration/Resources
5341
scripts/decrypt_gha_secret.sh scripts/gha-encrypted/MLModelDownloader/GoogleService-Info.plist.gpg \
5442
FirebaseMLModelDownloader/Tests/Integration/Resources/GoogleService-Info.plist "$plist_secret"
55-
- name: Xcode
56-
run: sudo xcode-select -s /Applications/${{ matrix.build-env.xcode }}.app/Contents/Developer
57-
- name: Build and test
58-
run: ([ -z $plist_secret ] || scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb FirebaseMLModelDownloader.podspec --platforms=${{ matrix.target }})
43+
secrets:
44+
plist_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
5945

6046
mlmodeldownloader-cron-only:
6147
if: github.event_name == 'schedule' && github.repository == 'Firebase/firebase-ios-sdk'
@@ -65,7 +51,7 @@ jobs:
6551
strategy:
6652
matrix:
6753
target: [ios, tvos, macos]
68-
needs: pod-lib-lint
54+
needs: pod_lib_lint
6955
steps:
7056
- uses: actions/checkout@v4
7157
- uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1

0 commit comments

Comments
 (0)