ci: update swiftui workflow + run on development branch #38
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
name: SwiftUI Auth | |
on: | |
push: | |
branches: [ main, development ] | |
paths: | |
- '.github/workflows/swiftui-auth.yml' | |
- 'samples/swiftui/**' | |
- 'FirebaseSwiftUI/**' | |
- 'Package.swift' | |
pull_request: | |
branches: [ main, development ] | |
paths: | |
- '.github/workflows/swiftui-auth.yml' | |
- 'samples/swiftui/**' | |
- 'FirebaseSwiftUI/**' | |
- 'Package.swift' | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
swiftui-auth: | |
runs-on: macos-15 | |
timeout-minutes: 60 | |
steps: | |
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 | |
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a | |
name: Install Node.js 20 | |
with: | |
node-version: '20' | |
- uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- name: Install Firebase | |
run: | | |
sudo npm i -g firebase-tools | |
- name: Start Firebase Emulator | |
run: | | |
sudo chown -R 501:20 "/Users/runner/.npm" && cd ./samples/swiftui/FirebaseSwiftUIExample/FirebaseSwiftUIExample && ./start-firebase-emulator.sh | |
- name: Install xcpretty | |
run: gem install xcpretty | |
- name: Select Xcode version | |
run: | | |
sudo xcode-select -switch /Applications/Xcode_16.4.app/Contents/Developer | |
- name: Run FirebaseSwiftUI Package Unit Tests | |
run: | | |
set -o pipefail | |
xcodebuild test -scheme FirebaseUI-Package -destination 'platform=iOS Simulator,name=iPhone 16 Pro' -enableCodeCoverage YES -resultBundlePath FirebaseSwiftUIPackageTests.xcresult | tee FirebaseSwiftUIPackageTests.log | xcpretty --test --color --simple | |
# Build for integration tests (builds app + integration test bundle) | |
- name: Build for Integration Tests | |
run: | | |
cd ./samples/swiftui/FirebaseSwiftUIExample | |
set -o pipefail | |
xcodebuild build-for-testing \ | |
-scheme FirebaseSwiftUIExampleTests \ | |
-destination 'platform=iOS Simulator,name=iPhone 16 Pro' \ | |
-enableCodeCoverage YES | xcpretty --color --simple | |
# Run integration tests | |
- name: Run Integration Tests | |
run: | | |
cd ./samples/swiftui/FirebaseSwiftUIExample | |
set -o pipefail | |
xcodebuild test-without-building \ | |
-scheme FirebaseSwiftUIExampleTests \ | |
-destination 'platform=iOS Simulator,name=iPhone 16 Pro' \ | |
-enableCodeCoverage YES \ | |
-resultBundlePath FirebaseSwiftUIExampleTests.xcresult | tee FirebaseSwiftUIExampleTests.log | xcpretty --test --color --simple | |
# Build for UI tests (reuses app build, builds UI test bundle) | |
- name: Build for UI Tests | |
run: | | |
cd ./samples/swiftui/FirebaseSwiftUIExample | |
set -o pipefail | |
xcodebuild build-for-testing \ | |
-scheme FirebaseSwiftUIExampleUITests \ | |
-destination 'platform=iOS Simulator,name=iPhone 16 Pro' \ | |
-enableCodeCoverage YES | xcpretty --color --simple | |
# Run UI tests | |
- name: Run View UI Tests | |
run: | | |
cd ./samples/swiftui/FirebaseSwiftUIExample | |
set -o pipefail | |
xcodebuild test-without-building \ | |
-scheme FirebaseSwiftUIExampleUITests \ | |
-destination 'platform=iOS Simulator,name=iPhone 16 Pro' \ | |
-parallel-testing-enabled YES \ | |
-maximum-concurrent-test-simulator-destinations 2 \ | |
-enableCodeCoverage YES \ | |
-resultBundlePath FirebaseSwiftUIExampleUITests.xcresult | tee FirebaseSwiftUIExampleUITests.log | xcpretty --test --color --simple | |
- name: Upload test logs | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: swiftui-auth-test-logs | |
path: | | |
FirebaseSwiftUIPackageTests.log | |
samples/swiftui/FirebaseSwiftUIExample/FirebaseSwiftUIExampleTests.log | |
samples/swiftui/FirebaseSwiftUIExample/FirebaseSwiftUIExampleUITests.log | |
- name: Upload FirebaseSwiftUIExampleUITests.xcresult bundle | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: FirebaseSwiftUIExampleUITests.xcresult | |
path: samples/swiftui/FirebaseSwiftUIExample/FirebaseSwiftUIExampleUITests.xcresult | |
- name: Upload FirebaseSwiftUIExampleTests.xcresult bundle | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: FirebaseSwiftUIExampleTests.xcresult | |
path: samples/swiftui/FirebaseSwiftUIExample/FirebaseSwiftUIExampleTests.xcresult | |
- name: Upload FirebaseSwiftUIPackageTests.xcresult bundle | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: FirebaseSwiftUIPackageTests.xcresult | |
path: FirebaseSwiftUIPackageTests.xcresult |