Skip to content

Commit

Permalink
[#491] Use Swift in CICD
Browse files Browse the repository at this point in the history
  • Loading branch information
blyscuit committed Jul 10, 2023
1 parent 59eb28f commit 178bf60
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test_upload_build_to_firebase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
run: sh make.sh --bundle-id co.nimblehq.ios.templates --bundle-id-staging co.nimblehq.ios.templates.staging --project-name TemplateApp --interface UIKit

- name: Start Setup Script for Template App Firebase Upload
run: sh set_up_test_firebase.sh
run: cat Scripts/Swift/SetUpTestFirebase.swift Scripts/Swift/Extensions/FileManager+Utils.swift Scripts/Swift/Helpers/SafeShell.swift | swift -
env:
MATCH_REPO: ${{ secrets.MATCH_REPO }}
STAGING_FIREBASE_APP_ID: ${{ secrets.STAGING_FIREBASE_APP_ID }}
Expand Down
26 changes: 13 additions & 13 deletions Scripts/Swift/SetUpTestFirebase.swift
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
static let ConstantTeamId = "<#teamId#>"
static let ConstantStagingFirebaseAppId = "<#stagingFirebaseAppId#>"
static let ConstantFirebaseTesterGroups = "<#group1#>, <#group2#>"
static let ConstantMatchRepo = "[email protected]:{organization}\/{repo}.git"
let ConstantTeamId = "<#teamId#>"
let ConstantStagingFirebaseAppId = "<#stagingFirebaseAppId#>"
let ConstantFirebaseTesterGroups = "<#group1#>, <#group2#>"
let ConstantMatchRepo = "[email protected]:{organization}\\/{repo}.git"

let envMatchRepo = ProcessInfo.processInfo.environment["MATCH_REPO"]
let envStagingFirebaseAppId = ProcessInfo.processInfo.environment["STAGING_FIREBASE_APP_ID"]
let envTeamId = ProcessInfo.processInfo.environment["TEAM_ID"]
let matchRepoEscaped = envMatchRepo.replacingOccurrences(of: "/", with: "\/")
let envMatchRepo = ProcessInfo.processInfo.environment["MATCH_REPO"] ?? ""
let envStagingFirebaseAppId = ProcessInfo.processInfo.environment["STAGING_FIREBASE_APP_ID"] ?? ""
let envTeamId = ProcessInfo.processInfo.environment["TEAM_ID"] ?? ""
let matchRepoEscaped = envMatchRepo.replacingOccurrences(of: "/", with: "\\/")
let firebaseTesterGroup = "nimble"

let fileManager = FileManager.default
let workingDirectory = fileManager.currentDirectoryPath
let workingDirectory = fileManager.currentDirectoryPath.replacingOccurrences(of: "/", with: "\\/")

try? safeShell("LC_ALL=C find \(workingDirectory) -type f -exec sed -i \"\" \"s/\(ConstantTeamId)/\(envTeamId)/g\" {} +")
try? safeShell("LC_ALL=C find \(workingDirectory) -type f -exec sed -i \"\" \"s/\(ConstantStagingFirebaseAppId)/\(envStagingFirebaseAppId)/g\" {} +")
try? safeShell("LC_ALL=C find \(workingDirectory) -type f -exec sed -i \"\" \"s/\(ConstantFirebaseTesterGroups)/\(firebaseTesterGroup)/g\" {} +")
try? safeShell("LC_ALL=C find \(workingDirectory) -type f -exec sed -i \"\" \"s/\(ConstantMatchRepo)/\(matchRepoEscaped)/g\" {} +")
try safeShell("LC_ALL=C find \(workingDirectory) -type f -exec sed -i \"\" \"s/\(ConstantTeamId)/\(envTeamId)/g\" {} +")
try safeShell("LC_ALL=C find \(workingDirectory) -type f -exec sed -i \"\" \"s/\(ConstantStagingFirebaseAppId)/\(envStagingFirebaseAppId)/g\" {} +")
try safeShell("LC_ALL=C find \(workingDirectory) -type f -exec sed -i \"\" \"s/\(ConstantFirebaseTesterGroups)/\(firebaseTesterGroup)/g\" {} +")
try safeShell("LC_ALL=C find \(workingDirectory) -type f -exec sed -i \"\" \"s/\(ConstantMatchRepo)/\(matchRepoEscaped)/g\" {} +")
1 change: 0 additions & 1 deletion make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ git reset

if [[ -z "${CI}" ]]; then
rm -rf fastlane/Tests
rm -f set_up_test_firebase.sh
rm -f set_up_test_testflight.sh
cat Scripts/Swift/SetUpCICDService.swift Scripts/Swift/Extensions/FileManager+Utils.swift Scripts/Swift/Helpers/SafeShell.swift > t.swift && swift t.swift && rm -rf 't.swift'
cat Scripts/Swift/SetUpDeliveryConstants.swift Scripts/Swift/Extensions/FileManager+Utils.swift Scripts/Swift/Helpers/SafeShell.swift > t.swift && swift t.swift && rm -rf 't.swift'
Expand Down
12 changes: 0 additions & 12 deletions set_up_test_firebase.sh

This file was deleted.

0 comments on commit 178bf60

Please sign in to comment.