Skip to content
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

[#3] [#7] [iOS] Set Up CICD for iOS for test and upload to Firebase Distribution #47

Merged
merged 10 commits into from
Sep 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/android_review_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:

- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.10.0
with:
Expand Down
117 changes: 117 additions & 0 deletions .github/workflows/deploy_ios_firebase.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: Deploy iOS Staging Build To Firebase

# SECRETS needed:
### SSH_PRIVATE_KEY for Match Repo
### MATCH_PASS
### FIREBASE_TOKEN
### IOS_GOOGLE_SERVICE_INFO

on:
push:
branches: [ develop, main ]
workflow_dispatch:

defaults:
run:
working-directory: iosApp

jobs:
Lint:
name: lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Run SwiftLint
uses: norio-nomura/action-swiftlint@3.1.0
with:
args: --strict

build:
name: Build
runs-on: macOS-latest
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.5.0
with:
access_token: ${{ github.token }}

- name: Set up JAVA 11
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'

- uses: actions/checkout@v2
# Set fetch-depth (default: 1) to get whole tree
with:
fetch-depth: 0

- name: Install SSH key
uses: webfactory/ssh-agent@v0.5.4
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}

- name: Cache gems
uses: actions/cache@v2
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-

- name: Bundle install
run: bundle install

- name: Cache Gradle
uses: actions/cache@v2
with:
path: |
~/.gradle/caches/modules-*
~/.gradle/caches/jars-*
~/.gradle/caches/build-cache-*
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-

- name: Generate KMM frameworks for Cocoapods
run: |
cd ..
./gradlew generateDummyFramework

- name: Cache Pods
uses: actions/cache@v2
id: cocoapodCache
with:
path: Pods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-

- name: Install Pods Dependencies
run: bundle exec pod install
shell: bash

- name: Setup Google Services
env:
IOS_GOOGLE_SERVICE_INFO: ${{ secrets.IOS_GOOGLE_SERVICE_INFO_Staging }}
run: |
mkdir -p Survey/Configurations/Plists/GoogleService/Staging
touch Survey/Configurations/Plists/GoogleService/Staging/GoogleService-Info.plist
echo $IOS_GOOGLE_SERVICE_INFO_STAGING | base64 --decode > Survey/Configurations/Plists/GoogleService/Staging/GoogleService-Info.plist

- name: Build and Test
run: bundle exec fastlane build_and_test

- name: Match Ad-hoc
run: bundle exec fastlane sync_adhoc_signing
env:
MATCH_PASSWORD: ${{ secrets.MATCH_PASS }}

- name: Build App and Distribute to Firebase
run: bundle exec fastlane build_and_upload_staging_app
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
117 changes: 117 additions & 0 deletions .github/workflows/deploy_ios_release_firebase.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: Deploy iOS Release Build To Firebase

# SECRETS needed:
### SSH_PRIVATE_KEY for Match Repo
### MATCH_PASS
### FIREBASE_TOKEN
### IOS_GOOGLE_SERVICE_INFO

on:
push:
branches: [ develop, main ]
workflow_dispatch:

defaults:
run:
working-directory: iosApp

jobs:
Lint:
name: lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Run SwiftLint
uses: norio-nomura/action-swiftlint@3.1.0
with:
args: --strict

build:
name: Build
runs-on: macOS-latest
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.5.0
with:
access_token: ${{ github.token }}

- name: Set up JAVA 11
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'

- uses: actions/checkout@v2
# Set fetch-depth (default: 1) to get whole tree
with:
fetch-depth: 0

- name: Install SSH key
uses: webfactory/ssh-agent@v0.5.4
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}

- name: Cache gems
uses: actions/cache@v2
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-

- name: Bundle install
run: bundle install

- name: Cache Gradle
uses: actions/cache@v2
with:
path: |
~/.gradle/caches/modules-*
~/.gradle/caches/jars-*
~/.gradle/caches/build-cache-*
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-

- name: Generate KMM frameworks for Cocoapods
run: |
cd ..
./gradlew generateDummyFramework

- name: Cache Pods
uses: actions/cache@v2
id: cocoapodCache
with:
path: Pods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-

- name: Install Pods Dependencies
run: bundle exec pod install
shell: bash

- name: Setup Google Services
env:
IOS_GOOGLE_SERVICE_INFO: ${{ secrets.IOS_GOOGLE_SERVICE_INFO_PROD }}
run: |
mkdir -p Survey/Configurations/Plists/GoogleService/Production
touch Survey/Configurations/Plists/GoogleService/Production/GoogleService-Info.plist
echo $IOS_GOOGLE_SERVICE_INFO_STAGING | base64 --decode > Survey/Configurations/Plists/GoogleService/Production/GoogleService-Info.plist

- name: Build and Test
run: bundle exec fastlane build_and_test

- name: Match Ad-hoc
run: bundle exec fastlane sync_adhoc_production_signing
env:
MATCH_PASSWORD: ${{ secrets.MATCH_PASS }}

- name: Build Production App and Distribute to Firebase
run: bundle exec fastlane build_and_upload_production_app
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
1 change: 0 additions & 1 deletion .github/workflows/ios_review_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ jobs:
runs-on: macOS-latest
timeout-minutes: 30
steps:

- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.10.0
with:
Expand Down
19 changes: 10 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ cookiecutter.json
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

## User settings
xcuserdata/
**/xcuserdata/

## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
*.xcscmblueprint
Expand All @@ -61,7 +61,7 @@ xcuserdata/
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
Pods/
iosApp/Pods/

# fastlane
#
Expand All @@ -70,22 +70,23 @@ Pods/
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/#source-control

fastlane/README.md
fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots/**/*.png
fastlane/test_output
fastlane/xcov_output
iosApp/fastlane/README.md
iosApp/fastlane/report.xml
iosApp/fastlane/Preview.html
iosApp/fastlane/screenshots/**/*.png
iosApp/fastlane/test_output
iosApp/fastlane/xcov_output

# Sourcery
*.generated.swift

# Derived Data folder
DerivedData
iosApp/DerivedData

# Tuist
.tuist-generated

# JetBrains IDEs

.idea
**/GoogleService-*.plist
Loading