Initial CI and SPM (#1)

This commit is contained in:
Paul Beusterien authored and GitHub committed 2021-01-26 13:15:21 -08:00
1 parent 1e62dbccfd
commit 4239ca8cc7
12 files changed
+315 -28

No files matched your search

+53
View File
@@ -0,0 +1,53 @@
name: check
on:
pull_request:
push:
branches: main
jobs:
check:
runs-on: macos-latest
env:
MINT_PATH: ${{ github.workspace }}/mint
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.6
- name: Cache Mint packages
uses: actions/cache@v1
with:
path: ${{ env.MINT_PATH }}
key: ${{ runner.os }}-mint-${{ hashFiles('**/Mintfile') }}
restore-keys: ${{ runner.os }}-mint-
- name: Setup Scripts Directory
run: ./setup-scripts.sh
- name: Setup check
run: |
brew update
brew install clang-format@11
brew install mint
mint bootstrap
- name: Style
run: scripts/style.sh test-only
- name: Whitespace
run: scripts/check_whitespace.sh
- name: Filename spaces
run: scripts/check_filename_spaces.sh
- name: Copyrights
run: scripts/check_copyright.sh
- name: Module imports
run: scripts/check_no_module_imports.sh
- name: Imports
run: scripts/check_imports.swift
+9 -19
View File
@@ -2,25 +2,20 @@ name: datatransport
on:
pull_request:
paths:
- 'GoogleDataTransport**'
- '.github/workflows/datatransport.yml'
- 'Gemfile'
schedule:
# Run every day at 11pm (PST) - cron uses UTC times
- cron: '0 7 * * *'
jobs:
pod_lib_lint:
# Don't run on private repo unless it is a PR.
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
runs-on: macos-latest
strategy:
matrix:
target: [ios, tvos, macos, watchos]
steps:
- uses: actions/checkout@v2
- name: Setup Scripts Directory
run: ./setup-scripts.sh
- name: Setup Bundler
run: ./scripts/setup_bundler.sh
- name: PodLibLint DataTransport
@@ -28,26 +23,24 @@ jobs:
scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb GoogleDataTransport.podspec --platforms=${{ matrix.target }}
catalyst:
# Don't run on private repo unless it is a PR.
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
runs-on: macOS-latest
steps:
- uses: actions/checkout@v2
- name: Setup Scripts Directory
run: ./setup-scripts.sh
- name: Setup Bundler
run: scripts/setup_bundler.sh
- name: Setup project and Test Catalyst
run: scripts/third_party/travis/retry.sh scripts/test_catalyst.sh GoogleDataTransport build
watchos-testapp:
# Don't run on private repo unless it is a PR.
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
runs-on: macOS-latest
steps:
- uses: actions/checkout@v2
- name: Xcode 12
run: sudo xcode-select -s /Applications/Xcode_12.app/Contents/Developer
- name: Setup Scripts Directory
run: ./setup-scripts.sh
- name: Setup Bundler
run: scripts/setup_bundler.sh
- name: Prereqs
@@ -55,12 +48,7 @@ jobs:
- name: Setup project and build watchOS test app
run: scripts/third_party/travis/retry.sh scripts/build.sh GoogleDataTransport watchOS xcodebuild
# Scheduled jobs
datatransport-cron-only:
# Don't run on private repo.
if: github.event_name == 'schedule' && github.repository == 'Firebase/firebase-ios-sdk'
datatransport-options-matrix:
runs-on: macos-latest
strategy:
matrix:
@@ -72,6 +60,8 @@ jobs:
needs: pod_lib_lint
steps:
- uses: actions/checkout@v2
- name: Setup Scripts Directory
run: ./setup-scripts.sh
- name: Setup Bundler
run: ./scripts/setup_bundler.sh
- name: PodLibLint DataTransport Cron
+22
View File
@@ -0,0 +1,22 @@
name: spm
on:
pull_request:
schedule:
# Run every day at 11pm (PST) - cron uses UTC times
- cron: '0 7 * * *'
jobs:
swift-build-run:
runs-on: macOS-latest
strategy:
matrix:
target: [iOS, tvOS, macOS, catalyst]
steps:
- uses: actions/checkout@v2
- name: Setup Scripts Directory
run: ./setup-scripts.sh
- name: Initialize xcodebuild
run: xcodebuild -list
- name: iOS Unit Tests
run: scripts/third_party/travis/retry.sh scripts/build.sh GoogleDataTransport ${{ matrix.target }} spm
+53
View File
@@ -0,0 +1,53 @@
# OS X
.DS_Store
# Xcode
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata/
*.xccheckout
profile
*.moved-aside
DerivedData
*.hmap
*.ipa
# Swift Package Manager
*/.build
Package.resolved
# Mint package manager
Mint
# IntelliJ
.idea
# Vim
*.swo
*.swp
*~
# Bundler
/.bundle
/vendor
# Pods
Pods/
Podfile.lock
*.xcworkspace
# CocoaPods generate
gen/
#firebase-ios-sdk clone
firebase-ios-sdk/
#scripts link
scripts
@@ -9,12 +9,9 @@ target 'GDTCCTWatchOSIndependentTestAppWatchKitExtension' do
# Pods for GDTCCTWatchOSIndependentTestAppWatchKitExtension
pod 'SwiftProtobuf', '~> 1.0'
pod 'GoogleDataTransport', :path => '../../'
pod 'FirebaseCore', :path => '../../'
pod 'FirebaseMessaging', :path => '../../'
pod 'FirebaseInstanceID', :path => '../../'
pod 'FirebaseCoreDiagnostics', :path => '../../'
pod 'FirebaseInstallations', :path => '../../'
pod 'FirebaseStorage', :path => '../../'
pod 'FirebaseCore'
pod 'FirebaseMessaging'
pod 'FirebaseStorage'
end
@@ -22,8 +19,7 @@ target 'GDTCCTServiceExtension' do
platform :watchos, '6.0'
# Pods for GDTCCTServiceExtension
pod 'FirebaseMessaging', :path => '../../'
pod 'FirebaseInstanceID', :path => '../../'
pod 'FirebaseMessaging'
pod 'SwiftProtobuf', '~> 1.0'
pod 'GoogleDataTransport', :path => '../../'
end
@@ -149,7 +149,7 @@ GDTCORNetworkMobileSubtype GDTCORNetworkMobileSubTypeMessage() {
} else {
return GDTCORNetworkMobileSubtypeUNKNOWN;
}
#else // TARGET_OS_IOS
#else // TARGET_OS_IOS
return GDTCORNetworkMobileSubtypeUNKNOWN;
#endif // TARGET_OS_IOS
}
+1
View File
@@ -0,0 +1 @@
nicklockwood/SwiftFormat@0.45.5
+92
View File
@@ -0,0 +1,92 @@
// swift-tools-version:5.3
// The swift-tools-version declares the minimum version of Swift required to build this package.
// Copyright 2021 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 PackageDescription
let package = Package(
name: "GoogleDataTransport",
platforms: [.iOS(.v10), .macOS(.v10_12), .tvOS(.v10), .watchOS(.v6)],
products: [
.library(
name: "GoogleDataTransport",
targets: ["GoogleDataTransport"]
),
],
dependencies: [
.package(
name: "nanopb",
url: "https://github.com/firebase/nanopb.git",
"2.30907.0" ..< "2.30908.0"
),
],
// TODO: Restructure directory structure to simplify the excludes here.
targets: [
.target(
name: "GoogleDataTransport",
dependencies: [
.product(name: "nanopb", package: "nanopb"),
],
path: "GoogleDataTransport",
exclude: [
"CHANGELOG.md",
"README.md",
"generate_project.sh",
"GDTCCTWatchOSTestApp/",
"GDTWatchOSTestApp/",
"GDTCCTTestApp/",
"GDTTestApp/",
"GDTCCTTests/",
"GDTCORTests/",
"ProtoSupport/",
],
sources: [
"GDTCORLibrary",
"GDTCCTLibrary",
],
publicHeadersPath: "GDTCORLibrary/Public",
cSettings: [
.headerSearchPath("../"),
.define("GDTCOR_VERSION", to: "0.0.1"),
.define("PB_FIELD_32BIT", to: "1"),
.define("PB_NO_PACKED_STRUCTS", to: "1"),
.define("PB_ENABLE_MALLOC", to: "1"),
],
linkerSettings: [
.linkedFramework("SystemConfiguration", .when(platforms: [.iOS, .macOS, .tvOS])),
.linkedFramework("CoreTelephony", .when(platforms: [.macOS, .iOS])),
]
),
.testTarget(
name: "swift-test",
dependencies: [
"GoogleDataTransport",
],
path: "SwiftPMTests/swift-test"
),
.testTarget(
name: "objc-import-test",
dependencies: [
"GoogleDataTransport",
],
path: "SwiftPMTests/objc-import-test"
),
// TODO: - need to port Network/third_party/GTMHTTPServer.m to ARC.
// TODO: - Setup unit tests in SPM.
],
cLanguageStandard: .c99,
cxxLanguageStandard: CXXLanguageStandard.gnucxx14
)
@@ -0,0 +1,19 @@
// Copyright 2021 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 "GoogleDataTransport/GDTCORClock.h"
#import "GoogleDataTransport/GDTCORTransport.h"
#import <GoogleDataTransport/GDTCORClock.h>
#import <GoogleDataTransport/GDTCORTransport.h>
@@ -0,0 +1,15 @@
// Copyright 2021 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 GoogleDataTransport;
+24
View File
@@ -0,0 +1,24 @@
// Copyright 2021 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 Foundation
import GoogleDataTransport
import XCTest
class importTest: XCTestCase {
func testImports() throws {
XCTAssertTrue(GDTCORClock.snapshot().timeMillis > 0)
}
}
+22
View File
@@ -0,0 +1,22 @@
#!/bin/bash
# Copyright 2021 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.
git clone \
--depth 1 \
--no-checkout \
https://github.com/firebase/firebase-ios-sdk.git \
;
cd firebase-ios-sdk
git checkout master -- scripts
cd ..
ln -s firebase-ios-sdk/scripts scripts