Skip to content

Commit

Permalink
Create github workflow (#4)
Browse files Browse the repository at this point in the history
* Create github workflow

* Update workflow trigger branch

* Update workflows folder name

* Resolve action error

* Update branch

* Delete workflow folder

* Add secrets environment variable to workflows yml

* Reset build settings

* Reset build settings

* Update env

* Debug

* debug

* fix secret is empty

* fix environment

* Remove debug echo

* update simulator device name

* test

* test

* test

* test

* test

* Test

* Set up local env

* fix
  • Loading branch information
banghuazhao authored Oct 5, 2024
1 parent efb284d commit 099c8e4
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 7 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/swift-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@

name: Swift Unit Tests

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
test:
name: Run Unit Tests
runs-on: macos-latest
environment: GIDClientID

strategy:
matrix:
xcode-version: ['16.0']
ios-version: ['18.0']

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ matrix.xcode-version }}

- name: Build and Test
env:
GIDCLIENTID: ${{ secrets.GIDCLIENTID }}
run: |
xcodebuild clean build test \
-scheme AdRevenueWatch \
-destination 'platform=iOS Simulator,name=iPhone 15,OS=${{ matrix.ios-version }}' \
-configuration Debug \
GIDCLIENTID="${GIDCLIENTID}" \
CODE_SIGNING_ALLOWED=NO
8 changes: 2 additions & 6 deletions AdRevenueWatch.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
9972A7D42C8DA2580027DBD2 /* Domain */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = Domain; sourceTree = "<group>"; };
9972A7E22C8DAACB0027DBD2 /* Repository */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = Repository; sourceTree = "<group>"; };
99A841CE2C8DAD3500D74617 /* Dependency.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Dependency.swift; sourceTree = "<group>"; };
99A841D02C8DBCD600D74617 /* Secret.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Secret.xcconfig; sourceTree = "<group>"; };
99A841D12C8DBCD600D74617 /* Release.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = "<group>"; };
99A841D72C8DBDCA00D74617 /* Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = "<group>"; };
99FB734D2CAF730200924669 /* AdRevenueWatchTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AdRevenueWatchTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -136,7 +135,6 @@
99A841D22C8DBCD600D74617 /* Config */ = {
isa = PBXGroup;
children = (
99A841D02C8DBCD600D74617 /* Secret.xcconfig */,
99A841D72C8DBDCA00D74617 /* Debug.xcconfig */,
99A841D12C8DBCD600D74617 /* Release.xcconfig */,
);
Expand Down Expand Up @@ -289,7 +287,6 @@
/* Begin XCBuildConfiguration section */
9972A7BD2C8C62970027DBD2 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 99A841D02C8DBCD600D74617 /* Secret.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
Expand Down Expand Up @@ -353,7 +350,6 @@
};
9972A7BE2C8C62970027DBD2 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 99A841D02C8DBCD600D74617 /* Secret.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
Expand Down Expand Up @@ -480,7 +476,7 @@
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = F694X76A5X;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
IPHONEOS_DEPLOYMENT_TARGET = 16;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.appsbay.AdRevenueWatchTests;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -499,7 +495,7 @@
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = F694X76A5X;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
IPHONEOS_DEPLOYMENT_TARGET = 16;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.appsbay.AdRevenueWatchTests;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
9 changes: 9 additions & 0 deletions AdRevenueWatch/AdRevenueWatchApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ import SwiftUI

@main
struct AdRevenueWatchApp: App {
init() {
// In CI, this is nil as the scheme doesn't have this environment variable
// This environment is variable only in local scheme
if let GIDClientID = ProcessInfo.processInfo.environment["GIDCLIENTID"] {
let config = GIDConfiguration(clientID: GIDClientID)
GIDSignIn.sharedInstance.configuration = config
}
}

var body: some Scene {
WindowGroup {
AppView(
Expand Down
2 changes: 1 addition & 1 deletion AdRevenueWatch/Supportings/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>$(GOOGLE_REDIRECT_URL_SCHEMES)</string>
<string>com.googleusercontent.apps.48838700100-8o0jclvbc2oiffq0t1hl1lm6i0k9mipd</string>
</array>
</dict>
</array>
Expand Down

0 comments on commit 099c8e4

Please sign in to comment.