Skip to content

Commit

Permalink
[Infra] Add sample app to test building SPM distro across supported p…
Browse files Browse the repository at this point in the history
…latforms (#11150)

* Add client sample app

* Build script changes and workflow changes

* Style

* Add note about special analytics libraries

* Undo unintentional change

* Update spm.yml

* Update spm.yml

* Fix CI for now

* Workflow works locally- not on GHA?

* Disable xcpretty in build.sh

* Fix CI

* Get PR in passing state

* Fix CI for good
  • Loading branch information
ncooke3 authored Apr 24, 2023
1 parent 230c008 commit f22918d
Show file tree
Hide file tree
Showing 16 changed files with 1,048 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/spm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,22 @@ jobs:
run: scripts/third_party/travis/retry.sh ./scripts/build.sh version-test ${{ matrix.target }} spm
- name: Analytics Build Tests
run: scripts/third_party/travis/retry.sh ./scripts/build.sh analytics-import-test ${{ matrix.target }} spm

client-app:
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
env:
FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT: 1
runs-on: macos-12
strategy:
matrix:
platform: [iOS]
# TODO(Xcode 14.3): Remove above line and uncomment below array when GHA
# supports Ventura/Xcode 14.3.
# platform: [iOS, tvOS, macOS, catalyst]
steps:
- uses: actions/checkout@v3
- uses: mikehardy/buildcache-action@c87cea0ccd718971d6cc39e672c4f26815b6c126
with:
cache_key: ${{ matrix.os }}
- name: Build Client App –– ${{ matrix.platform }}
run: scripts/third_party/travis/retry.sh ./scripts/build.sh SwiftPMClientApp ${{ matrix.platform }} xcodebuild
2 changes: 2 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@ let package = Package(
name: "FirebaseAnalytics",
targets: ["FirebaseAnalyticsTarget"]
),
// This library is not designed to be imported into client source code.
.library(
name: "FirebaseAnalyticsWithoutAdIdSupport",
targets: ["FirebaseAnalyticsWithoutAdIdSupportTarget"]
),
// This library is not designed to be imported into client source code.
.library(
name: "FirebaseAnalyticsOnDeviceConversion",
targets: ["FirebaseAnalyticsOnDeviceConversionTarget"]
Expand Down
609 changes: 609 additions & 0 deletions SwiftPMTests/ClientApp/ClientApp.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"images" : [
{
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
},
{
"idiom" : "mac",
"scale" : "1x",
"size" : "16x16"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "16x16"
},
{
"idiom" : "mac",
"scale" : "1x",
"size" : "32x32"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "32x32"
},
{
"idiom" : "mac",
"scale" : "1x",
"size" : "128x128"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "128x128"
},
{
"idiom" : "mac",
"scale" : "1x",
"size" : "256x256"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "256x256"
},
{
"idiom" : "mac",
"scale" : "1x",
"size" : "512x512"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "512x512"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
10 changes: 10 additions & 0 deletions SwiftPMTests/ClientApp/ClientApp/ClientApp.entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.files.user-selected.read-only</key>
<true/>
</dict>
</plist>
24 changes: 24 additions & 0 deletions SwiftPMTests/ClientApp/ClientApp/ClientApp.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import SwiftUI

@main
struct ClientApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
33 changes: 33 additions & 0 deletions SwiftPMTests/ClientApp/ClientApp/ContentView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import SwiftUI

struct ContentView: View {
var body: some View {
VStack {
Image(systemName: "globe")
.imageScale(.large)
.foregroundColor(.accentColor)
Text("Hello, world!")
}
.padding()
}
}

struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
59 changes: 59 additions & 0 deletions SwiftPMTests/ClientApp/ClientApp/objc-header-import-test.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// This file imports all Firebase products that vend an umbrella header.
// Products implemented in Swift are therefore omitted.

// ‼️ NOTE: Changes should also be reflected in `objcxx-header-import-test.m`.

#import <Firebase.h>
#import <FirebaseABTesting/FirebaseABTesting.h>
#import <FirebaseAnalytics/FirebaseAnalytics.h>
#import <FirebaseAppCheck/FirebaseAppCheck.h>
#import "Firebase.h"
#import "FirebaseABTesting/FirebaseABTesting.h"
#import "FirebaseAnalytics/FirebaseAnalytics.h"
#import "FirebaseAppCheck/FirebaseAppCheck.h"
#if TARGET_OS_IOS && !TARGET_OS_MACCATALYST
#import <FirebaseAppDistribution/FirebaseAppDistribution.h>
#import "FirebaseAppDistribution/FirebaseAppDistribution.h"
#endif
#import <FirebaseAuth/FirebaseAuth.h>
#import <FirebaseCore/FirebaseCore.h>
#import <FirebaseCrashlytics/FirebaseCrashlytics.h>
#import <FirebaseDatabase/FirebaseDatabase.h>
#import "FirebaseAuth/FirebaseAuth.h"
#import "FirebaseCore/FirebaseCore.h"
#import "FirebaseCrashlytics/FirebaseCrashlytics.h"
#import "FirebaseDatabase/FirebaseDatabase.h"
#if TARGET_OS_IOS && !TARGET_OS_MACCATALYST
#import <FirebaseDynamicLinks/FirebaseDynamicLinks.h>
#import "FirebaseDynamicLinks/FirebaseDynamicLinks.h"
#endif
#import <FirebaseFirestore/FirebaseFirestore.h>
#import "FirebaseFirestore/FirebaseFirestore.h"
#if (TARGET_OS_IOS || TARGET_OS_TV) && !TARGET_OS_MACCATALYST
#import <FirebaseInAppMessaging/FirebaseInAppMessaging.h>
#import "FirebaseInAppMessaging/FirebaseInAppMessaging.h"
#endif
#import <FirebaseInstallations/FirebaseInstallations.h>
#import <FirebaseMessaging/FirebaseMessaging.h>
#import "FirebaseInstallations/FirebaseInstallations.h"
#import "FirebaseMessaging/FirebaseMessaging.h"
#if (TARGET_OS_IOS && !TARGET_OS_MACCATALYST) || TARGET_OS_TV
#import <FirebasePerformance/FirebasePerformance.h>
#import "FirebasePerformance/FirebasePerformance.h"
#endif
#import <FirebaseRemoteConfig/FirebaseRemoteConfig.h>
#import "FirebaseRemoteConfig/FirebaseRemoteConfig.h"
42 changes: 42 additions & 0 deletions SwiftPMTests/ClientApp/ClientApp/objc-module-import-test.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// ‼️ NOTE: Changes should also be reflected in `objcxx-module-import-test.m`.

@import Firebase;
@import FirebaseABTesting;
@import FirebaseAnalytics;
@import FirebaseAppCheck;
#if TARGET_OS_IOS && !TARGET_OS_MACCATALYST
@import FirebaseAppDistribution;
#endif
@import FirebaseAuth;
@import FirebaseCore;
@import FirebaseCrashlytics;
@import FirebaseDatabase;
#if TARGET_OS_IOS && !TARGET_OS_MACCATALYST
@import FirebaseDynamicLinks;
#endif
@import FirebaseFirestore;
@import FirebaseFunctions;
#if (TARGET_OS_IOS || TARGET_OS_TV) && !TARGET_OS_MACCATALYST
@import FirebaseInAppMessaging;
#endif
@import FirebaseInstallations;
@import FirebaseMessaging;
#if (TARGET_OS_IOS && !TARGET_OS_MACCATALYST) || TARGET_OS_TV
@import FirebasePerformance;
#endif
@import FirebaseRemoteConfig;
@import FirebaseStorage;
60 changes: 60 additions & 0 deletions SwiftPMTests/ClientApp/ClientApp/objcxx-header-import-test.mm
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// This file imports all Firebase products that vend an umbrella header.
// Products implemented in Swift are therefore omitted.

// ‼️ Changes should also be reflected in `objc-header-import-test.m`.

// TODO(Xcode 14.3): Re-enable contest when GHA supports Xcode 14.3.
// #import <Firebase.h>
// #import <FirebaseABTesting/FirebaseABTesting.h>
// #import <FirebaseAnalytics/FirebaseAnalytics.h>
// #import <FirebaseAppCheck/FirebaseAppCheck.h>
// #import "Firebase.h"
// #import "FirebaseABTesting/FirebaseABTesting.h"
// #import "FirebaseAnalytics/FirebaseAnalytics.h"
// #import "FirebaseAppCheck/FirebaseAppCheck.h"
// #if TARGET_OS_IOS && !TARGET_OS_MACCATALYST
// #import <FirebaseAppDistribution/FirebaseAppDistribution.h>
// #import "FirebaseAppDistribution/FirebaseAppDistribution.h"
// #endif
// #import <FirebaseAuth/FirebaseAuth.h>
// #import <FirebaseCore/FirebaseCore.h>
// #import <FirebaseCrashlytics/FirebaseCrashlytics.h>
// #import <FirebaseDatabase/FirebaseDatabase.h>
// #import "FirebaseAuth/FirebaseAuth.h"
// #import "FirebaseCore/FirebaseCore.h"
// #import "FirebaseCrashlytics/FirebaseCrashlytics.h"
// #import "FirebaseDatabase/FirebaseDatabase.h"
// #if TARGET_OS_IOS && !TARGET_OS_MACCATALYST
// #import <FirebaseDynamicLinks/FirebaseDynamicLinks.h>
// #import "FirebaseDynamicLinks/FirebaseDynamicLinks.h"
// #endif
// #import <FirebaseFirestore/FirebaseFirestore.h>
// #import "FirebaseFirestore/FirebaseFirestore.h"
// #if (TARGET_OS_IOS || TARGET_OS_TV) && !TARGET_OS_MACCATALYST
// #import <FirebaseInAppMessaging/FirebaseInAppMessaging.h>
// #import "FirebaseInAppMessaging/FirebaseInAppMessaging.h"
// #endif
// #import <FirebaseInstallations/FirebaseInstallations.h>
// #import <FirebaseMessaging/FirebaseMessaging.h>
// #import "FirebaseInstallations/FirebaseInstallations.h"
// #import "FirebaseMessaging/FirebaseMessaging.h"
// #if (TARGET_OS_IOS && !TARGET_OS_MACCATALYST) || TARGET_OS_TV
// #import <FirebasePerformance/FirebasePerformance.h>
// #import "FirebasePerformance/FirebasePerformance.h"
// #endif
// #import <FirebaseRemoteConfig/FirebaseRemoteConfig.h>
// #import "FirebaseRemoteConfig/FirebaseRemoteConfig.h"
Loading

0 comments on commit f22918d

Please sign in to comment.