From afc4de690d8e441403a40404d9d4c7da7554529c Mon Sep 17 00:00:00 2001 From: David Bui Date: Thu, 12 Jan 2023 13:55:36 +0700 Subject: [PATCH 01/22] [#315] - Create codemagic.yaml --- codemagic.yaml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 codemagic.yaml diff --git a/codemagic.yaml b/codemagic.yaml new file mode 100644 index 00000000..36f85897 --- /dev/null +++ b/codemagic.yaml @@ -0,0 +1,17 @@ +workflows: + deploy_firebase_staging: + name: Deploy Firebase Staging + instance_type: mac_pro + environment: + groups: + - fastlane + xcode: 14.2 + cocoapods: default + scripts: + # - gem install bundler:2.2.27 + - bundle install --path vendor/bundle + - bundle exec pod install + - bundle exec fastlane beta + artifacts: + - ./*.ipa + - ./*.dSYM.zip \ No newline at end of file From e0c5444e31d8a49d9755207d09453625cf3bc7f8 Mon Sep 17 00:00:00 2001 From: David Bui Date: Fri, 13 Jan 2023 09:34:33 +0700 Subject: [PATCH 02/22] [#315] - Update codemagic.yaml - Update deliverable_setup with codemagic --- codemagic.yaml | 33 ++++++++++++++++++++++++++------- deliverable_setup.sh | 9 ++++++++- 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/codemagic.yaml b/codemagic.yaml index 36f85897..2a52e287 100644 --- a/codemagic.yaml +++ b/codemagic.yaml @@ -1,17 +1,36 @@ workflows: deploy_firebase_staging: name: Deploy Firebase Staging - instance_type: mac_pro + instance_type: mac_mini_m1 environment: groups: - fastlane - xcode: 14.2 + xcode: latest cocoapods: default + triggering: + events: + - push + branch_patterns: + - pattern: 'develop' + include: true + source: true + cancel_previous_builds: true scripts: - # - gem install bundler:2.2.27 - - bundle install --path vendor/bundle - - bundle exec pod install - - bundle exec fastlane beta + - name: Install bundle + script: + - bundle install --path vendor/bundle + - name: Install Pods Dependencies + script: + - bundle exec pod install + - name: Build and Test + script: + - bundle exec fastlane buildAndTest + - name: Match Ad-hoc + script: + - bundle exec fastlane syncAdHocStagingCodeSigning + - name: Build App and Distribute to Firebase + script: + - bundle exec fastlane buildStagingAndUploadToFirebase artifacts: - ./*.ipa - - ./*.dSYM.zip \ No newline at end of file + - ./*.dSYM.zip diff --git a/deliverable_setup.sh b/deliverable_setup.sh index 8e6411d1..21e74f25 100644 --- a/deliverable_setup.sh +++ b/deliverable_setup.sh @@ -1,12 +1,19 @@ #!/bin/sh -read -p "Which CI/CD service do you use (Can be edited later) [(g)ithub/(b)itrise/(l)ater]: " ciService +read -p "Which CI/CD service do you use (Can be edited later) [(g)ithub/(b)itrise/(c)odemagic/(l)ater]: " ciService if [ "$ciService" = "g" -o "$ciService" = "github" ]; then echo "Setting template for Github Actions" rm bitrise.yml + rm codemagic.yaml elif [ "$ciService" = "b" -o "$ciService" = "bitrise" ]; then echo "Setting template for Bitrise" rm -rf .github/workflows + rm codemagic.yaml +elif [ "$ciService" = "b" -o "$ciService" = "bitrise" ]; then + echo "Setting template for Bitrise" + rm -rf .github/workflows + rm bitrise.yml +else else echo "You can manually setup the template later." fi From c5b7ed8e1ad83f2cde4940ac708d874ed89cbf7d Mon Sep 17 00:00:00 2001 From: David Bui Date: Fri, 13 Jan 2023 09:38:29 +0700 Subject: [PATCH 03/22] [#315] - Update deliverable_setup.sh --- deliverable_setup.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/deliverable_setup.sh b/deliverable_setup.sh index 21e74f25..5dc1ef7a 100644 --- a/deliverable_setup.sh +++ b/deliverable_setup.sh @@ -9,11 +9,10 @@ elif [ "$ciService" = "b" -o "$ciService" = "bitrise" ]; then echo "Setting template for Bitrise" rm -rf .github/workflows rm codemagic.yaml -elif [ "$ciService" = "b" -o "$ciService" = "bitrise" ]; then - echo "Setting template for Bitrise" +elif [ "$ciService" = "b" -o "$ciService" = "codemagic" ]; then + echo "Setting template for CodeMagic" rm -rf .github/workflows rm bitrise.yml -else else echo "You can manually setup the template later." fi From 79619beecbe7a779bd57a384f15b00c58918bcf2 Mon Sep 17 00:00:00 2001 From: David Bui Date: Mon, 30 Jan 2023 15:43:42 +0700 Subject: [PATCH 04/22] [#315] - Update codemagic.yaml - Update deliverable_setup with codemagic --- codemagic.yaml | 114 ++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 103 insertions(+), 11 deletions(-) diff --git a/codemagic.yaml b/codemagic.yaml index 2a52e287..60e2d20c 100644 --- a/codemagic.yaml +++ b/codemagic.yaml @@ -1,5 +1,5 @@ workflows: - deploy_firebase_staging: + deploy_staging: name: Deploy Firebase Staging instance_type: mac_mini_m1 environment: @@ -17,20 +17,112 @@ workflows: cancel_previous_builds: true scripts: - name: Install bundle - script: - - bundle install --path vendor/bundle + script: bundle install --path vendor/bundle - name: Install Pods Dependencies - script: - - bundle exec pod install + script: bundle exec pod install - name: Build and Test - script: - - bundle exec fastlane buildAndTest + script: bundle exec fastlane buildAndTest - name: Match Ad-hoc - script: - - bundle exec fastlane syncAdHocStagingCodeSigning + script: bundle exec fastlane syncAdHocStagingCodeSigning - name: Build App and Distribute to Firebase - script: - - bundle exec fastlane buildStagingAndUploadToFirebase + script: bundle exec fastlane buildStagingAndUploadToFirebase artifacts: - ./*.ipa - ./*.dSYM.zip + deploy_release_firebase: + name: Deploy Firebase Production + instance_type: mac_mini_m1 + environment: + groups: + - fastlane + xcode: latest + cocoapods: default + triggering: + events: + - push + branch_patterns: + - pattern: 'release/*' + include: true + source: true + cancel_previous_builds: true + scripts: + - name: Install bundle + script: bundle install --path vendor/bundle + - name: Install Pods Dependencies + script: bundle exec pod install + - name: Build and Test + script: bundle exec fastlane buildAndTest + - name: Match Ad-hoc + script: bundle exec fastlane syncAdHocProductionCodeSigning + - name: Build App and Distribute to Firebase + script: bundle exec fastlane buildProductionAndUploadToFirebase + artifacts: + - ./*.ipa + - ./*.dSYM.zip + deploy_app_store: + name: Deploy App Store + instance_type: mac_mini_m1 + environment: + groups: + - fastlane + xcode: latest + cocoapods: default + triggering: + events: + - push + branch_patterns: + - pattern: 'main' + include: true + source: true + cancel_previous_builds: true + scripts: + - name: Install bundle + script: bundle install --path vendor/bundle + - name: Install Pods Dependencies + script: bundle exec pod install + - name: Build and Test + script: bundle exec fastlane buildAndTest + - name: Match AppStore + script: bundle exec fastlane syncAppStoreCodeSigning + - name: Build App and Distribute to AppStore + script: bundle exec fastlane buildAndUploadToAppStore + artifacts: + - ./*.ipa + - ./*.dSYM.zip + test: + name: Test + instance_type: mac_mini_m1 + environment: + groups: + - fastlane + xcode: latest + cocoapods: default + triggering: + events: + - push + - pull_request + branch_patterns: + - pattern: '*' + include: true + source: true + cancel_previous_builds: true + scripts: + - name: Install bundle + script: bundle install --path vendor/bundle + - name: Install Pods Dependencies + script: bundle exec pod install + - name: Build and Test + script: bundle exec fastlane buildAndTest + - name: Clean Up + script: bundle exec fastlane cleanUpOutput + artifacts: + - ./*.ipa + - ./*.dSYM.zip + + + + + + + + From ff4daba9b1f6f9a25d0787c29287d4a5dba53c3e Mon Sep 17 00:00:00 2001 From: David Bui Date: Fri, 3 Feb 2023 09:57:37 +0700 Subject: [PATCH 05/22] [#315] - Update Fastlane Constant - Update Fastlane Build - Update deliverable_setup.sh --- deliverable_setup.sh | 2 +- fastlane/Constants/Constant.swift | 6 ++++-- fastlane/Helpers/Build.swift | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/deliverable_setup.sh b/deliverable_setup.sh index 5dc1ef7a..d8f26dbd 100644 --- a/deliverable_setup.sh +++ b/deliverable_setup.sh @@ -9,7 +9,7 @@ elif [ "$ciService" = "b" -o "$ciService" = "bitrise" ]; then echo "Setting template for Bitrise" rm -rf .github/workflows rm codemagic.yaml -elif [ "$ciService" = "b" -o "$ciService" = "codemagic" ]; then +elif [ "$ciService" = "c" -o "$ciService" = "codemagic" ]; then echo "Setting template for CodeMagic" rm -rf .github/workflows rm bitrise.yml diff --git a/fastlane/Constants/Constant.swift b/fastlane/Constants/Constant.swift index 006207f3..08c5e02a 100644 --- a/fastlane/Constants/Constant.swift +++ b/fastlane/Constants/Constant.swift @@ -39,7 +39,9 @@ enum Constant { // MARK: Platform static var platform: PlatformType { - if EnvironmentParser.bool(key: "BITRISE_IO") { + if EnvironmentParser.bool(key: "CM_BRANCH") { + return .codeMagic + } else if EnvironmentParser.bool(key: "BITRISE_IO") { return .bitrise } else if EnvironmentParser.bool(key: "GITHUB_ACTIONS") { return .gitHubActions @@ -129,7 +131,7 @@ extension Constant { enum PlatformType { - case gitHubActions, bitrise, unknown + case gitHubActions, bitrise, codeMagic, unknown } } diff --git a/fastlane/Helpers/Build.swift b/fastlane/Helpers/Build.swift index e187f5b9..a3444220 100644 --- a/fastlane/Helpers/Build.swift +++ b/fastlane/Helpers/Build.swift @@ -31,7 +31,7 @@ enum Build { sh(command: "echo DSYM_OUTPUT_PATH=\(dsymPath ?? "") >> $GITHUB_ENV") sh(command: "echo BUILD_NUMBER=\(buildNumber ?? "") >> $GITHUB_ENV") sh(command: "echo VERSION_NUMBER=\(Version.versionNumber) >> $GITHUB_ENV") - case .bitrise: + case .bitrise, .codeMagic: sh(command: "envman add --key BUILD_PATH --value '\(Constant.outputPath)'") default: break } From 01d0dc281125be475fd0bc08eda994f0a4607078 Mon Sep 17 00:00:00 2001 From: David Bui Date: Mon, 6 Feb 2023 10:23:18 +0700 Subject: [PATCH 06/22] [#315] - Update codemagic configuration file - Create CodeMagic Wiki page - Update CodeMagic reference in SideBar page --- .github/wiki/CodeMagic.md | 78 +++++++++++++++++++++++++++++++++++++++ .github/wiki/_Sidebar.md | 1 + codemagic.yaml | 2 + 3 files changed, 81 insertions(+) create mode 100644 .github/wiki/CodeMagic.md diff --git a/.github/wiki/CodeMagic.md b/.github/wiki/CodeMagic.md new file mode 100644 index 00000000..e520eeb6 --- /dev/null +++ b/.github/wiki/CodeMagic.md @@ -0,0 +1,78 @@ +# CodeMagic + +Use the CodeMagic template to start a new project with CodeMagic as the CI/CD tool. + +## Workflows and Steps + +Out of the box, the CodeMagic Template has the following workflows and steps: + +| test | deploy_app_store | deploy_staging | deploy_release_firebase | +| ------------------------- | ------------------------------------------------------- | --------------------------------------- | ----------------------------------------- | +| Install bundle | Install bundle | Install bundle | Install bundle | +| Run CocoaPods install | Run CocoaPods install | Run CocoaPods install | Run CocoaPods install | +| Fastlane - Build and Test | Fastlane - Build and Test | Fastlane - Build and Test | Fastlane - Build and Test | +| Fastlane - Clean Up Xcov | Fastlane Match | Fastlane Match | Fastlane Match | +| Danger | Fastlane - Build and Upload Production App to App Store | Fastlane - Build and Upload Staging App | Fastlane: Build and Upload Production App | + +## Trigger Map + +| Workflow | Trigger | +| ----------------------- | ----------------------- | +| test | Create or Update a PR | +| deploy_staging | Push branch `develop` | +| deploy_release_firebase | Push branch `release/*` | +| deploy_app_store | Push branch `main` | + +## Environment + +### Variables + +- MATCH_PASSWORD + +> The password used to encrypt/decrypt the repository used to store your distribution certificates and provisioning profiles. + +- MATCH_SSH_KEY + +> An SSH private key is used for cloning the Match repository that contains your distribution certificates and provisioning + +- KEYCHAIN_PASSWORD + +> The password to access the keychain + +- FIREBASE_CLI_TOKEN + +> Firebase token https://firebase.google.com/docs/cli#cli-ci-systems for uploading build to Firebase Distributions and Analytics. + +- APPSTORE_CONNECT_API_KEY + +> App Store Connect API https://docs.fastlane.tools/actions/app_store_connect_api_key/ for uploading build to TestFlight or App Store. It should be `base64` encoded. + +- API_KEY_ID + +> The key identifier of your App Store Connect API key. + +- ISSUER_ID + +> The issuer of your App Store Connect API key. + +- BUMP_APP_STORE_BUILD_NUMBER + +> The flag to determine if the Fastlane should bump the app store build number + +## Installation + +1. Follow the setup instruction in [`README.md`](https://github.com/nimblehq/ios-templates#readme). +2. To connect your repository to CodeMagic, please follow the instruction on this page: [Adding the app to CodeMagic](https://docs.codemagic.io/yaml-quick-start/building-a-native-ios-app). + +3. Provide all the required variables and secrets. + +> The final project directory structure + +``` +ROOT +├── ExampleApp.xcworkspace +├── codemagic.yaml +├──... +``` + +5. Push changes to SCM. \ No newline at end of file diff --git a/.github/wiki/_Sidebar.md b/.github/wiki/_Sidebar.md index f4622366..238befd9 100644 --- a/.github/wiki/_Sidebar.md +++ b/.github/wiki/_Sidebar.md @@ -15,6 +15,7 @@ - [[Github Actions]] - [[Self Hosted Github Actions]] - [[Bitrise]] +- [[CodeMagic]] - [[Fastlane]] ## Operations diff --git a/codemagic.yaml b/codemagic.yaml index 60e2d20c..eff94e36 100644 --- a/codemagic.yaml +++ b/codemagic.yaml @@ -82,6 +82,8 @@ workflows: script: bundle exec pod install - name: Build and Test script: bundle exec fastlane buildAndTest + - name: Match Ad-hoc + script: bundle exec fastlane syncAdHocProductionCodeSigning - name: Match AppStore script: bundle exec fastlane syncAppStoreCodeSigning - name: Build App and Distribute to AppStore From 910af1eca147cfefb9bba3d60faa07a946787502 Mon Sep 17 00:00:00 2001 From: David Bui Date: Mon, 6 Feb 2023 10:35:13 +0700 Subject: [PATCH 07/22] [#315] - - Update CodeMagic wiki page --- .github/wiki/CodeMagic.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/wiki/CodeMagic.md b/.github/wiki/CodeMagic.md index e520eeb6..ffe8dc20 100644 --- a/.github/wiki/CodeMagic.md +++ b/.github/wiki/CodeMagic.md @@ -75,4 +75,4 @@ ROOT ├──... ``` -5. Push changes to SCM. \ No newline at end of file +4. Push changes to SCM. \ No newline at end of file From 05f0853b4ceda567ce26f879ab30574a25e18521 Mon Sep 17 00:00:00 2001 From: David Bui Date: Mon, 6 Feb 2023 10:35:47 +0700 Subject: [PATCH 08/22] [#315] - Update CodeMagic wiki page --- .github/wiki/CodeMagic.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/wiki/CodeMagic.md b/.github/wiki/CodeMagic.md index ffe8dc20..d7e10710 100644 --- a/.github/wiki/CodeMagic.md +++ b/.github/wiki/CodeMagic.md @@ -29,11 +29,11 @@ Out of the box, the CodeMagic Template has the following workflows and steps: - MATCH_PASSWORD -> The password used to encrypt/decrypt the repository used to store your distribution certificates and provisioning profiles. +> The password is used to encrypt/decrypt the repository to store your distribution certificates and provisioning profiles. - MATCH_SSH_KEY -> An SSH private key is used for cloning the Match repository that contains your distribution certificates and provisioning +> An SSH private key is used for cloning the Match repository that contains your distribution certificates and provisioning. - KEYCHAIN_PASSWORD From 2bc14c20e5e0139e08aa4b1df68cf39dfbb31b6c Mon Sep 17 00:00:00 2001 From: David Bui Date: Mon, 6 Feb 2023 10:47:35 +0700 Subject: [PATCH 09/22] [#315] - Update codemagic.yaml - Update deliverable_setup with codemagic --- codemagic.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/codemagic.yaml b/codemagic.yaml index eff94e36..c52efe5d 100644 --- a/codemagic.yaml +++ b/codemagic.yaml @@ -13,7 +13,6 @@ workflows: branch_patterns: - pattern: 'develop' include: true - source: true cancel_previous_builds: true scripts: - name: Install bundle @@ -43,7 +42,6 @@ workflows: branch_patterns: - pattern: 'release/*' include: true - source: true cancel_previous_builds: true scripts: - name: Install bundle @@ -73,7 +71,6 @@ workflows: branch_patterns: - pattern: 'main' include: true - source: true cancel_previous_builds: true scripts: - name: Install bundle From e0efd598148a551adebe53fb61cfe4aaa1f594d4 Mon Sep 17 00:00:00 2001 From: David Bui Date: Mon, 6 Feb 2023 10:55:25 +0700 Subject: [PATCH 10/22] [#315] - Update codemagic.yaml cache --- codemagic.yaml | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/codemagic.yaml b/codemagic.yaml index c52efe5d..30e1dcb4 100644 --- a/codemagic.yaml +++ b/codemagic.yaml @@ -7,6 +7,9 @@ workflows: - fastlane xcode: latest cocoapods: default + cache: + cache_paths: + - $HOME/Library/Caches/CocoaPods triggering: events: - push @@ -36,12 +39,16 @@ workflows: - fastlane xcode: latest cocoapods: default + cache: + cache_paths: + - $HOME/Library/Caches/CocoaPods triggering: events: - push branch_patterns: - pattern: 'release/*' include: true + source: true cancel_previous_builds: true scripts: - name: Install bundle @@ -65,12 +72,16 @@ workflows: - fastlane xcode: latest cocoapods: default + cache: + cache_paths: + - $HOME/Library/Caches/CocoaPods triggering: events: - push branch_patterns: - pattern: 'main' include: true + source: true cancel_previous_builds: true scripts: - name: Install bundle @@ -96,6 +107,9 @@ workflows: - fastlane xcode: latest cocoapods: default + cache: + cache_paths: + - $HOME/Library/Caches/CocoaPods triggering: events: - push @@ -117,11 +131,3 @@ workflows: artifacts: - ./*.ipa - ./*.dSYM.zip - - - - - - - - From c9a66aed45ce49e072261b80fb9988ee4b4d22ff Mon Sep 17 00:00:00 2001 From: David Bui Date: Mon, 6 Feb 2023 11:06:59 +0700 Subject: [PATCH 11/22] [#315] - Update codemagic.yaml --- .github/wiki/CodeMagic.md | 11 ++++++----- codemagic.yaml | 2 -- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/wiki/CodeMagic.md b/.github/wiki/CodeMagic.md index d7e10710..a3560976 100644 --- a/.github/wiki/CodeMagic.md +++ b/.github/wiki/CodeMagic.md @@ -29,7 +29,7 @@ Out of the box, the CodeMagic Template has the following workflows and steps: - MATCH_PASSWORD -> The password is used to encrypt/decrypt the repository to store your distribution certificates and provisioning profiles. +> The password is used to encrypt/decrypt the Match repository to store the distribution certificates and provisioning profiles. - MATCH_SSH_KEY @@ -37,7 +37,7 @@ Out of the box, the CodeMagic Template has the following workflows and steps: - KEYCHAIN_PASSWORD -> The password to access the keychain +> The password to access the keychain. - FIREBASE_CLI_TOKEN @@ -62,11 +62,12 @@ Out of the box, the CodeMagic Template has the following workflows and steps: ## Installation 1. Follow the setup instruction in [`README.md`](https://github.com/nimblehq/ios-templates#readme). -2. To connect your repository to CodeMagic, please follow the instruction on this page: [Adding the app to CodeMagic](https://docs.codemagic.io/yaml-quick-start/building-a-native-ios-app). -3. Provide all the required variables and secrets. +2. To connect the repository to CodeMagic, please follow the instruction on: [Adding the app to CodeMagic](https://docs.codemagic.io/yaml-quick-start/building-a-native-ios-app). -> The final project directory structure +3. Provide all the required variables and secrets. + + The final project directory structure should be like this: ``` ROOT diff --git a/codemagic.yaml b/codemagic.yaml index 30e1dcb4..8335ebd7 100644 --- a/codemagic.yaml +++ b/codemagic.yaml @@ -90,8 +90,6 @@ workflows: script: bundle exec pod install - name: Build and Test script: bundle exec fastlane buildAndTest - - name: Match Ad-hoc - script: bundle exec fastlane syncAdHocProductionCodeSigning - name: Match AppStore script: bundle exec fastlane syncAppStoreCodeSigning - name: Build App and Distribute to AppStore From 32956a5f111e1267d4e52c6c6fc9a9f63695b6fa Mon Sep 17 00:00:00 2001 From: David Bui Date: Tue, 7 Feb 2023 09:25:09 +0700 Subject: [PATCH 12/22] [#315] - Update codemagic.yaml - Update CodeMagic.md --- .github/wiki/CodeMagic.md | 20 ++++++++++---------- codemagic.yaml | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/wiki/CodeMagic.md b/.github/wiki/CodeMagic.md index a3560976..a6da2bd9 100644 --- a/.github/wiki/CodeMagic.md +++ b/.github/wiki/CodeMagic.md @@ -6,13 +6,13 @@ Use the CodeMagic template to start a new project with CodeMagic as the CI/CD to Out of the box, the CodeMagic Template has the following workflows and steps: -| test | deploy_app_store | deploy_staging | deploy_release_firebase | -| ------------------------- | ------------------------------------------------------- | --------------------------------------- | ----------------------------------------- | -| Install bundle | Install bundle | Install bundle | Install bundle | -| Run CocoaPods install | Run CocoaPods install | Run CocoaPods install | Run CocoaPods install | -| Fastlane - Build and Test | Fastlane - Build and Test | Fastlane - Build and Test | Fastlane - Build and Test | -| Fastlane - Clean Up Xcov | Fastlane Match | Fastlane Match | Fastlane Match | -| Danger | Fastlane - Build and Upload Production App to App Store | Fastlane - Build and Upload Staging App | Fastlane: Build and Upload Production App | +| test | deploy_app_store | deploy_staging_firebase | deploy_release_firebase | +| ------------------------- | ------------------------------------------------------- | --------------------------------------------------- | ----------------------------------------------------- | +| Install bundle | Install bundle | Install bundle | Install bundle | +| Run CocoaPods install | Run CocoaPods install | Run CocoaPods install | Run CocoaPods install | +| Fastlane - Build and Test | Fastlane - Build and Test | Fastlane - Build and Test | Fastlane - Build and Test | +| Fastlane - Clean Up Xcov | Fastlane Match | Fastlane Match | Fastlane Match | +| Danger | Fastlane - Build and Upload Production App to App Store | Fastlane - Build and Upload Staging App to Firebase | Fastlane: Build and Upload Production App to Firebase | ## Trigger Map @@ -41,11 +41,11 @@ Out of the box, the CodeMagic Template has the following workflows and steps: - FIREBASE_CLI_TOKEN -> Firebase token https://firebase.google.com/docs/cli#cli-ci-systems for uploading build to Firebase Distributions and Analytics. +> [Firebase token](https://firebase.google.com/docs/cli#cli-ci-systems) for uploading build to Firebase Distributions and Analytics. - APPSTORE_CONNECT_API_KEY -> App Store Connect API https://docs.fastlane.tools/actions/app_store_connect_api_key/ for uploading build to TestFlight or App Store. It should be `base64` encoded. +> [App Store Connect API](https://docs.fastlane.tools/actions/app_store_connect_api_key/) for uploading build to TestFlight or App Store. It should be `base64` encoded. - API_KEY_ID @@ -63,7 +63,7 @@ Out of the box, the CodeMagic Template has the following workflows and steps: 1. Follow the setup instruction in [`README.md`](https://github.com/nimblehq/ios-templates#readme). -2. To connect the repository to CodeMagic, please follow the instruction on: [Adding the app to CodeMagic](https://docs.codemagic.io/yaml-quick-start/building-a-native-ios-app). +2. To connect the repository to CodeMagic, please follow the instruction on [Adding the app to CodeMagic](https://docs.codemagic.io/yaml-quick-start/building-a-native-ios-app). 3. Provide all the required variables and secrets. diff --git a/codemagic.yaml b/codemagic.yaml index 8335ebd7..2ae9f323 100644 --- a/codemagic.yaml +++ b/codemagic.yaml @@ -1,5 +1,5 @@ workflows: - deploy_staging: + deploy_staging_firebase: name: Deploy Firebase Staging instance_type: mac_mini_m1 environment: From df17dfcba4e7f82fa73f8e70e66c7788b469535e Mon Sep 17 00:00:00 2001 From: David Bui Date: Tue, 7 Feb 2023 10:53:36 +0700 Subject: [PATCH 13/22] [#315] - Update codemagic.yaml - Update CodeMagic.md --- .github/wiki/CodeMagic.md | 57 +++++++++++++-------------------------- codemagic.yaml | 27 ++++++++----------- 2 files changed, 30 insertions(+), 54 deletions(-) diff --git a/.github/wiki/CodeMagic.md b/.github/wiki/CodeMagic.md index a6da2bd9..f12bc0c6 100644 --- a/.github/wiki/CodeMagic.md +++ b/.github/wiki/CodeMagic.md @@ -6,13 +6,14 @@ Use the CodeMagic template to start a new project with CodeMagic as the CI/CD to Out of the box, the CodeMagic Template has the following workflows and steps: -| test | deploy_app_store | deploy_staging_firebase | deploy_release_firebase | -| ------------------------- | ------------------------------------------------------- | --------------------------------------------------- | ----------------------------------------------------- | -| Install bundle | Install bundle | Install bundle | Install bundle | -| Run CocoaPods install | Run CocoaPods install | Run CocoaPods install | Run CocoaPods install | -| Fastlane - Build and Test | Fastlane - Build and Test | Fastlane - Build and Test | Fastlane - Build and Test | -| Fastlane - Clean Up Xcov | Fastlane Match | Fastlane Match | Fastlane Match | -| Danger | Fastlane - Build and Upload Production App to App Store | Fastlane - Build and Upload Staging App to Firebase | Fastlane: Build and Upload Production App to Firebase | +| test | deploy_app_store | deploy_staging_firebase | deploy_release_firebase | +| --------------------------- | ------------------------------------------------------- | --------------------------------------------------- | ----------------------------------------------------- | +| Install bundle | Install bundle | Install bundle | Install bundle | +| Run CocoaPods install | Run CocoaPods install | Run CocoaPods install | Run CocoaPods install | +| Fastlane - Build and Test | Fastlane - Build and Test | Fastlane - Build and Test | Fastlane - Build and Test | +| Fastlane - Clean Up Xcov | Fastlane Match | Fastlane Match | Fastlane Match | +| Fastlane - Build and deploy | Fastlane - Build and Upload Production App to App Store | Fastlane - Build and Upload Staging App to Firebase | Fastlane: Build and Upload Production App to Firebase | +| Danger | N/A | N/A | N/A | ## Trigger Map @@ -27,37 +28,17 @@ Out of the box, the CodeMagic Template has the following workflows and steps: ### Variables -- MATCH_PASSWORD - -> The password is used to encrypt/decrypt the Match repository to store the distribution certificates and provisioning profiles. - -- MATCH_SSH_KEY - -> An SSH private key is used for cloning the Match repository that contains your distribution certificates and provisioning. - -- KEYCHAIN_PASSWORD - -> The password to access the keychain. - -- FIREBASE_CLI_TOKEN - -> [Firebase token](https://firebase.google.com/docs/cli#cli-ci-systems) for uploading build to Firebase Distributions and Analytics. - -- APPSTORE_CONNECT_API_KEY - -> [App Store Connect API](https://docs.fastlane.tools/actions/app_store_connect_api_key/) for uploading build to TestFlight or App Store. It should be `base64` encoded. - -- API_KEY_ID - -> The key identifier of your App Store Connect API key. - -- ISSUER_ID - -> The issuer of your App Store Connect API key. - -- BUMP_APP_STORE_BUILD_NUMBER - -> The flag to determine if the Fastlane should bump the app store build number +| Key | Description | +| --------------------------- | ------------------------------------------------------------ | +| MATCH_PASSWORD | The password is used to encrypt/decrypt the Match repository to store the distribution certificates and provisioning profiles. | +| MATCH_SSH_KEY | The SSH private key is used for cloning the Match repository that contains your distribution certificates and provisioning. | +| KEYCHAIN_PASSWORD | The password to access the keychain. | +| FIREBASE_CLI_TOKEN | [Firebase token](https://firebase.google.com/docs/cli#cli-ci-systems) for uploading build to Firebase Distributions and Analytics. | +| APPSTORE_CONNECT_API_KEY | [App Store Connect API](https://docs.fastlane.tools/actions/app_store_connect_api_key/) for uploading build to TestFlight or App Store. It should be `base64` encoded. | +| API_KEY_ID | The key identifier of your App Store Connect API key. | +| ISSUER_ID | The issuer of your App Store Connect API key. | +| BUMP_APP_STORE_BUILD_NUMBER | The boolean flag to determine if the Fastlane should bump the app store build number. | +| GITHUB_TOKEN | The token of GitHub to run Danger. | ## Installation diff --git a/codemagic.yaml b/codemagic.yaml index 2ae9f323..dbad285f 100644 --- a/codemagic.yaml +++ b/codemagic.yaml @@ -1,6 +1,6 @@ workflows: deploy_staging_firebase: - name: Deploy Firebase Staging + name: Deploy Staging Build To Firebase instance_type: mac_mini_m1 environment: groups: @@ -16,7 +16,7 @@ workflows: branch_patterns: - pattern: 'develop' include: true - cancel_previous_builds: true + source: true scripts: - name: Install bundle script: bundle install --path vendor/bundle @@ -31,8 +31,8 @@ workflows: artifacts: - ./*.ipa - ./*.dSYM.zip - deploy_release_firebase: - name: Deploy Firebase Production + deploy_production_firebase: + name: Deploy Production Build To Firebase instance_type: mac_mini_m1 environment: groups: @@ -49,7 +49,6 @@ workflows: - pattern: 'release/*' include: true source: true - cancel_previous_builds: true scripts: - name: Install bundle script: bundle install --path vendor/bundle @@ -62,10 +61,10 @@ workflows: - name: Build App and Distribute to Firebase script: bundle exec fastlane buildProductionAndUploadToFirebase artifacts: - - ./*.ipa - - ./*.dSYM.zip + - ./Output/*.ipa + - ./Output/*.dSYM.zip deploy_app_store: - name: Deploy App Store + name: Deploy Build To App Store instance_type: mac_mini_m1 environment: groups: @@ -82,7 +81,6 @@ workflows: - pattern: 'main' include: true source: true - cancel_previous_builds: true scripts: - name: Install bundle script: bundle install --path vendor/bundle @@ -95,14 +93,14 @@ workflows: - name: Build App and Distribute to AppStore script: bundle exec fastlane buildAndUploadToAppStore artifacts: - - ./*.ipa - - ./*.dSYM.zip + - ./Output/*.ipa test: name: Test instance_type: mac_mini_m1 environment: groups: - fastlane + - danger xcode: latest cocoapods: default cache: @@ -110,13 +108,11 @@ workflows: - $HOME/Library/Caches/CocoaPods triggering: events: - - push - pull_request branch_patterns: - pattern: '*' include: true source: true - cancel_previous_builds: true scripts: - name: Install bundle script: bundle install --path vendor/bundle @@ -126,6 +122,5 @@ workflows: script: bundle exec fastlane buildAndTest - name: Clean Up script: bundle exec fastlane cleanUpOutput - artifacts: - - ./*.ipa - - ./*.dSYM.zip + - name: Danger + script: bundle exec danger From 4ba988b90fd0800c3343dc9ca9e22cc1d2a8a80a Mon Sep 17 00:00:00 2001 From: David Bui Date: Tue, 7 Feb 2023 10:56:58 +0700 Subject: [PATCH 14/22] [#315] - Update codemagic.yaml --- codemagic.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/codemagic.yaml b/codemagic.yaml index dbad285f..64dee01e 100644 --- a/codemagic.yaml +++ b/codemagic.yaml @@ -100,7 +100,6 @@ workflows: environment: groups: - fastlane - - danger xcode: latest cocoapods: default cache: From 674b489cc4b547795a3fc82e858145396523c5b1 Mon Sep 17 00:00:00 2001 From: David Bui Date: Wed, 8 Feb 2023 09:17:08 +0700 Subject: [PATCH 15/22] [#432] - Update deliverable_setup.sh files: Change from opening DeliverableConstants.rb file to Constant.swift file --- deliverable_setup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deliverable_setup.sh b/deliverable_setup.sh index 8e6411d1..a5ca8241 100644 --- a/deliverable_setup.sh +++ b/deliverable_setup.sh @@ -12,9 +12,9 @@ else fi echo "✅ Completed" -read -n1 -p "Do you want to set up Deliverable Constants values? (Can be edited later) [Y/n]:" confirm +read -n1 -p "Do you want to set up Constants values? (Can be edited later) [Y/n]:" confirm if ! echo $confirm | grep '^[Yy]\?$'; then echo "✅ Completed" else - open -a Xcode fastlane/Constants/DeliverableConstants.rb + open -a Xcode fastlane/Constants/Constant.swift fi From a8b026ee777674b02fa18d13d94d70fe5c0d01af Mon Sep 17 00:00:00 2001 From: David Bui Date: Wed, 8 Feb 2023 09:32:25 +0700 Subject: [PATCH 16/22] [#438] - Update make.sh: add command to remove Workspace.swift --- make.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/make.sh b/make.sh index 1075aa29..8b4686ef 100644 --- a/make.sh +++ b/make.sh @@ -181,6 +181,7 @@ echo "Remove tuist files" rm -rf .tuist-version rm -rf tuist rm -rf Project.swift +rm -rf Workspace.swift # Remove script files and git/index echo "Remove script files and git/index" From e8d42ea1a71759d401854e109b4cf7e565e54e4e Mon Sep 17 00:00:00 2001 From: David Bui Date: Thu, 9 Feb 2023 10:32:43 +0700 Subject: [PATCH 17/22] [#433] - Update SwiftFormat to exclude folder fastlane/swift when lint - Update code format for some files in fastlane folder --- .swiftformat | 2 +- fastlane/Appfile.swift | 2 -- fastlane/Constants/Constant.swift | 4 ++-- fastlane/Fastfile.swift | 6 ++++-- fastlane/Helpers/Build.swift | 2 +- fastlane/Helpers/Version.swift | 8 ++++---- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.swiftformat b/.swiftformat index 6bc4d651..472eefd4 100644 --- a/.swiftformat +++ b/.swiftformat @@ -1,5 +1,5 @@ # file options ---exclude Pods, Generated, **/*.generated.swift +--exclude Pods, Generated, **/*.generated.swift, fastlane/swift # rules --disable fileHeader diff --git a/fastlane/Appfile.swift b/fastlane/Appfile.swift index a576f5c3..73a9cbac 100644 --- a/fastlane/Appfile.swift +++ b/fastlane/Appfile.swift @@ -1,7 +1,5 @@ var appIdentifier: String { return "[[APP_IDENTIFIER]]" } // The bundle identifier of your app var appleID: String { return "[[APPLE_ID]]" } // Your Apple Developer Portal username - - // For more information about the Appfile, see: // https://docs.fastlane.tools/advanced/#appfile diff --git a/fastlane/Constants/Constant.swift b/fastlane/Constants/Constant.swift index 006207f3..bc0dfd42 100644 --- a/fastlane/Constants/Constant.swift +++ b/fastlane/Constants/Constant.swift @@ -57,7 +57,7 @@ enum Constant { static let uploadSymbolsBinaryPath: String = "./Pods/FirebaseCrashlytics/upload-symbols" static let dSYMSuffix: String = ".dSYM.zip" - + // MARK: - Build and Version static let manualVersion: String = "" @@ -65,7 +65,7 @@ enum Constant { // MARK: - Device static let devices = ["iPhone 12 Pro Max"] - + // MARK: - Test static let testTarget: String = "\(projectName)Tests" diff --git a/fastlane/Fastfile.swift b/fastlane/Fastfile.swift index 86b58fcd..027204a0 100644 --- a/fastlane/Fastfile.swift +++ b/fastlane/Fastfile.swift @@ -150,10 +150,12 @@ class Fastfile: LaneFile { useAutomaticSigning: .userDefined(false), teamId: .userDefined(EnvironmentParser.string(key: "sigh_\(Constant.productionBundleId)_appstore_team-id")), codeSignIdentity: .userDefined("iPhone Distribution"), - profileName: .userDefined(EnvironmentParser.string(key: "sigh_\(Constant.productionBundleId)_appstore_profile-name")) + profileName: .userDefined(EnvironmentParser.string( + key: "sigh_\(Constant.productionBundleId)_appstore_profile-name" + )) ) } - + func setUpTestProjectLane() { desc("Disable Exempt Encryption") Test.disableExemptEncryption() diff --git a/fastlane/Helpers/Build.swift b/fastlane/Helpers/Build.swift index e187f5b9..242c6a97 100644 --- a/fastlane/Helpers/Build.swift +++ b/fastlane/Helpers/Build.swift @@ -39,7 +39,7 @@ enum Build { // MARK: Private - static private func build( + private static func build( environment: Constant.Environment, type: Constant.BuildType ) { diff --git a/fastlane/Helpers/Version.swift b/fastlane/Helpers/Version.swift index b52def0f..f71b0f6d 100644 --- a/fastlane/Helpers/Version.swift +++ b/fastlane/Helpers/Version.swift @@ -7,9 +7,9 @@ // enum Version { - + // MARK: - Getting - + static var versionNumber: String { get { FastlaneRunner.getVersionNumber( @@ -17,7 +17,7 @@ enum Version { target: .userDefined(Constant.projectName) ) } - + set { incrementVersionNumber( versionNumber: .userDefined(newValue), @@ -25,7 +25,7 @@ enum Version { ) } } - + static var buildNumber: String { get { FastlaneRunner.getBuildNumber(xcodeproj: .userDefined(Constant.projectPath)) From ec30e5588eab877be81c3baf7c01888aac17a901 Mon Sep 17 00:00:00 2001 From: David Bui Date: Thu, 9 Feb 2023 10:39:48 +0700 Subject: [PATCH 18/22] [#433] - Update code format --- Workspace.swift | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Workspace.swift b/Workspace.swift index 1ac6aca0..2ae058da 100644 --- a/Workspace.swift +++ b/Workspace.swift @@ -9,8 +9,7 @@ extension Workspace { name: name, projects: ["./**"], generationOptions: .options( - autogeneratedWorkspaceSchemes: - .disabled + autogeneratedWorkspaceSchemes: .disabled ) ) } From 5e0fea3adc8df6262453d885d535f3f1df1328c5 Mon Sep 17 00:00:00 2001 From: David Bui Date: Thu, 9 Feb 2023 13:48:39 +0700 Subject: [PATCH 19/22] [#315] - Update codemagic.yaml --- codemagic.yaml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/codemagic.yaml b/codemagic.yaml index 64dee01e..7d430f64 100644 --- a/codemagic.yaml +++ b/codemagic.yaml @@ -28,9 +28,6 @@ workflows: script: bundle exec fastlane syncAdHocStagingCodeSigning - name: Build App and Distribute to Firebase script: bundle exec fastlane buildStagingAndUploadToFirebase - artifacts: - - ./*.ipa - - ./*.dSYM.zip deploy_production_firebase: name: Deploy Production Build To Firebase instance_type: mac_mini_m1 @@ -60,9 +57,6 @@ workflows: script: bundle exec fastlane syncAdHocProductionCodeSigning - name: Build App and Distribute to Firebase script: bundle exec fastlane buildProductionAndUploadToFirebase - artifacts: - - ./Output/*.ipa - - ./Output/*.dSYM.zip deploy_app_store: name: Deploy Build To App Store instance_type: mac_mini_m1 @@ -92,8 +86,6 @@ workflows: script: bundle exec fastlane syncAppStoreCodeSigning - name: Build App and Distribute to AppStore script: bundle exec fastlane buildAndUploadToAppStore - artifacts: - - ./Output/*.ipa test: name: Test instance_type: mac_mini_m1 From 912a95883fbd168c420b03add7a6159312a2e16c Mon Sep 17 00:00:00 2001 From: David Bui Date: Fri, 10 Feb 2023 13:20:53 +0700 Subject: [PATCH 20/22] [#315] - Update codemagic.yaml - Update Danger file fix Staging scheme name --- Dangerfile | 2 +- codemagic.yaml | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Dangerfile b/Dangerfile index 5ccf3dff..84cb7b02 100644 --- a/Dangerfile +++ b/Dangerfile @@ -24,7 +24,7 @@ swiftlint.lint_files( ) xcresultPath = "./fastlane/test_output/{PROJECT_NAME} Staging.xcresult" -scheme = "'{PROJECT_NAME} Staging'" +scheme = "{PROJECT_NAME} Staging" workspace = "./{PROJECT_NAME}.xcworkspace" xcovOutputDirectory = "./fastlane/xcov_output" diff --git a/codemagic.yaml b/codemagic.yaml index 7d430f64..58272b88 100644 --- a/codemagic.yaml +++ b/codemagic.yaml @@ -28,6 +28,9 @@ workflows: script: bundle exec fastlane syncAdHocStagingCodeSigning - name: Build App and Distribute to Firebase script: bundle exec fastlane buildStagingAndUploadToFirebase + artifacts: + - ./Output/*.ipa + - ./Output/*.dSYM.zip deploy_production_firebase: name: Deploy Production Build To Firebase instance_type: mac_mini_m1 @@ -57,6 +60,9 @@ workflows: script: bundle exec fastlane syncAdHocProductionCodeSigning - name: Build App and Distribute to Firebase script: bundle exec fastlane buildProductionAndUploadToFirebase + artifacts: + - ./Output/*.ipa + - ./Output/*.dSYM.zip deploy_app_store: name: Deploy Build To App Store instance_type: mac_mini_m1 @@ -86,6 +92,9 @@ workflows: script: bundle exec fastlane syncAppStoreCodeSigning - name: Build App and Distribute to AppStore script: bundle exec fastlane buildAndUploadToAppStore + artifacts: + - ./Output/*.ipa + - ./Output/*.dSYM.zip test: name: Test instance_type: mac_mini_m1 From b25eee147d72f9b3a8ff17ea6aa94ac5691bc0b2 Mon Sep 17 00:00:00 2001 From: David Bui Date: Fri, 24 Feb 2023 09:29:46 +0700 Subject: [PATCH 21/22] [#446] - Update PULL_REQUEST_TEMPLATE with latest version of Nimble --- .github/PULL_REQUEST_TEMPLATE.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 981aa2e9..00c49517 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,13 +1,13 @@ -https://github.com/nimblehq/ios-templates/issues/ +- Close # -## What happened +## What happened 👀 -Describe the big picture of your changes here to communicate to the team why we should accept this pull request. - -## Insight +Provide a description of the **changes** this pull request brings to the codebase. Additionally, when the pull request is still being worked on, a checklist of the planned changes is welcome to track progress. -Describe in details how to test the changes; referenced documentation is welcome as well. - -## Proof Of Work +## Insight 📝 -Show us the implementation: screenshots, gif, etc. +Describe in detail why this solution is the most appropriate, which solution you tried but did not go with, and how to test the changes. References to relevant documentation are welcome as well. + +## Proof Of Work 📹 + +Show us the implementation: screenshots, GIFs, etc. From 70e15d461e88f93b4e5d716552e478e77d21552a Mon Sep 17 00:00:00 2001 From: David Bui Date: Fri, 24 Feb 2023 14:36:56 +0700 Subject: [PATCH 22/22] [#446] - Add issue example --- .github/PULL_REQUEST_TEMPLATE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 00c49517..a5568f2a 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,4 +1,4 @@ -- Close # +- Close #https://github.com/nimblehq/ios-templates/issues/ ## What happened 👀