Skip to content

Commit c781627

Browse files
committed
Merge branch 'develop'
2 parents 343b803 + 9b7b9ec commit c781627

File tree

283 files changed

+10729
-3020
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

283 files changed

+10729
-3020
lines changed

.circleci/README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# How to generate CI environment vars
2+
3+
## TODO
4+
5+
- [ ] Replace username, itc_team_id and specific_password to App Store Connect API Key
6+
7+
## Shared
8+
9+
- SENDBIRD_APP_ID
10+
- Your sendbird application id
11+
12+
## Android
13+
14+
- FASTLANE_ANDROID_SERVICE_ACCOUNT
15+
- Create service-account(firebase_app_distribution role) from google cloud console
16+
- Download JSON key file
17+
- Decode as a base64
18+
- `cat service-account.json | base64 >> decoded.txt`
19+
- Save decoded text to environment
20+
- FASTLANE_ANDROID_APP_ID
21+
- Open your firebase project settings > general
22+
- Find your android app (formatted like 1:xxxxxxxxxxxxxxxx)
23+
- Save app id to environment
24+
25+
## iOS
26+
27+
- FASTLANE_IOS_APPLE_ID
28+
- Your apple id(email)
29+
- FASTLANE_IOS_TEAM_ID
30+
- You can find out from the ends of [apple developers](https://developer.apple.com/account) site url
31+
- FASTLANE_IOS_ITC_TEAM_ID
32+
- iTunes connect team id, refer this [link](https://github.com/fastlane/fastlane/issues/4301#issuecomment-253461017)
33+
- FASTLANE_IOS_MATCH_GIT_URL
34+
- URL should be starts with `git@` (ssh)
35+
- Save match git url to environment, you can find out from our github organization repos
36+
- Authorization with SSH
37+
- Open CircleCI Project settings > SSH Keys
38+
- Add User Key
39+
- FASTLANE_IOS_MATCH_PASSWORD
40+
- You can find out password from Match Git repository description
41+
- FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD
42+
- Open [apple id](https://appleid.apple.com/account/manage) site
43+
- Create Application Password
44+
- Save password to environment

.circleci/config.yml

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
### Aliases
2+
aliases:
3+
- &restore_node_modules_base
4+
key: yarn-base-{{ arch }}-{{ checksum "yarn.lock" }}-v1
5+
- &restore_node_modules_packages
6+
key: yarn-packages-{{ arch }}-{{ checksum "yarn.lock" }}-v1
7+
- &install_node_modules
8+
name: Install node_modules
9+
command: yarn install --frozen-lockfiles
10+
- &save_node_modules_base
11+
key: yarn-base-{{ arch }}-{{ checksum "yarn.lock" }}-v1
12+
paths:
13+
- ~/.cache/yarn
14+
- node_modules
15+
- &save_node_modules_packages
16+
key: yarn-packages-{{ arch }}-{{ checksum "yarn.lock" }}-v1
17+
paths:
18+
- sample/node_modules
19+
- packages/chat-react-hooks/node_modules
20+
- packages/uikit-react-native/node_modules
21+
- packages/uikit-react-native-core/node_modules
22+
- packages/uikit-react-native-foundation/node_modules
23+
- packages/uikit-utils/node_modules
24+
- &create_app_env
25+
name: Create env.ts
26+
command: echo "export const APP_ID = '${SENDBIRD_APP_ID}';" >> sample/src/env.ts
27+
28+
### Circle CI
29+
# https://circleci.com/docs/2.0/env-vars/#built-in-environment-variables
30+
# https://circleci.com/docs/2.0/testing-ios/#supported-xcode-versions
31+
version: 2.1
32+
orbs:
33+
ruby: circleci/ruby@1.6.0
34+
macos: circleci/macos@2
35+
parameters:
36+
platform:
37+
type: enum
38+
default: 'Noop'
39+
enum: ['All', 'iOS', 'Android', 'Noop']
40+
41+
jobs:
42+
deploy-ios:
43+
macos:
44+
xcode: 13.3.0
45+
resource_class: large
46+
steps:
47+
- checkout
48+
- macos/switch-ruby:
49+
version: '2.7.5'
50+
- ruby/install-deps:
51+
key: gems-ios
52+
app-dir: ./sample/ios
53+
- restore_cache: *restore_node_modules_base
54+
- restore_cache: *restore_node_modules_packages
55+
- run: *install_node_modules
56+
- save_cache: *save_node_modules_base
57+
- save_cache: *save_node_modules_packages
58+
- restore_cache:
59+
key: pods-{{ arch }}-{{ checksum "sample/ios/Podfile.lock" }}
60+
- run:
61+
name: Install pods
62+
working_directory: sample/ios
63+
command: bundle exec pod install
64+
- save_cache:
65+
key: pods-{{ arch }}-{{ checksum "sample/ios/Podfile.lock" }}
66+
paths:
67+
- sample/ios/Pods
68+
- run: *create_app_env
69+
- run:
70+
name: Expose environments
71+
command: |
72+
echo "export MATCH_PASSWORD=$FASTLANE_IOS_MATCH_PASSWORD" >> $BASH_ENV
73+
echo "export MATCH_GIT_URL=$FASTLANE_IOS_MATCH_GIT_URL" >> $BASH_ENV
74+
echo "export PILOT_USERNAME=$FASTLANE_IOS_APPLE_ID" >> $BASH_ENV
75+
echo "export PILOT_APPLE_ID=$FASTLANE_IOS_ITC_TEAM_ID" >> $BASH_ENV
76+
echo "export PILOT_DEV_PORTAL_TEAM_ID=$FASTLANE_IOS_TEAM_ID" >> $BASH_ENV
77+
echo "export PILOT_SKIP_WAITING_FOR_BUILD_PROCESSING=true" >> $BASH_ENV
78+
echo "export FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD=$FASTLANE_IOS_APPLE_APPLICATION_SPECIFIC_PASSWORD" >> $BASH_ENV
79+
- run:
80+
name: Run fastlane
81+
command: yarn deploy:ios
82+
83+
deploy-android:
84+
docker:
85+
- image: cimg/android:2022.03-node
86+
resource_class: xlarge
87+
steps:
88+
- checkout
89+
- ruby/install:
90+
version: '2.7.5'
91+
- ruby/install-deps:
92+
key: gems-android
93+
app-dir: ./sample/android
94+
- restore_cache: *restore_node_modules_base
95+
- restore_cache: *restore_node_modules_packages
96+
- run: *install_node_modules
97+
- save_cache: *save_node_modules_base
98+
- save_cache: *save_node_modules_packages
99+
- run: *create_app_env
100+
- run:
101+
name: Create service-account.json
102+
environment:
103+
- FILE_PATH: sample/android/fastlane/service-account.json
104+
command: |
105+
echo "$FASTLANE_ANDROID_SERVICE_ACCOUNT" | base64 --decode >> $FILE_PATH
106+
echo "export GOOGLE_APPLICATION_CREDENTIALS=$CIRCLE_WORKING_DIRECTORY/$FILE_PATH" >> $BASH_ENV
107+
echo "export FIREBASEAPPDISTRO_APP=$FASTLANE_ANDROID_APP_ID" >> $BASH_ENV
108+
- run:
109+
name: Run fastlane
110+
command: yarn deploy:android
111+
112+
workflows:
113+
run-ios:
114+
when:
115+
or:
116+
- equal: [<< pipeline.parameters.platform >>, 'All']
117+
- equal: [<< pipeline.parameters.platform >>, 'iOS']
118+
jobs:
119+
- deploy-ios
120+
run-android:
121+
when:
122+
or:
123+
- equal: [<< pipeline.parameters.platform >>, 'All']
124+
- equal: [<< pipeline.parameters.platform >>, 'Android']
125+
jobs:
126+
- deploy-android

.eslintrc.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,27 @@ module.exports = {
22
'env': {
33
'es2021': true,
44
},
5-
'extends': ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
5+
'extends': ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'],
66
'parser': '@typescript-eslint/parser',
77
'parserOptions': {
88
'ecmaVersion': 12,
99
'sourceType': 'module',
1010
},
1111
'plugins': ['@typescript-eslint'],
1212
'rules': {
13-
'linebreak-style': [2, 'unix'],
14-
'no-console': 1,
15-
'curly': [1, 'multi-line'],
16-
'semi': [1, 'always'],
17-
'quotes': [1, 'single'],
18-
'arrow-parens': [1, 'always'],
19-
'eol-last': [1, 'always'],
20-
'multiline-ternary': [1, 'always-multiline'],
21-
'no-nested-ternary': 1,
22-
'no-empty': [1, { 'allowEmptyCatch': true }],
23-
'comma-dangle': [1, 'always-multiline'],
24-
'@typescript-eslint/ban-types': 0,
25-
'@typescript-eslint/ban-ts-comment': 0,
26-
'@typescript-eslint/no-var-requires': 0,
13+
'linebreak-style': ['error', 'unix'],
14+
'no-console': 'warn',
15+
'curly': ['warn', 'multi-line'],
16+
'semi': ['error', 'always'],
17+
'quotes': ['error', 'single', { avoidEscape: true }],
18+
'arrow-parens': ['error', 'always'],
19+
'eol-last': ['warn', 'always'],
20+
'multiline-ternary': ['warn', 'always-multiline'],
21+
'no-nested-ternary': 'error',
22+
'no-empty': ['error', { 'allowEmptyCatch': true }],
23+
'comma-dangle': ['warn', 'always-multiline'],
24+
'@typescript-eslint/ban-types': 'off',
25+
'@typescript-eslint/ban-ts-comment': 'off',
26+
'@typescript-eslint/no-var-requires': 'off',
2727
},
2828
};

.github/workflows/status-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Status_Build
1+
name: STATUS_BUILD
22
on:
33
push:
44
branches:

.github/workflows/status-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Status_Test
1+
name: STATUS_TEST
22
on:
33
push:
44
branches:

.github/workflows/trigger-deploy.yml

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
name: TRIGGER_DEPLOY
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
platform:
7+
description: 'Select target platform'
8+
required: true
9+
type: choice
10+
options:
11+
- All
12+
- Android
13+
- iOS
14+
15+
jobs:
16+
execute:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- run: echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
20+
- name: '[${{ github.event.inputs.platform }}] Deploy trigger'
21+
if: ${{github.event.inputs.platform}}
22+
uses: promiseofcake/circleci-trigger-action@v1
23+
with:
24+
user-token: ${{ secrets.CIRCLECI_PERSONAL_API_TOKEN }}
25+
project-slug: sendbird/sendbird-uikit-react-native
26+
branch: ${{ env.BRANCH_NAME }}
27+
payload: '{"platform": "${{ github.event.inputs.platform }}" }'
28+
29+
#env:
30+
# CACHE_NODE_MODULES_PATH: |
31+
# node_modules
32+
# packages/*/node_modules
33+
# sample/node_modules
34+
#
35+
#jobs:
36+
# deploy-android:
37+
# name: '[Android] Deploy'
38+
# if: ${{ github.event.inputs.platform == 'Android' || github.event.inputs.platform == 'All' }}
39+
# runs-on: ubuntu-latest
40+
# steps:
41+
# - uses: actions/checkout@v3
42+
# - uses: actions/setup-node@v1
43+
# with:
44+
# node-version: 16.x
45+
# - uses: ruby/setup-ruby@v1
46+
# env:
47+
# BUNDLE_GEMFILE: ${{ github.workspace }}/sample/android/Gemfile
48+
# with:
49+
# ruby-version: 2.7
50+
# bundler-cache: true
51+
# - name: Get lockfile hash
52+
# id: lockfile_hash
53+
# run: echo "::set-output name=hash::${{ hashFiles('**/yarn.lock') }}"
54+
# - name: Check cached node_modules
55+
# id: check_cache
56+
# uses: actions/cache@v2
57+
# with:
58+
# path: ${{ env.CACHE_NODE_MODULES_PATH }}
59+
# key: ${{ steps.lockfile_hash.outputs.hash }}
60+
# - name: Install dependencies
61+
# if: steps.check_cache.outputs.cache-hit == ''
62+
# run: yarn install --frozen-lockfile
63+
# - name: Create env.ts
64+
# run:
65+
# echo "export const APP_ID = '${{ secrets.sendbird_app_id }}';" >> sample/src/env.ts
66+
#
67+
# - name: Create service-account.json
68+
# uses: /bang9/create-env-json@v3
69+
# id: service-account
70+
# with:
71+
# file-name: './sample/android/fastlane/service-account.json'
72+
# type: 'service_account'
73+
# auth_uri: 'https://accounts.google.com/o/oauth2/auth'
74+
# token_uri: 'https://oauth2.googleapis.com/token'
75+
# auth_provider_x509_cert_url: 'https://www.googleapis.com/oauth2/v1/certs'
76+
# project_id: ${{ secrets.fastlane_android_account_project_id }}
77+
# private_key_id: ${{ secrets.fastlane_android_account_private_key_id }}
78+
# private_key: '${{ secrets.fastlane_android_account_private_key }}'
79+
# client_email: ${{ secrets.fastlane_android_account_client_email }}
80+
# client_id: ${{ secrets.fastlane_android_account_client_id }}
81+
# client_x509_cert_url: ${{ secrets.fastlane_android_account_client_x509_cert_url }}
82+
# - name: Run fastlane
83+
# env:
84+
# FIREBASEAPPDISTRO_APP: ${{ secrets.fastlane_android_app_id }}
85+
# GOOGLE_APPLICATION_CREDENTIALS: ${{ steps.service-account.outputs.full-path }}
86+
# run: yarn deploy:android
87+
#
88+
# deploy-ios:
89+
# name: '[iOS] Deploy'
90+
# if: ${{ github.event.inputs.platform != 'Android' }}
91+
# runs-on: macos-latest
92+
# steps:
93+
# - uses: actions/checkout@v3
94+
# - uses: actions/setup-node@v1
95+
# with:
96+
# node-version: 16.x
97+
# - uses: ruby/setup-ruby@v1
98+
# env:
99+
# BUNDLE_GEMFILE: ${{ github.workspace }}/sample/ios/Gemfile
100+
# with:
101+
# ruby-version: 2.7
102+
# bundler-cache: true
103+
# - name: Get lockfile hash
104+
# id: lockfile_hash
105+
# run: echo "::set-output name=hash::${{ hashFiles('**/yarn.lock') }}"
106+
# - name: Check cached node_modules
107+
# id: check_cache
108+
# uses: actions/cache@v2
109+
# with:
110+
# path: ${{ env.CACHE_NODE_MODULES_PATH }}
111+
# key: ${{ steps.lockfile_hash.outputs.hash }}
112+
# - name: Install dependencies
113+
# if: steps.check_cache.outputs.cache-hit == ''
114+
# run:
115+
# yarn install --frozen-lockfile
116+
# - name: Install pods
117+
# run: cd sample/ios && pod install
118+
# - name: Create env.ts
119+
# run:
120+
# echo "export const APP_ID = '${{ secrets.sendbird_app_id }}';" >> sample/src/env.ts
121+
# - name: Run fastlane
122+
# env:
123+
# TEAM_ID: ${{ secrets.fastlane_ios_team_id }}
124+
# MATCH_PASSWORD: ${{ secrets.fastlane_ios_match_password }}
125+
# MATCH_GIT_URL: ${{ secrets.fastlane_ios_match_git_url }}
126+
# MATCH_GIT_BASIC_AUTHORIZATION: ${{ secrets.fastlane_ios_match_git_basic_authorization }}
127+
# APPLE_ID: ${{ secrets.fastlane_ios_apple_id }}
128+
# FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD: ${{ secrets.fastlane_ios_apple_application_specific_password }}
129+
# run: yarn deploy:ios

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ build
1717
/lib/
1818

1919
env.ts
20+
*.app.dSYM.zip

0 commit comments

Comments
 (0)