Skip to content

Commit 4e32947

Browse files
committed
updates files ci/cd
1 parent 51c3fc4 commit 4e32947

File tree

8 files changed

+398
-3
lines changed

8 files changed

+398
-3
lines changed

template/.detoxrc.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"testRunner": "jest",
3+
"runnerConfig": "e2e/config.json",
4+
"apps": {
5+
"ios": {
6+
"type": "ios.app",
7+
"binaryPath": "ios/build/Build/Products/Release-iphonesimulator/template.app",
8+
"build": "xcodebuild -workspace ios/template.xcworkspace -scheme template -configuration ios -sdk iphonesimulator -derivedDataPath ios/build"
9+
},
10+
"android": {
11+
"type": "android.apk",
12+
"binaryPath": "android/app/build/outputs/apk/release/app-release.apk",
13+
"build": "cd android && ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release && cd .."
14+
}
15+
},
16+
"devices": {
17+
"simulator": {
18+
"type": "ios.simulator",
19+
"device": {
20+
"type": "iPhone 12"
21+
}
22+
},
23+
"emulator": {
24+
"type": "android.emulator",
25+
"device": {
26+
"avdName": "Pixel_API_29"
27+
}
28+
}
29+
},
30+
"configurations": {
31+
"ios": {
32+
"device": "simulator",
33+
"app": "ios"
34+
},
35+
"android": {
36+
"device": "emulator",
37+
"app": "android"
38+
}
39+
}
40+
}

template/.eslintrc.js

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,35 @@
11
module.exports = {
22
root: true,
3-
extends: ['@react-native-community', 'plugin:jest/recommended'],
4-
plugins: ['jest', 'detox'],
3+
extends: [
4+
'plugin:jest/recommended',
5+
'plugin:react/recommended', // Uses the recommended rules from @eslint-plugin-react
6+
7+
'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin
8+
9+
'prettier/@typescript-eslint',
10+
],
11+
plugins: ['jest', 'detox', '@typescript-eslint', 'react-native', 'eslint-plugin-react-hooks'],
12+
513
rules: {
6-
curly: 'off',
14+
// Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs
15+
'curly': 'off',
16+
'react/prop-types': 0,
17+
'@typescript-eslint/no-empty-interface': 0,
18+
'@typescript-eslint/explicit-function-return-type': 0,
19+
'react-hooks/rules-of-hooks': 'error',
20+
'react-hooks/exhaustive-deps': 'warn',
21+
'@typescript-eslint/no-explicit-any': 0,
22+
'@typescript-eslint/explicit-function-return-type': 0,
23+
'@typescript-eslint/no-use-before-define': 0,
24+
'@typescript-eslint/prefer-interface': 0,
25+
'@typescript-eslint/no-non-null-assertion': 0,
26+
'@typescript-eslint/no-empty-function': 0,
27+
'@typescript-eslint/ban-ts-ignore': 0,
28+
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
29+
},
30+
settings: {
31+
react: {
32+
version: 'detect', // Tells eslint-plugin-react to automatically detect the version of React to use
33+
},
734
},
835
};

template/Gemfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Autogenerated by fastlane
2+
#
3+
# Ensure this file is checked in to source control!
4+
5+
source "https://rubygems.org"
6+
7+
gem 'fastlane'
8+
9+
plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
10+
eval_gemfile(plugins_path) if File.exist?(plugins_path)

template/detox.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ fi
1616
echo "Executing Detox tests... with $WORKERS workers"
1717
npx detox test --configuration $1 --workers $WORKERS;
1818
exit
19+

template/fastlane/Fastfile

Lines changed: 215 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
# For basics, see
2+
# https://github.com/osamaq/reactnative-fastlane-appcenter
3+
4+
# -------------Android Build & Deploy-------------#
5+
platform :android do
6+
# For android, you should setup signing for release builds.
7+
# Currently, the default debug keystore is used.
8+
desc 'Build the staging release APK.'
9+
private_lane :build_staging do
10+
gradle(task: 'clean', project_dir: 'android/')
11+
sh("npm", "run", "make-apk:stagingRelease")
12+
end
13+
14+
desc 'Build the production release APK.'
15+
private_lane :build_production do
16+
gradle(task: 'clean', project_dir: 'android/')
17+
sh("npm", "run", "make-apk:productionRelease")
18+
end
19+
20+
desc 'Upload the release APK to App Center.'
21+
private_lane :upload do |options|
22+
release_notes = options[:notes]
23+
appcenter_upload(
24+
api_token: ENV["APPCENTER_API_TOKEN"],
25+
owner_name: ENV["APPCENTER_OWNER_NAME"],
26+
app_name: ENV["APPCENTER_APP_NAME"],
27+
apk: "./android/app/build/outputs/apk/release/app-release.apk",
28+
notify_testers: ENV["NOTIFY_TESTERS"],
29+
destinations: ENV["DESTINATIONS"],
30+
release_notes: release_notes
31+
)
32+
end
33+
34+
desc 'Build, deploy staging Android.'
35+
lane :deploy_staging do
36+
build_staging
37+
upload
38+
end
39+
40+
desc 'Build, deploy production Android.'
41+
lane :deploy_production do
42+
build_production
43+
upload
44+
end
45+
46+
desc 'Bump, badge, deploy staging Android.'
47+
lane :bump_badge_deploy_staging do
48+
bump_badge
49+
deploy_staging
50+
end
51+
52+
desc 'Bump, badge, deploy production Android.'
53+
lane :bump_badge_deploy_prod do
54+
bump_badge
55+
deploy_production
56+
end
57+
end
58+
59+
# -------------iOS Sign, Build & Deploy-------------#
60+
platform :ios do
61+
# You need to configure singing for iOS
62+
# https://github.com/osamaq/reactnative-fastlane-appcenter#signing
63+
desc 'Set up certs and profiles for iOS.'
64+
lane :certificates do
65+
register_devices(
66+
devices: {
67+
}
68+
)
69+
match(
70+
app_identifier: 'com.app.bundle',
71+
readonly: true,
72+
force_for_new_devices: true,
73+
)
74+
end
75+
76+
desc 'Build the staging release iOS application.'
77+
private_lane :build_staging do
78+
package = load_json(json_path: "./package.json")
79+
gym(
80+
scheme: "STAGING",
81+
workspace: './ios/' + package['name'] + '.xcworkspace',
82+
export_method: 'ad-hoc'
83+
)
84+
end
85+
86+
desc 'Build the production release iOS application.'
87+
private_lane :build_production do
88+
package = load_json(json_path: "./package.json")
89+
gym(
90+
scheme: "PRODUCTION",
91+
workspace: './ios/' + package['name'] + '.xcworkspace',
92+
export_method: 'ad-hoc'
93+
)
94+
end
95+
96+
97+
desc 'Upload the release IPA to App Center.'
98+
private_lane :upload do |options|
99+
release_notes = options[:notes]
100+
appcenter_upload(
101+
api_token: ENV["APPCENTER_API_TOKEN"],
102+
owner_name: ENV["APPCENTER_OWNER_NAME"],
103+
app_name: ENV["APPCENTER_APP_NAME"],
104+
ipa: "./" + "Hello App Display Name" + ".ipa",
105+
notify_testers: ENV["NOTIFY_TESTERS"],
106+
destinations: ENV["DESTINATIONS"],
107+
release_notes: release_notes
108+
)
109+
end
110+
111+
desc 'Sign, build, deploy staging iOS.'
112+
lane :deploy_staging do
113+
certificates
114+
build_staging
115+
upload
116+
end
117+
118+
desc 'Sign, build, deploy production iOS.'
119+
lane :deploy_production do
120+
certificates
121+
build_production
122+
upload
123+
end
124+
125+
desc 'Bump, badge, sign, build, deploy staging iOS.'
126+
lane :bump_badge_deploy_staging do
127+
bump_badge
128+
deploy_staging
129+
end
130+
131+
desc 'Bump, badge, sign, build, deploy production iOS.'
132+
lane :bump_badge_deploy_prod do
133+
bump_badge
134+
deploy_production
135+
end
136+
end
137+
138+
139+
# -------------Icons & Versioning-------------#
140+
desc 'Android: Increment versionCode and set versionName to package.json version.'
141+
package = load_json(json_path: "./package.json")
142+
private_lane :inc_ver_and do
143+
increment_version_code(
144+
gradle_file_path: "./android/app/build.gradle",
145+
)
146+
147+
increment_version_name(
148+
gradle_file_path: "./android/app/build.gradle",
149+
version_name: package['version']
150+
)
151+
end
152+
153+
154+
desc 'iOS: Increment build number and set the version to package.json version.'
155+
private_lane :inc_ver_ios do
156+
increment_build_number(
157+
xcodeproj: './ios/' + package['name'] + '.xcodeproj'
158+
)
159+
increment_version_number(
160+
xcodeproj: './ios/' + package['name'] + '.xcodeproj',
161+
version_number: package['version']
162+
)
163+
end
164+
165+
166+
desc 'Bump build numbers, and set the display version to match the pacakage.json version.'
167+
private_lane :bump do
168+
inc_ver_ios
169+
inc_ver_and
170+
end
171+
172+
173+
# To prepare the original icon set, see:
174+
# https://developer.android.com/studio/write/image-asset-studio
175+
desc 'Android: Overwrite the current icon set with a badged version.'
176+
private_lane :make_badge_and do
177+
package = load_json(json_path: "./package.json")
178+
add_badge(
179+
shield: "DEV-" + package['version'] + "-orange",
180+
no_badge: true,
181+
dark: true,
182+
shield_scale: "0.55",
183+
shield_gravity: "Center",
184+
shield_geometry: "+0+30%",
185+
glob: "/android/app/src/main/res/mipmap-*/ic_launcher*.png",
186+
)
187+
end
188+
189+
# To prepare the original icon set, you can use:
190+
# https://appicon.co/
191+
desc 'iOS: Overwrite the current icon set with a badged version.'
192+
private_lane :make_badge_ios do
193+
package = load_json(json_path: "./package.json")
194+
add_badge(
195+
shield: "DEV-" + package['version'] + "-orange",
196+
no_badge: true,
197+
dark: true,
198+
shield_scale: "0.85",
199+
shield_gravity: "South",
200+
shield_geometry: "+0+5%",
201+
glob: "/ios/" + package['name'] + "/Images.xcassets/AppIcon.appiconset/*.png",
202+
)
203+
end
204+
205+
desc 'Make new versioned icon badges.'
206+
lane :make_badge do
207+
make_badge_ios
208+
make_badge_and
209+
end
210+
211+
desc 'Bump and badge iOS and Android.'
212+
lane :bump_badge do
213+
bump
214+
make_badge
215+
end

template/fastlane/Pluginfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Autogenerated by fastlane
2+
#
3+
# Ensure this file is checked in to source control!
4+
5+
gem 'fastlane-plugin-appcenter'
6+
gem 'fastlane-plugin-badge'
7+
gem 'fastlane-plugin-increment_version_name'
8+
gem 'fastlane-plugin-increment_version_code'
9+
gem 'fastlane-plugin-load_json'

0 commit comments

Comments
 (0)