You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Whenever we start a new project, after setting up the boilerplate, best practices suggest that we setup the continuous deployment so that the rest of the team could easily trigger and receive test builds of the latest app code.
4
-
This way the testing team can easily receive the test builds without continuously bugging the developers.
3
+
Whenever we start a new project, after setting up the boilerplate, best practices suggest that we set up the continuous deployment so that the team can easily trigger and receive test builds of the latest app code.
5
4
6
-
Few basic requirements for a good devOps setup can be:
5
+
This also makes it easier for the testing team to receive test builds without continuously bugging the developers.
6
+
7
+
A few basic requirements for a good DevOps setup can be:
7
8
8
9
- Lint and tests with coverage should run whenever a pull request is raised.
9
-
- Every time we merge our changes to the master branch we want the CI process to build the code, run lint and tests, and then build and publish apps to be distributed to the internal team testers.
10
-
- Each test build must have the a version and build number and it must be same on both Android and IOS for each version of code.
11
-
- An email should be sent out to all testers when a new build is available.
12
-
- Developers should also have the option to manually build on local machine quickly.
13
-
- Ability to pass environment vairables to the scripts so that we can generate different builds for staging, preprod and production.
10
+
- Every time changes are merged to the master branch, we want the CI process to build the code, run lint and tests, and then build and publish apps to be distributed to the internal testing team.
11
+
- Each test build should have the same version and build number for Android and iOS builds, corresponding to each version of the code.
12
+
- An email should be sent out to all testers whenever a new build is available.
13
+
- Developers should also have the option to manually build on their local machines quickly.
14
+
- Ability to pass environment variables to the scripts so that we can generate different builds for different development environments like staging, preprod, and production.
14
15
15
16
The following chapters would show step by step on how to achieve these.
Copy file name to clipboardExpand all lines: 11-devops/11.1-android-build-setup.md
+27-28Lines changed: 27 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,48 +1,47 @@
1
-
# Android build scripts / setup
1
+
# Android build scripts/setup
2
2
3
-
In android builds are done via gradle.
4
-
These are the few pre-requisites to build a release apk.
5
-
-**BUILD_NAME** - The name that will be used by testers to identify the build, for example: '1.1.1', '1.0-alpha, etc.
6
-
-**BUILD_NUMBER** - A unique integer number identifying the build. This is used by android to identify which build is the updated build. This should be a integer number. for example : 1, 111, 111, etc.
7
-
-**ANDROID_APP_ID** - This is the unique app identifier which is used to identify the app uniquely in the play store or can be used to identify if the build is dev, pre prod or prod. These may look like these : com.app.notetaker-dev, com.app.notetaker-alpha.
3
+
In Android, builds are done via Gradle.
4
+
5
+
These are a few pre-requisites to build a release apk.
6
+
-**BUILD_NAME** - The name that will be used by testers to identify the build, for example: '1.1.1', '1.0-alpha', etc.
7
+
-**BUILD_NUMBER** - A unique integer number identifying the build. This is used by Android to identify which build is the updated build. This should be an integer number, for example, 1, 111, 111, etc.
8
+
-**ANDROID_APP_ID** - This is the unique app identifier which is used to identify the app uniquely in the Google Play Store or can be used to identify if the build is dev, preprod or prod. These app ids may look like this: com.app.notetaker-dev, com.app.notetaker-alpha.
8
9
-**ANDROID_KEYSTORE_FILE** - This is the keystore file used to sign the app.
9
10
-**ANDROID_KEYSTORE_PASSWORD** - This is the keystore password used while creating the keystore.
10
-
-**ANDROID_KEY_ALIAS** - This is key alias used to create the keystore.
11
-
-**ANDROID_KEY_PASSWORD** - This is the key password set for the key.
11
+
-**ANDROID_KEY_ALIAS** - This is the alias used to create the keystore.
12
+
-**ANDROID_KEY_PASSWORD** - This is the password set for the key.
12
13
13
14
### Release variants
14
15
15
-
Ideally every app has three release variants just like a typical backend application:
16
-
- Dev build - The app which connects to the staging/dev backend Environment. This can also have additional libraries like test fairy.
17
-
-Pre Prod build - The app which points to pre prod backend environment.This is usually very similar, if not identical to production app.
18
-
- Prod build - The final apk which should be released to the play store.
16
+
Ideally, every app has three release variants just like a typical backend application:
17
+
- Dev build - The app which connects to the staging/dev backend environment. This can also include additional libraries like TestFairy.
18
+
-Preprod build - The app which points to the preprod backend environment.This is usually very similar, if not identical to the production app.
19
+
- Prod build - The final apk which should be released to the Play Store.
19
20
20
21
Hence, we would need three different key stores for three different variants.
You would be prompted to enter ANDROID_KEYSTORE_PASSWORD, ANDROID_KEY_ALIAS, ANDROID_KEY_PASSWORD and few other details.
31
+
You would be prompted to enter ANDROID_KEYSTORE_PASSWORD, ANDROID_KEY_ALIAS, ANDROID_KEY_PASSWORD and a few other details.
32
+
31
33
Note these down somewhere and keep the keystore file safe.
32
34
33
-
The android documentation has the following warning:
35
+
The Android documentation has the following warning:
34
36
```
35
37
Note about saving the keystore:
36
38
37
-
Once you publish the app on the Play Store, you will need to republish your app
38
-
under a different package name (losing all downloads and ratings) if you
39
-
want to change the signing key at any point.
40
-
So backup your keystore and don't forget the passwords.
39
+
Once you publish the app on the Play Store, you will need to republish your app under a different package name (losing all downloads and ratings) if you want to change the signing key at any point. So backup your keystore and don't forget the passwords.
41
40
```
42
41
43
42
For the build to work the keystore file should be placed at `android/app/dev_release.keystore`.
44
43
45
-
*Make sure the keystore file is git ignored so that you dont checking the file into git*
44
+
*Make sure the keystore file is git ignored so that you don't check the file into git*
46
45
47
46
Now, create the following script.
48
47
>scripts/android/builder.sh
@@ -60,7 +59,7 @@ cd $cur_dir/../../android &&
60
59
echo"APK will be present at android/app/build/outputs/apk/app-release.apk"
61
60
```
62
61
63
-
Apart from this script we would need to modify:
62
+
Apart from this script, we would also need to modify:
64
63
65
64
>android/app/build.gradle
66
65
@@ -112,11 +111,11 @@ android {
112
111
113
112
```
114
113
115
-
The above script tells gradle to do
114
+
The above script tells Gradle to
116
115
1. clean
117
116
2. build a release apk
118
117
119
-
Also all the important parameters are passed via environment variables.
118
+
Also, all the important parameters are passed via environment variables.
120
119
This ensures that we can:
121
120
1. Build the apk manually by running
122
121
@@ -126,15 +125,15 @@ This ensures that we can:
126
125
127
126
2. Setup the environment variables in CI platform so that the CI can build the apk without manual intervention. Keep in mind that typically every CI provides a unique build number that you can pass to the script for BUILD_NUMBER.
128
127
129
-
Woot! Its that simple to build a release apk for android.
128
+
Woot! Its that simple to build a release apk for Android.
130
129
131
130
The built apk can be found at: `android/app/build/outputs/apk/app-release.apk`
132
131
133
132
### Windows users
134
133
135
-
If you are running Windows 10 64bit or higher you can enable Ubuntu bash shell on your systems and gain access to full bash command line and run the script there.
136
-
More on that here: https://www.howtogeek.com/249966/how-to-install-and-use-the-linux-bash-shell-on-windows-10/
134
+
If you are running Windows 10 64bit or higher you can enable Ubuntu bash shell on your systems and gain access to the full bash command line and run the script there.
135
+
More on that here: https://www.howtogeek.com/249966/how-to-install-and-use-the-linux-bash-shell-on-windows-10/
137
136
138
-
Or you could install Cygwin on your system and run the scripts mentioned.
137
+
Alternatively, you could install Cygwin on your system and run the scripts mentioned.
139
138
140
139
The code till here can be found on the **branch**[chapter/11/11.1](https://github.com/react-made-native-easy/note-taker/tree/chapter/11/11.1)
Copy file name to clipboardExpand all lines: 11-devops/11.2-ios-build-setup.md
+27-27Lines changed: 27 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,44 +1,44 @@
1
-
# iOS build scripts / setup[WIP]
1
+
# iOS build scripts/setup
2
2
3
-
iOS builds via commandline are fairly much more complex as compared to android.
3
+
iOS builds via command line are much more complex as compared to Android.
4
4
5
5
6
-
>**Note: Build works only for Mac users.** Since apple requires that all the build be made on xcode itself, iOS apps can only be built on a mac machine.
6
+
>**Note: Builds work only for Mac users.** Since Apple requires that all the builds be made on Xcode itself, iOS apps can only be built on a Mac machine.
7
7
8
8
9
9
These are the few pre-requisites to build a release ipa file.
10
-
-**BUILD_NAME** - The name that will be used by testers to identify the build, for example: '1.1.1', '1.0-alpha, etc.
11
-
-**BUILD_NUMBER** - A unique integer number identifying the build. This is used by android to identify which build is the updated build. This should be a integer number. for example: 1, 111, 111, etc.
12
-
-**IOS_APP_ID** - This is the unique app identifier which is used to identify the app uniquely in the app store or can be used to identify if the build is dev, pre prod or prod. These may look like these : com.app.notetaker-dev, com.app.notetaker-alpha.
10
+
-**BUILD_NAME** - The name that will be used by testers to identify the build, for example: '1.1.1', '1.0-alpha', etc.
11
+
-**BUILD_NUMBER** - A unique integer number identifying the build. This is used by iOS to identify which build is the updated build. This should be an integer number. For example: 1, 111, 111, etc.
12
+
-**IOS_APP_ID** - This is the unique app identifier which is used to identify the app uniquely in the App Store or it can be used to identify if the build is dev, preprod or prod. App ids may look like this: com.app.notetaker-dev, com.app.notetaker-alpha.
13
13
-**IOS_CERTIFICATE** - This is the certificate file used to sign the app.
14
-
-**IOS_CERTIFICATE_KEY** - This is the certificate password used while creating the certificate.
15
-
-**IOS_PROVISION_PROFILE** - This is provision profile needed to build the app. This file mentions the capabilities / devices that are allowed to run the app.
14
+
-**IOS_CERTIFICATE_KEY** - This is the password used while creating the certificate.
15
+
-**IOS_PROVISION_PROFILE** - This is the provision profile needed to build the app. This file mentions the capabilities/devices that are allowed to run the app.
16
16
-**IOS_EXPORT_OPTIONS_PLIST** - This is the options file needed to specify parameters for the build.
17
-
-**IOS_SCHEME** - The scheme which should be used to build the ipa. Typically we will have different schemes per environment. For example: we can have local, preprod and a production scheme.
18
-
-**IOS_CONFIGURATION** - This is the setting which specified if the build is DEBUG or RELEASE.
19
-
-**PROJECT_NAME** - This is name of the project for example if your project name inside ios folder says SampleProject.xcworkspace or SampleProject.xcodeproj, then PROJECT_NAME=SampleProject .
17
+
-**IOS_SCHEME** - The scheme which should be used to build the IPA. Typically, we will have different schemes per environment. For example, we can have a local, a preprod and a production scheme.
18
+
-**IOS_CONFIGURATION** - This is the setting which specifies if the build is DEBUG or RELEASE.
19
+
-**PROJECT_NAME** - This is the name of the project. For example, if your project name inside ios folder says SampleProject.xcworkspace or SampleProject.xcodeproj, then PROJECT_NAME=SampleProject .
20
20
21
21
### Release variants
22
22
23
-
Ideally every app has three release variants just like a typical backend application:
24
-
- Dev build - The app which connects to the staging/dev backend Environment. This can also have additional libraries like test fairy.
25
-
- PreProd build - The app which points to pre prod backend environment.This is usually very similar, if not identical to production app.
26
-
- Prod build - The final ipa which should be released to the app store.
23
+
Ideally, every app has three release variants just like a typical backend application:
24
+
- Dev build - The app which connects to the staging/dev backend environment. This can also have additional libraries like TestFairy.
25
+
- Pre-Prod build - The app which points to the preprod backend environment.This is usually very similar, if not identical to the production app.
26
+
- Prod build - The final IPA which should be released to the App Store.
27
27
28
28
Hence, we would need three different `schemes` for three different variants.
29
29
30
-
A typical build process in iOS would have following steps:
31
-
1. Getting the certificates and provisioning profiles from apple developer account.
30
+
A typical build process in iOS would have the following steps:
31
+
1. Getting the certificates and provisioning profiles from the Apple developer account.
32
32
2. Adding the certificate to the default keychain and placing the provisioning profile at the location `~/Library/MobileDevice/Provisioning\ Profiles/`
33
-
3. Archiving the project - Think of it as a executable zip of the project that can be run using XCode.
34
-
4. Exporting the IPA - Think of it as exporting the archive to a format recognised by the iPhone.
33
+
3. Archiving the project - Think of it as an executable zip of the project that can be run using Xcode.
34
+
4. Exporting the IPA - Think of it as exporting the archive to a format recognized by an iPhone.
35
35
36
-
### Lets get started
36
+
### Let's get started
37
37
38
38
1. Place the provisioning profile at `scripts/ios/profile/XYZ.mobileprovision`
39
39
2. Place the certificate at `scripts/ios/certs/ABC.p12`
40
40
3. Place an exportOptions file at `scripts/ios/exportOptions/exportOptions-dev.plist`
41
-
Typically an exportOptions file looks like this :
41
+
Typically, an exportOptions file looks like this :
@@ -68,10 +68,10 @@ A typical build process in iOS would have following steps:
68
68
</dict>
69
69
</plist>
70
70
```
71
-
Make sure you put all the **above files** in the git ignore.
71
+
Make sure you put all the **above files** in the gitignore.
72
72
73
73
4. Create the script:
74
-
The below script will create a new keychain `ios-build` and will store the certificate in the keychain. Also, it will make the keychain the default one so that the xcode picks up the certificate from the new keychain. Then it will copy the provisioning profile in the correct directory so that xcode picks it up.
74
+
The below script will create a new keychain `ios-build` and will store the certificate in the keychain. Also, it will make `ios-build`the default keychain so that Xcode picks up the certificate from it. Then it will copy the provisioning profile to the correct directory so that Xcode can pick it up.
75
75
76
76
>scripts/ios/keychain.sh
77
77
@@ -92,7 +92,7 @@ A typical build process in iOS would have following steps:
92
92
# Add it to the list
93
93
security list-keychains -d user -s ios-build.keychain
94
94
95
-
echo"Making the ios-build keychain default ,so xcodebuild will use it for signing"
95
+
echo"Making the ios-build keychain default, so xcodebuild will use it for signing"
96
96
security default-keychain -s ios-build.keychain
97
97
98
98
echo"Unlocking the ios-build keychain"
@@ -109,13 +109,13 @@ A typical build process in iOS would have following steps:
This script will run the xcodebuild to first archive the project. Then it will generate the IPA file that can be used for installing the app onto an iPhone.
118
+
This script will run the xcodebuild to first archive the project. Then it will generate the IPA file which can be used for installing the app onto an iPhone.
119
119
>scripts/ios/builder.sh
120
120
121
121
```sh
@@ -159,7 +159,7 @@ A typical build process in iOS would have following steps:
159
159
`PROJECT_NAME='NoteTaker' IOS_APP_ID='com.notetaker.app.ios' BUILD_NUMBER=11 BUILD_NAME=1.1.1 IOS_SCHEME='local' IOS_CONFIGURATION='RELEASE' IOS_EXPORT_OPTIONS_PLIST='exportOptions-dev.plist' sh ./scripts/ios/builder.sh`
160
160
161
161
162
-
The build should take couple of minutes and you can find the final ipa file at:
162
+
The build should take a couple of minutes and you can find the final ipa file at
163
163
`ios/build/Products/IPA/`
164
164
165
165
The code till here can be found on the **branch**[chapter/11/11.2](https://github.com/react-made-native-easy/note-taker/tree/chapter/11/11.2)
0 commit comments