-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat: add new reusable workflow, _build.yml #15762
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
Changes from 19 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
90ac458
feat: add new reusable workflow, _build.yml
ncooke3 61d4129
skip ci: test
ncooke3 2ce7a11
fix permissions
ncooke3 ad751f4
fix qs jobs
ncooke3 bbd9ae8
fix new workflow, preserve older ones
ncooke3 45e7793
perms
ncooke3 a6ab2b7
[will revert] global CI run
ncooke3 6b073f2
[skip ci] Update Gemfile
ncooke3 33d503f
tesT
ncooke3 070563e
fix check_secrets, expect failure
ncooke3 3a94de9
fix storage
ncooke3 ec87ed6
Update sdk.remoteconfig.yml
ncooke3 7f8dca2
Update sdk.remoteconfig.yml
ncooke3 734539c
Update sdk.remoteconfig.yml
ncooke3 8ab0ea8
Update scripts/check_secrets.sh
ncooke3 aafa857
Apply suggestion from @ncooke3
ncooke3 37532dc
Update scripts/check_secrets.sh
ncooke3 33335ce
Update .github/workflows/sdk.remoteconfig.yml
ncooke3 b49f348
Update scripts/check_secrets.sh
ncooke3 c6953f4
Apply suggestion from @gemini-code-assist[bot]
ncooke3 670fc42
fixes
ncooke3 89a8302
feat: Optimize build workflows
ncooke3 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,134 @@ | ||
| name: _build | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| product: | ||
| required: true | ||
| type: string | ||
| platform: | ||
| required: true | ||
| type: string | ||
| method: | ||
| required: true | ||
| type: string | ||
| sanitizers: | ||
| required: false | ||
| type: string | ||
| description: "Space-separated list of sanitizers (asan, tsan, ubsan)" | ||
| setup_command: | ||
| required: false | ||
| type: string | ||
| description: "Command to run before build (e.g., for setting up secrets or prerequisites)" | ||
| xcode: | ||
| required: false | ||
| type: string | ||
| default: 'Xcode_16.4' | ||
| os: | ||
| required: false | ||
| type: string | ||
| default: 'macos-15' | ||
| timeout_minutes: | ||
| required: false | ||
| type: number | ||
| default: 120 | ||
|
|
||
| # IMPORTANT: When adding new secrets to this workflow, update the | ||
| # 'has_secrets' logic in the 'check_secrets' job to include the new secret. | ||
| secrets: | ||
| plist_secret: | ||
| required: false | ||
|
|
||
| jobs: | ||
| check_secrets: | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| should_run: ${{ steps.determine_run.outputs.should_run }} | ||
| has_secrets: ${{ steps.determine_run.outputs.has_secrets }} | ||
| env: | ||
| plist_secret: ${{ secrets.plist_secret }} | ||
| steps: | ||
| - name: Determine if build should run and if secrets are present | ||
| id: determine_run | ||
| run: | | ||
| # 1. Check for secrets. | ||
| # - IMPORTANT: Extend this logic if adding new secrets. | ||
| if [[ -n "$plist_secret" ]]; then | ||
| has_secrets="true" | ||
| else | ||
| has_secrets="false" | ||
| fi | ||
| echo "has_secrets=$has_secrets" >> $GITHUB_OUTPUT | ||
|
|
||
| # 2. Determine if the build job should run. | ||
| # - Skip if on a fork AND secrets are present. | ||
| if [[ "${{ github.repository }}" != "firebase/firebase-ios-sdk" && "$has_secrets" == "true" ]]; then | ||
| echo "should_run=false" >> $GITHUB_OUTPUT | ||
| else | ||
| echo "should_run=true" >> $GITHUB_OUTPUT | ||
| fi | ||
|
|
||
| build: | ||
| needs: check_secrets | ||
| # Run on the main repo's scheduled jobs or pull requests and manual workflow invocations. | ||
| if: | | ||
| needs.check_secrets.outputs.should_run == 'true' && | ||
| ( | ||
| (github.repository == 'firebase/firebase-ios-sdk' && github.event_name == 'schedule') || | ||
| contains(fromJSON('["pull_request", "workflow_dispatch"]'), github.event_name) | ||
| ) | ||
| runs-on: ${{ inputs.os }} | ||
| env: | ||
| SANITIZERS: ${{ inputs.sanitizers }} | ||
| plist_secret: ${{ secrets.plist_secret }} | ||
| FIREBASECI_SECRETS_PRESENT: ${{ needs.check_secrets.outputs.has_secrets }} | ||
| FIREBASECI_IS_TRUSTED_ENV: ${{ github.repository == 'firebase/firebase-ios-sdk' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }} | ||
| FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT: 1 | ||
| steps: | ||
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | ||
| - uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1 | ||
| if: inputs.method != 'spm' && inputs.method != 'spmbuildonly' && inputs.method != 'cmake' | ||
| - name: Setup Bundler | ||
| if: inputs.method != 'spm' && inputs.method != 'spmbuildonly' && inputs.method != 'cmake' | ||
| uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3 | ||
| with: | ||
| timeout_minutes: 10 | ||
| max_attempts: 5 | ||
| retry_wait_seconds: 300 | ||
| command: scripts/setup_bundler.sh | ||
| - name: Xcode | ||
| run: sudo xcode-select -s /Applications/${{ inputs.xcode }}.app/Contents/Developer | ||
| - name: Install simulators | ||
| if: inputs.platform != 'macOS' && inputs.platform != 'catalyst' | ||
| uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3 | ||
| with: | ||
| timeout_minutes: 15 | ||
| max_attempts: 5 | ||
| retry_wait_seconds: 120 | ||
| continue_on_error: true | ||
| command: | | ||
| if [[ "${{ inputs.platform }}" == "all" ]]; then | ||
| xcodebuild -downloadAllPlatforms | ||
| else | ||
| xcodebuild -downloadPlatform ${{ inputs.platform }} | ||
| fi | ||
ncooke3 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - name: Run setup command | ||
| if: inputs.setup_command != '' | ||
| run: ${{ inputs.setup_command }} | ||
| - name: Build | ||
| uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3 | ||
| with: | ||
| timeout_minutes: ${{ inputs.timeout_minutes }} | ||
| max_attempts: 3 | ||
| retry_wait_seconds: 120 | ||
ncooke3 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| command: | | ||
| scripts/build.sh "${{ inputs.product }}" "${{ inputs.platform }}" "${{ inputs.method }}" | ||
| - uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 | ||
| if: ${{ failure() }} | ||
| with: | ||
| name: xcodebuild-logs-${{ inputs.product }}-${{ inputs.platform }}-${{ inputs.method }} | ||
| path: xcodebuild-*.log | ||
| if-no-files-found: error | ||
ncooke3 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.